这是我在 asp.net mvc core 5 中的 dbml 文件
当我尝试为修改后的表创建一个新实体,然后将新属性从新实体拖/剪切到旧实体时,控制器中出现此错误
“dbQLBansachDataContext”不包含采用 0 个参数的构造函数
如何修复此错误?
新版本的 Visual Studio 不包含在文件中(在 DBML ...___designer.cs > dbQLBansachDataContext.designer.cs 内)空构造函数。您需要添加它。
公共 dbQLBansachDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}