小编Kei*_*son的帖子

实体框架4.3.1到6 EDMX(ObjectContext)

我正在尝试将项目从EF 4.3.1升级到EF 6.0

模板使用ObjectContext现在,每当我更改模板时,它都会使用旧的EF 4.3.1命名空间覆盖*.Designer.cs文件中生成的代码,因此构建会中断.

有什么方法可以阻止这种情况发生吗?我看不到一个*.tt文件.重新生成EDMX并不是一个真正的选择,因为对概念模型进行了重要的定制(我已经有好几天了!).

我尝试创建一个新的EDMX作为测试,并表现出同样的问题.只要我将代码生成更改为"Default"以便ObjectContext使用,EDMXName.Designer.cs文件就会使用旧的命名空间编写.

using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
Run Code Online (Sandbox Code Playgroud)

这让我分心 - 我想我将不得不将其破解为EF 5.0

.net c# entity-framework edmx nuget

12
推荐指数
1
解决办法
5424
查看次数

无法在VSTS上打包Nuget包无法将"System.String"类型的对象转换为"NuGet.Frameworks.NuGetFramework"类型

在运行'pack'时,我收到以下错误...

2017-07-05T10:37:09.7762333Z ##[section]Starting: NuGet pack
2017-07-05T10:37:09.7762333Z ==============================================================================
2017-07-05T10:37:09.7762333Z Task         : NuGet
2017-07-05T10:37:09.7762333Z Description  : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet.
2017-07-05T10:37:09.7762333Z Version      : 2.0.3
2017-07-05T10:37:09.7762333Z Author       : Microsoft Corporation
2017-07-05T10:37:09.7762333Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
2017-07-05T10:37:09.7762333Z ==============================================================================
2017-07-05T10:37:10.9664575Z Downloading: https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
2017-07-05T10:37:11.0954621Z Caching tool: NuGet 4.0.0 x64
2017-07-05T10:37:11.1084622Z Using version: 4.0.0
2017-07-05T10:37:11.1094622Z Found tool in cache: NuGet 4.0.0 x64
2017-07-05T10:37:11.1214629Z [command]C:\Windows\system32\chcp.com 65001
2017-07-05T10:37:11.1634626Z Active code page: 65001 …
Run Code Online (Sandbox Code Playgroud)

nuget azure-devops

12
推荐指数
2
解决办法
4902
查看次数

Sinon.JS - 如何从存根中获取参数?

我正在尝试使用Sinon来测试看起来有点像这样的JS组件......

import Bootbox from "../helpers/bootbox";
import Guard from "../helpers/guard";
import UrlHelper from "../helpers/url-helper";

export default class DeleteButton {

