小编Lui*_*cia的帖子

实体框架:已经有一个与此命令关联的开放DataReader,必须先关闭它

这个问题与有关:

我的存储库方法有这个代码:

 public IEnumerable<ApplicationPositionHistory> GetApplicationPositionHistories(int applicantId, int positionId)
        {
            return context.ApplicationsPositionHistory.Where(d => d.applicantPosition.ApplicantID == applicantId && d.applicantPosition.PositionID == positionId).Include(o => o.applicantPosition) ;
        }
Run Code Online (Sandbox Code Playgroud)

我的Html有这个代码:

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.applicantPosition.Applicant.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.applicantPosition.Position.name)
        </td>
Run Code Online (Sandbox Code Playgroud)

完整的例外是:

已经有一个与此命令关联的打开DataReader,必须先关闭它.

这是在第一行抛HTML @ Html.DisplayFor(modelItem => item.applicantPosition.Applicant.name)

asp.net-mvc entity-framework entity-framework-4 entity-framework-4.1 asp.net-mvc-3

8
推荐指数
3
解决办法
3万
查看次数

使用通配符搜索samaccountname

我有这个代码:

 public static DataTable ExecutesAMAccountNameQuery(string sAMAccountName)
        {
            string filter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" + sAMAccountName + "))";
            return ExecuteADQuery("GC:", filter);
        }
Run Code Online (Sandbox Code Playgroud)

它只适用于完整的用户名,我不知道使其与通配符一起使用的语法,比如sql中的LIKE?

谢谢

c# active-directory

8
推荐指数
1
解决办法
2万
查看次数

用实体框架执行自定义sql?

我需要执行一个自定义查询,它将保存在数据库的某个地方,我需要它返回数据表或数据集并将其绑定到gridview,它将自动生成列为true.

我的所有数据访问层都与实体框架完美配合,但对于某些特定场景,我需要这样做,我想知道是否应该将ado.net与实体框架结合起来,或者如果EF能以某种方式实现它

c# ado.net entity-framework entity-framework-4

8
推荐指数
3
解决办法
4万
查看次数

如何检测方向变化和更改布局?

让我们说我有一个网格,每个单元格内有2行,2列和许多控件.

当应用程序更改为快照模式时,我的意思是屏幕的1/3,我希望应用程序只有一个列,2行,并且只显示我将决定的一些控件.

我对此有什么样的控制?

谢谢

xaml microsoft-metro windows-8 windows-runtime

8
推荐指数
3
解决办法
1万
查看次数

asp.net mvc azure AAD身份验证无限循环

我有一个带有azure AAD登录的asp.net mvc应用程序.当我按f5调试应用程序转到azure在AAD中进行身份验证时,它会返回到应用程序到控制器,然后重定向回到azure.

我知道这个,因为如果我在登录控制器上放置一个断点,它会无限受到攻击

这是我的路线配置

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            //routes.IgnoreRoute("");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Dashboards", action = "Dashboard_1", id = UrlParameter.Optional }
            );
        }
Run Code Online (Sandbox Code Playgroud)

这是我的仪表板控制器,已授权

