将列添加到数据库 dbml 文件 linq 时出现此错误

问题描述 投票:0回答:1

这是我在 asp.net mvc core 5 中的 dbml 文件

当我尝试为修改后的表创建一个新实体,然后将新属性从新实体拖/剪切到旧实体时,控制器中出现此错误

“dbQLBansachDataContext”不包含采用 0 个参数的构造函数

如何修复此错误?

asp.net linq controller
1个回答
0
投票

新版本的 Visual Studio 不包含在文件中(在 DBML ...___designer.cs > dbQLBansachDataContext.designer.cs 内)空构造函数。您需要添加它。

公共 dbQLBansachDataContext() :

    base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, mappingSource)
  {
      OnCreated();
  }
© www.soinside.com 2019 - 2024. All rights reserved.