小编Ano*_*Dev的帖子

如何在同一.cs文件上重新创建初始迁移

正如EF Code First中常见的那样,我已经生成了一个"初始创建"迁移文件,其中找到了我的数据库的过时模型(我正在开发应用程序,因此模型仍在变化).现在我在我的代码中定义了一个"新模型",而不是为此创建新的迁移,我只想更新现有的文件,因为它仍然是最初的创建迁移.

我试过没有运气就试过这个

Update-database -targetmigration $ initialcreate

它回来了

Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
You can use the Add-Migration command to write the pending model changes to a code-based migration.
Run Code Online (Sandbox Code Playgroud)

我也试过这个,但它总是创建一个新的.cs文件

添加迁移InitialCreate

我会帮助你

entity-framework entity-framework-6

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

如何更新json对象中数组的特定项

我正在操作SQL Azure表/数据库中的JSON列,JSON对象形成如下:

{
  "statusId": "5A5BC717-F33A-42A5-8E48-99531C30EC87",
  "creationDateTime": "",
  "assignations": [
    {
      "userId": "CA3B0589-B558-4FCC-93A6-560754D324FC",
      "dateTime": "",
      "isCurrentAssigned": false
    },
    {
      "userId": "CA3B0589-B558-4FCC-93A6-560754D325E8",
      "dateTime": "",
      "isCurrentAssigned": false
    },
    {
      "userId": "CA3B0589-B558-4FCC-93A6-560754D347N",
      "dateTime": "",
      "isCurrentAssigned": true
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我想要完成的是在数组"assignations"中找到一个特定的元素,然后更新它的一些属性,就像这样:

UPDATE MyTable
SET JsonData = JSON_MODIFY(JsonData, '$.assignations.isCurrentAssigned', CONVERT(BIT, 0))
FROM MyDb
WHERE JSON_VALUE(JsonData, '$.assignations.isCurrentAssigned') = CONVERT(BIT, 1) AND
JSON_VALUE(JsonData, '$.assignations.userId') =  CONVERT(UNIQUEIDENTIFIER, 'CA3B0589-B558-4FCC-93A6-560754D347N')
Run Code Online (Sandbox Code Playgroud)

当然这个T-SQL无法正常工作,我将不胜感激

t-sql sql-server-2016 azure-sql-database

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

安装Qt 5.6:我应该选择哪些组件?

我打算开始学习Qt(我之前没有任何知识),所以我已经下载了最新的Windows和Linux稳定的网络安装程序(我已经到了机器),按照Windows的向导说明我到了"选择组件"步骤,但我很困惑什么是什么,我真正需要什么.

作为一个新手并且具有非常基本的Qt知识,我的计划是在Windows和Linux上测试我的代码,用于桌面控制台软件和桌面图形界面软件,AFAIK我需要使用像G ++这样运行的跨平台编译器来构建我的代码在Windows和Linux上,所以我认为这就是为什么Qt提供MinGW的安装,但是查看安装程序的可用组件列表我不能完全理解我应该选择哪个MinGW版本,这是Qt 5.6安装程序的列表:

在此输入图像描述

MinGW 4.9.2有两个选项,您能帮助理解有什么区别吗?我必须安装两个?

我得到的另一个问题是:使用当前版本的Qt,Qt Widgets或Qt Quick创建UI软件的首选方法是什么?

c++ qt qt5.6

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

获取从抽象类继承并在属性中具有特定值的类的实例

我正在一家工厂根据两个标准创建具体实例:

1)该类必须从特定的抽象类继承

2)类必须在重写属性中具有特定值

我的代码看起来像这样:

public abstract class CommandBase
{
    public abstract string Prefix { get; }
}

public class PaintCommand : CommandBase
{
    public override string Prefix { get; } = "P";
}

public class WalkCommand : CommandBase
{
    public override string Prefix { get; } = "W";
}

class Program
{
    static void Main(string[] args)
    {
        var paintCommand = GetInstance("P");
        var walkCommand = GetInstance("W");  

        Console.ReadKey();
    }

    static CommandBase GetInstance(string prefix)
    {
        try
        {            
            var currentAssembly = Assembly.GetExecutingAssembly();
            var concreteType …
Run Code Online (Sandbox Code Playgroud)

c# reflection

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