我的第一个非常基本的与EF6相关的代码(选项“空代码优先模型”)引发异常(下面的标记行),声明connectionString中缺少元数据关键字。我应该设置什么CSDL,MDL,SSDL(元数据)作为模型为空?我想念什么?
//Model source file
public class Modelno : DbContext
{
public Modelno(): base("name=Modelno") {}
public virtual DbSet<MainTBL> MainTBLs { get; set; }
}
public class MainTBL
{
public int GlId { get; set; }
public string GlNam { get; set; }
}
//Form source file
private void button1_Click(object sender, EventArgs e)
{
MainTBL gl = new MainTBL();
gl.GlId = 1;
gl.GlNam = "SomeName";
Modelno modal = new Modelno();
modal.MainTBLs.Add(gl); // exception here !
modal.SaveChanges();
}
//App.config file (partially)
<connectionStrings>
<add name="Modelno" connectionString="provider=FirebirdSql.Data.FirebirdClient;provider connection string="data source=localhost;initial catalog=D:\Fb\tab\TEST2.FDB;user id=SYSDBA;password=masterkey"" providerName="System.Data.EntityClient"/>
</connectionStrings>