首页 \ 问答 \ 如何描述自动迁移的详细信息(How to describe details of an automatic migration)

如何描述自动迁移的详细信息(How to describe details of an automatic migration)

Entity Framework Code-First中,您可以根据模型中的代码更改启用自动迁移。

通过调用Update-Database ,这些更改是:

  1. [timestamp]_AutomaticMigration注册
  2. 生成SQL脚本并迁移数据库
  3. 将迁移存储在表__MigrationHistory中

__MigrationHistory表中,迁移在Model列中描述为一个大十六进制值。 例如:

0x1F8B0800000000000400CD57CD6EDB3810BE2FB0EF20F0B40512313F976D20B5C8CAC9C2D83A09AAB4775A1ADBC492944A5281FD6C3DF491FA0A1D...

在Visual Studio中的程序包管理器控制台中,您可以使用Get-Migrations检索自动迁移的列表。

但是,似乎没有办法检索特定自动迁移的详细信息 - 无论是SQL脚本,还是受影响的模型和字段。

有没有办法让我不知道要检索特定自动迁移的细节?


In Entity Framework Code-First you can enable automatic migrations based on code changes in the model.

By calling Update-Database, these changes are:

  1. Registered in a [timestamp]_AutomaticMigration
  2. Generate SQL scripts and migrate database
  3. Store the migration in the table __MigrationHistory

In the __MigrationHistory table, the migration is described in the Model column as a large hex value. eg:

0x1F8B0800000000000400CD57CD6EDB3810BE2FB0EF20F0B40512313F976D20B5C8CAC9C2D83A09AAB4775A1ADBC492944A5281FD6C3DF491FA0A1D...

In the Package Manager Console within Visual Studio, you can retrieve a list of automatic migrations with Get-Migrations.

However, there doesn't seem to be a way to retrieve the details of a particular automatic migration -- whether that's SQL script, or which model & fields are being affected.

Is there a way that I'm unaware of to retrieve details of a particular automatic migration?


原文:https://stackoverflow.com/questions/34676181
更新时间:2022-06-03 16:06

最满意答案

你没有指针数组。 你有一个节点数组。 显然,你想要的是这样的:

Node ** table;
...
this->table = new Node*[this->length];

或许你实际上并不需要一个指针数组,而只需要一个节点数组。 在这种情况下,除了以下内容外无需额外初始化:

this->table = new Node[this->length];

除此之外,除非这是一个学习练习,否则请查看标准库 ,其中包含动态数组哈希映射


You don't have an array of pointers. You have an array of Nodes. Apparently, what you want is something like this:

Node ** table;
...
this->table = new Node*[this->length];

Or maybe you don't actually need an array of pointers, but simply an array of nodes. In that case, no extra initialization is needed beyond:

this->table = new Node[this->length];

Beyond that, unless this is a learning exercise, take a look at the standard library, which has dynamic arrays and hash maps all ready for you.

相关问答

更多
  • int * array[10]; 静态地定义10个int数组上的10个指针 要动态: int **array = new int *[10]; 使用C ++后更好的解决方案:使用std::vector std::vector v; v.resize(10); v[2] = new int[50]; // allocate one array 因为我们使用向量作为指针数组,所以让我们完全摆脱指针 std::vector > v; v.resize(10); ...
  • 首先,您需要使用cdecl : 将vars声明为指向char的指针数组4的指针 如何初始化它取决于您的目标是什么。 但是,例如: // Create a new array vars = new (char *[1][4]); // Each element of the array in turn points to an array for (int i = 0; i < 4; i++) { (*vars)[i] = new char[27]; } ... // Cleanup for (i ...
  • 在C语法中,该行声明了一个由5个指针组成的数组。 int* arr[5]; 声明下面是5个int的数组。 int arr[5]; 上面的一行告诉编译器在内存中保留5倍于内存的相邻地址的int大小,这是从&arr[0] 。 虽然arr不是指针,但如果用作名称arr ,则衰减到指向第一个槽的指针(因此arr相当于&a[0] )。 int* p = arr; p是指向int的普通指针,分配给有效的内存地址,与arr (或&arr[0] )相同 数组和指针不同。 第一个区别是'arr'是一个常量,不能重新分 ...
  • 我真的不确定你为什么要使用一个整数指针数组而不仅仅是一个整数数组(这是我强烈推荐的),但如果这真的是你需要的,你就知道你在做什么(包括你的程序当前正在泄漏内存的事实),那么你可以使用std::transform()以这种方式重写你的构造函数: #include // ... testWithArray(int* myarray) { std::transform(myarray, myarray + ArraySize, ArrayOfPointers_, ...
  • 你在这里咬你的是C(和C ++)缺乏参考参数传递。 main()中的a与func()的a不同: a在main声明。 a通过值传递(因为没有其他方法)到func 。 a in func被分配给。 func返回。 它的a被破坏(泄漏的记忆),而main的a是未初始化的。 ??? main尝试使用。 段错误! 这里有一些可能的解决方案: 这是经典的C方式:传递一个指向值的指针。 在这种情况下,参数将是int ***a ,这有点荒谬,但无论如何。 void func(int ***a, int x, int y) ...
  • 如果你想提供的函数作为数组的默认内容被称为func ,那么 你最好使用typedef , 你必须使用数组初始值设定项 考虑: typedef int (*IntFunc)(void); IntFunc fparr[5] = { func, func, func, func, func }; 或者更不可读的方式,如果你想避免typedef : int (*fparr[5])(void) = { func, func, func, func, func }; If the function you want ...
  • 您的代码存在一些问题。 主要关注成员函数的使用而不是全局函数。 您尝试从对象中获取成员函数,您应该从类本身获取它们。 (即代替&fact.createAdditionCommand你需要&CommandFactory::createAdditionCommand 。)但是这会导致一个未绑定的成员函数,这意味着你需要使用(fact.*fn)() - 即使用CommandFactory类的对象来调用它。 这不是理想的 - 而不是你想要的。 您正在寻找绑定成员函数。 在非C ++ - 11应用程序中使用这些是可能 ...
  • 我有一个指向Bucket-Objects的指针数组 不,你有一个指向Bucket对象数组的指针。 指向Bucket对象的指针数组如下所示: Bucket * index[2]; 动态分配的桶对象指针数组将如下所示: Bucket ** index = new Bucket*[N]; 但你应该使用的是一个桶对象的共享指针向量,如下所示: std::vector>> index; I have an array of pointers ...
  • 技术评论 首先,你遇到问题因为readFile需要int * ,而不是int ** 。 如果你有 void readFile(int **array, int *size) { *array = malloc(X * sizeof(int)); ... 你实际上可以像在里面那样称呼它 int main() { int *array, size; readFile(& array, & size); ... 所以调用者的array将指向readFile分配的内容。 设计问题 对于您的具 ...
  • 你没有指针数组。 你有一个节点数组。 显然,你想要的是这样的: Node ** table; ... this->table = new Node*[this->length]; 或许你实际上并不需要一个指针数组,而只需要一个节点数组。 在这种情况下,除了以下内容外无需额外初始化: this->table = new Node[this->length]; 除此之外,除非这是一个学习练习,否则请查看标准库 ,其中包含动态数组和哈希映射 。 You don't have an array of point ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)