    /**
     * Creates an instance of DeleteButton.
     * 
     * @param {object} element The DOM element to make into a delete button.
     * 
     * @memberOf DeleteButton
     */
    constructor(element) {
        Guard.throwIf(element, "element");

        this.deleteUri = element.getAttribute("data-delete-uri") || UrlHelper.current.url().split('?')[0];        
        this.title = element.getAttribute("data-title") || `Delete the item?`;
        this.cancelText = element.getAttribute("data-cancel") || `Cancel`;
        this.confirmText = element.getAttribute("data-confirm") || `Remove`;
        this.message = element.getAttribute("data-message") || `Do you want to delete the …
Run Code Online (Sandbox Code Playgroud)

javascript sinon sinon-chai

11
推荐指数
1
解决办法
9789
查看次数

Backbone.js带有自定义提取URL

我正在尝试在我的主干模型上设置一个变量获取方法,该方法将获取给定用户的当前模型.这可以从API上获得/api/mealplans/owner/{username}/current.

我写了以下模型.我注释掉了URL Root,因为原型提取调用只是使用了urlRoot,我想看看是否覆盖了我以某种方式传递的url参数.

var mealPlan = Backbone.Model.extend({
  name: 'Meal Plan',
  //urlRoot: '/api/mealplans',
  defaults: {},
  fetchCurrent: function (username, attributes, options) {
    attributes = attributes || {};
    options = options || {};
    if (options.url === undefined) {
      options.url = "/api/mealplans/owner/" + username + "/current";
    }
    return Backbone.Model.prototype.fetch.call(this, attributes, options);
  },
  validate: function (attributes) {
    // To be done
    return null;
  }
});
Run Code Online (Sandbox Code Playgroud)

我已经看到这样做,在其他地方的某些变体中,例如在backbone.js使用不同的url进行模型保存和获取 - 在这种情况下代码略有不同(我从那开始并将其分解以使其更容易给我看.)

当我将它传递给fetch时,options对象的url参数很好,但是它似乎忽略了它!

javascript backbone.js

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

Azure管理REST API - "身份验证失败.'授权'标头以无效格式提供."

我正在拼命地尝试将2个经典存储帐户从我的旧MSDN订阅移动到我的MPN订阅,并且我一直在打砖墙,因为只有通过REST API支持这些移动.

我按照这里的说明启用了API ....

https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/

和这里...

https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx

但我完全陷入了困境.我已根据建议创建了一个POST请求,以检查状态为"移动资源"指令中的第一个调用...

POST https://management.azure.com/subscriptions/ {subscriptionId} /providers/Microsoft.ClassicCompute/validateSubscriptionMoveAvailability

(将subscriptionId替换为每个的ID)并传递适当的源/目标主体.

我还提供了如下授权标题......

授权:{Azure门户生成的密钥}

现在完全迷失了.我尝试过使用Fiddler和Postman.PowerShell对我来说不是一个选项,因为我完全不知道它.我只想移动2个项目,到目前为止只是运行这些管理API已花费我超过15英镑,我的网站即将下降,因为我的信用将很快到期.

非常感激任何的帮助.

api rest azure azure-api-management

9
推荐指数
1
解决办法
9685
查看次数

使用MSTest,xUnit或NUnit与dotnet核心

TLDR - 跳转到答案,了解有关正在运行的xUnit或MSTest设置的详细信息.xUnit是最不痛苦的选择.

我一直无法让NUnit在我的构建服务器上工作,所以我已经尝试了尝试xUnit和MSTest - 两者都没有对我有用.

MSTest我不知道 - 我希望这可以工作,但是当我尝试从nuget安装dotnet-test-mstest时,我得到了依赖性问题,因为它的所有依赖库都不兼容netcoreapp1,例如....

依赖项MSTest.ObjectModel 1.0.1-preview不支持框架.NETCoreApp,Version = v1.0.

依赖关系MSTest.TestAdapter.Dotnet 1.0.4-preview不支持框架.

任何人都可以提供有关为什么会发生这种情况的建议吗?

.net mstest asp.net-core

5
推荐指数
1
解决办法
4646
查看次数

如何在环境变量中覆盖 appsettings.json 中基于数组的设置?

我在 appsettings.json 中有以下配置

"AvailableThemes": {
    "DefaultThemeKey": "abt",
    "Themes": [
      {
        "ThemeKey": "xc",
        "ThemeTitle": "XC 13"
      },
      {
        "ThemeKey": "abt",
        "ThemeTitle": "Taxis"
        "RegistrationSupported": true,
        "IntroText": "Hello",
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我需要能够在环境变量中覆盖 RegistrationSupported,以便我可以在禁用注册的情况下部署站点,并在链接的站点上线时启用它。

可用主题:主题:注册支持

但这是行不通的,因为它不知道要覆盖哪个项目。我试过这样的索引器......

可用主题:主题[1]:支持注册

...这不起作用。

asp.net azure .net-core

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

Manjaro / Arch Linux - 我如何信任我的 AspNet Dev 证书?

我使用 Manjaro 进行 dotnet 开发,最近在 SSL 方面遇到了严重问题。

当我运行网络应用程序时,我收到一条警告:The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see https://aka.ms/aspnet/https-trust-dev-cert.

我已经仔细浏览了该链接 - 它对我们 Linux 用户没有多大帮助,对 Manjaro / Arch 则没有多大帮助。

这让我在房子里转了一圈,试图弄清楚我需要做什么才能真正信任这个证书——我该运行什么?它实际存储在哪里?

我找到了很多信息,其中大部分似乎都已经过时了。我现在让自己陷入了一些混乱——它仍然不起作用,我已经尝试了很多东西。

我从 Github 上的一篇文章推断出以下命令,但我不确定存储位置是否正确。

# Start at home
cd ~

# Create cert
dotnet dev-certs https

# Export cert to current directory
dotnet dev-certs https -ep localhost.crt --format PEM

# Create the paths if necessary
cd /usr/share/ca-certificates
sudo mkdir trust-source
sudo chmod 755 …
Run Code Online (Sandbox Code Playgroud)

linux ssl-certificate manjaro asp.net-core

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