损坏的迁移快照.net核心ef

问题描述

使用Npgsql.EntityFrameworkCore.Postgresql时,如果有一个标识符和架构名称,我会得到一个损坏的迁移快照。 创建模型(抽象类MyModel和从其继承的其他一些类) 创建配置示例。

var Person = function(firstname,lastname,gender) {
  this.firstname = firstname;
  this.lastname = lastname;
  this.gender = gender;
}

Person.prototype.name = function() {
  return this.firstname + " " + this.lastname;
}

var Employee = function(firstName,lastName,gender,title) {

  Person.call(this,firstName,gender);

  this.title = title;

};

Employee.prototype = Object.create(Person.prototype);
Employee.prototype.constructor = Employee;

var e = new Employee('Abc','efg','Tree','CEO');

//Prints true
console.log(e.hasOwnProperty('firstname'));
//Prints false
console.log(e.hasOwnProperty('name'));

在dbContext中执行modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());在OnModelCreating方法中。

运行dotnet ef迁移在控制台中添加“ Init”

获取错误的快照

this

我检查了是否在配置中设置了鉴别符(使用Hasdiscriminator方法)是否重要,但快照是相同的。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)