[Authorize]
    public class DashboardsController : Controller
    {
        public ActionResult Dashboard_1()
        {
            return View();
        }
Run Code Online (Sandbox Code Playgroud)

这是我的登录和签名帐户控制器操作

public class AccountController : Controller
    {
        public void SignIn()
        {
            if (!Request.IsAuthenticated)
            {
                HttpContext.GetOwinContext().Authentication.Challenge(
                                new AuthenticationProperties { RedirectUri = "/" },
                                OpenIdConnectAuthenticationDefaults.AuthenticationType);
            }
        }

        public void SignOut()
        {
            // Remove all …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc owin adal

8
推荐指数
1
解决办法
4000
查看次数

如何使用ADAL JS获取当前用户角色

我有以下反应应用程序,这是envato的模板。我已经使用此组件集成了Azure AD身份验证,并且可以正常运行:

https://github.com/salvoravida/react-adal

但是,我想创建ROLES,并且希望能够根据当前用户的角色在侧栏上显示菜单项。

我已经知道如何使用应用程序清单在Azure AD中创建角色,所以这个问题更多地是关于在用户经过身份验证之后如何获得这些角色以及如何根据声明值呈现菜单项。

这里的相关代码段:

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import DashApp from './dashApp';
import registerServiceWorker from './registerServiceWorker';
import 'antd/dist/antd.css';
import { runWithAdal } from 'react-adal';
import { authContext } from './adalConfig';

const DO_NOT_LOGIN = false;
runWithAdal(authContext, () => {
  ReactDOM.render(<DashApp />, document.getElementById('root'));
  // Hot Module Replacement API
  if (module.hot) {
    module.hot.accept('./dashApp.js', () => {
      const NextApp = require('./dashApp').default;
      ReactDOM.render(<NextApp />, document.getElementById('root'));
    });
  }

},DO_NOT_LOGIN);

registerServiceWorker();
Run Code Online (Sandbox Code Playgroud)

AdalConfig.js

从'react-adal'导入{AuthenticationContext,adalFetch,withAdalLogin};

export const adalConfig = {
  tenant: …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs azure-active-directory adal adal.js

8
推荐指数
1
解决办法
1699
查看次数

类属性必须是方法.预期'('但是看到'='

我有一个反应应用程序,我有这个代码,但看起来fetchdata m ethod充满了语法错误,第一个显示在问题的标题上.

该方法有什么问题?

import React, { Component } from 'react';

import { Row, Col } from 'antd';
import PageHeader from '../../components/utility/pageHeader';
import Box from '../../components/utility/box';
import LayoutWrapper from '../../components/utility/layoutWrapper.js';
import ContentHolder from '../../components/utility/contentHolder';
import basicStyle from '../../settings/basicStyle';
import IntlMessages from '../../components/utility/intlMessages';
import { adalApiFetch } from '../../adalConfig';

const data = {
  TenantId: this.this.state.tenantid,
  TenanrUrl: this.state.tenanturl,
  TenantPassword: this.state.tenantpassword 
};

const options = {
  method: 'post',
  data: data,
  config: {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }
};

export default class extends …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

8
推荐指数
1
解决办法
4880
查看次数

找不到指定格式的软件包:D:\ a \ r1 \ a \ ** \ *。zip

我使用npm build在vsts中创建了一个构建定义,然后将build文件夹复制到放置位置。

构建管道运行正常

然后,我创建了发布定义,它也正确下载了文件:

2018-08-10T16:29:18.5241580Z Downloading artifact drop from: https://xx.visualstudio.com//_apis/resources/Containers/711976?itemPath=drop&isShallow=true&api-version=4.1-preview.4
2018-08-10T16:29:18.5252684Z Downloading drop/s/build/asset-manifest.json to D:\a\r1\a\InnovationInABox-CI\drop\s\build\asset-manifest.json
2018-08-10T16:29:18.5253850Z Downloaded drop/s/build/asset-manifest.json to D:\a\r1\a\InnovationInABox-CI\drop\s\build\asset-manifest.json
2018-08-10T16:29:18.5338277Z Downloading drop/s/build/favicon.png to D:\a\r1\a\InnovationInABox-CI\drop\s\build\favicon.png
2018-08-10T16:29:18.5338720Z Downloaded drop/s/build/favicon.png to D:\a\r1\a\InnovationInABox-CI\drop\s\build\favicon.png
2018-08-10T16:29:19.5191236Z Downloading drop/s/build/index.html to D:\a\r1\a\InnovationInABox-CI\drop\s\build\index.html
2018-08-10T16:29:19.5191520Z Downloaded drop/s/build/index.html to D:\a\r1\a\InnovationInABox-CI\drop\s\build\index.html
2018-08-10T16:29:19.5195415Z Downloading drop/s/build/manifest.json to D:\a\r1\a\InnovationInABox-CI\drop\s\build\manifest.json
2018-08-10T16:29:19.5195775Z Downloaded drop/s/build/manifest.json to D:\a\r1\a\InnovationInABox-CI\drop\s\build\manifest.json
2018-08-10T16:29:19.5198280Z Downloading drop/s/build/service-worker.js to D:\a\r1\a\InnovationInABox-CI\drop\s\build\service-worker.js
2018-08-10T16:29:19.5198598Z Downloaded drop/s/build/service-worker.js to D:\a\r1\a\InnovationInABox-CI\drop\s\build\service-worker.js
2018-08-10T16:29:19.5704236Z Downloading drop/s/build/css/ionicons.min.css to D:\a\r1\a\InnovationInABox-CI\drop\s\build\css\ionicons.min.css
2018-08-10T16:29:19.5725284Z Downloaded drop/s/build/css/ionicons.min.css to D:\a\r1\a\InnovationInABox-CI\drop\s\build\css\ionicons.min.css
2018-08-10T16:29:19.5833575Z Downloading drop/s/build/iconfont/iconfont.svg to D:\a\r1\a\InnovationInABox-CI\drop\s\build\iconfont\iconfont.svg
2018-08-10T16:29:19.5868415Z Downloading drop/s/build/fonts/ionicons.eot to D:\a\r1\a\InnovationInABox-CI\drop\s\build\fonts\ionicons.eot …
Run Code Online (Sandbox Code Playgroud)

tfs npm reactjs azure-devops yarnpkg

8
推荐指数
3
解决办法
1万
查看次数

antd上传控件需要动作功能,但我不需要

我正在使用ant设计组件,并且有一个上传输入:https : //ant.design/components/upload/

根据文档,需要对道具进行操作。

但是我不需要在上传时将文件发布到url,我需要将整个FORM提交到其他端点(检查handlesubmit函数)

尝试浏览文档时,我使用了handlechange事件将文件添加到状态,但是STATUS从未完成,因此该行从未被点击过。

我在这里想念什么?

import React, { Component } from 'react';
import { Input, Upload , Icon, message} from 'antd';
import Form from '../../components/uielements/form';
import Checkbox from '../../components/uielements/checkbox';
import Button from '../../components/uielements/button';
import Notification from '../../components/notification';
import { adalApiFetch } from '../../adalConfig';

const FormItem = Form.Item;

class RegisterTenantForm extends Component {
    constructor(props) {
        super(props);
        this.state = {TenantId: '', TenantUrl: '', CertificatePassword: '', confirmDirty: false, loading: false, buttondisabled: true};
        this.handleChangeTenantUrl = this.handleChangeTenantUrl.bind(this);
        this.handleChangeCertificatePassword = this.handleChangeCertificatePassword.bind(this);
        this.handleChangeTenantId= this.handleChangeTenantId.bind(this); …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs antd

7
推荐指数
3
解决办法
6159
查看次数

带有 REST Post 请求的 415(不支持的媒体类型)

我有一个反应组件,当按下复选框时,它会调用一个休息 api,使用单个参数发布请求。

我在 webapi 中放置了一个断点并且它从未命中,但我仍然在组件上获得了 415 unsopported 媒体类型

react js component (see onchange event)

import React, { Component } from 'react';
import {  Table, Radio} from 'antd';
import { adalApiFetch } from '../../adalConfig';
import Notification from '../../components/notification';

class ListTenants extends Component {

    constructor(props) {
        super(props);
        this.state = {
            data: []
        };
    }



    fetchData = () => {
        adalApiFetch(fetch, "/Tenant", {})
          .then(response => response.json())
          .then(responseJson => {
            if (!this.isCancelled) {
                const results= responseJson.map(row => ({
                    key: row.ClientId,
                    ClientId: row.ClientId,
                    ClientSecret: row.ClientSecret, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery asp.net-web-api reactjs asp.net-web-api2

7
推荐指数
2
解决办法
1万
查看次数