小编Sil*_*hus的帖子

实体框架 - 使用多列索引作为标识符的种子AddOrUpdate

我试图使用该context.AddOrUpdate方法播种数据库,但问题是我需要根据多列索引使插入的数据唯一.

[Table("climbing_grades")]
public class ClimbingGrade : EntityBase
{
    /// <summary>
    /// The name of the climbing grade, e.g.: 7a, VII, etc.
    /// </summary>
    [Index("IX_Name_GradeType", 1, IsUnique = true)]
    public string Name { get; set; }

    /// <summary>
    /// Tries to display the average difficulty of the described grade.
    /// Matching the different grades can be difficult because its always
    /// a subjective rating and there exists no norm on converting grades.
    /// </summary>
    public double Difficulty { get; …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework seeding ef-code-first ef-migrations

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

如何在Visual Studio 2015中的"创建单元测试"上下文菜单中添加其他测试项目?

如何在Visual Studio 2015中的"创建单元测试"的右键单击上下文菜单中添加现有的测试项目?

它仅显示其中一个测试项目(项目是使用右键单击上下文操作创建的).另一个项目是使用新项目向导创建的,未显示.

缺少项目 可用的单元测试项目

有没有办法将现有的单元测试项目添加到下拉列表中?

unit-testing xunit visual-studio visual-studio-2015

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

如何使用 Azure DevOps 管道表达式检查数组是否包含字符串

我有以下管道模板,我想用它来根据输入参数有条件地执行阶段stages

parameters:
- name: dryRun
  default: false
  type: boolean
- name: path
  type: string
  default: terraform
- name: stages
  type: object
  default:
  - test
  - prod

stages:
  - stage:
    pool: 
      vmImage: 'ubuntu-latest'
    displayName: "Deploy to test"
    condition: in('test', ${{ parameters.stages }})
    jobs:
    - template: terraform-job.yaml
      parameters:
        stage: test
        path: ${{ parameters.path }}
        dryRun: ${{ parameters.dryRun }}
  - stage:
    pool: 
      vmImage: 'ubuntu-latest'
    displayName: "Deploy to production"
    condition: in('prod', '${{ join(', ', parameters.stages) }}')
    jobs:
    - template: terraform-job.yaml
      parameters:
        stage: …
Run Code Online (Sandbox Code Playgroud)

yaml azure-devops azure-yaml-pipelines

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

如何将ASP 5/Core Web API与[授权]属性集成测试

我目前有一个ASP 5/ASP核心Web API,我需要与OWIN测试服务器进行集成测试.

问题是我在生产中使用IdentityServer作为授权服务器,我不想将授权作为集成测试的一部分.

这是API的Startup.cs:

public Startup(IHostingEnvironment env)
{
    // Set up configuration sources.
    IConfigurationBuilder builder = new ConfigurationBuilder()
        .AddJsonFile("appsettings.json")
        .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true);

    if (env.IsEnvironment("Development"))
    {
        // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
        builder.AddApplicationInsightsSettings(developerMode: true);
    }

    builder.AddEnvironmentVariables();
    Configuration = builder.Build().ReloadOnChanged("appsettings.json");
}

public IConfigurationRoot Configuration { get; set; }

// This method gets called by the runtime. Use this method to add services to the container
public IServiceProvider ConfigureServices(IServiceCollection services)
{
    // …
Run Code Online (Sandbox Code Playgroud)

integration-testing owin owin-middleware asp.net-core asp.net5

4
推荐指数
1
解决办法
2587
查看次数

在 Azure 上使用 Git 子模块持续部署 VSTS 应用程序失败

我正在尝试使用Deployment sourceAzure Web 应用程序中的选项将包含子模块的 VSTS(Visual Studio Team Services)Git 应用程序部署到 Azure 。

所有子模块都托管在同一个 VSTS 项目中,但位于不同的 Git 存储库下。

部署到 Azure 失败并显示以下错误消息:

致命:无法读取“ https://XXX.visualstudio.com ”的用户名:错误的文件描述符\n将“ https://XXX.visualstudio.com/defaultcollection/Project/_git/Project.API.Models ”克隆到子模块中路径“lib/api-models”失败\n\r\nD:\Program Files (x86)\Git\cmd\git.exe 子模块更新 --init --recursive

有什么方法可以将包括子模块在内的 Git 项目部署到 Azure?

git azure git-submodules continuous-deployment azure-web-app-service

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