1

My first, very basic code related to EF6, option "Empty code first model", throws exception (marked line, below), declaring the lack of metadata keyword in connectionString. What CSDL, MDL, SSDL (metadata) should I set as my model is empty ? What am I missing ?

//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=&quot;data source=localhost;initial catalog=D:\Fb\tab\TEST2.FDB;user id=SYSDBA;password=masterkey&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>
Djole
  • 142
  • 11
  • maybe you should try setting `metadata` value as `Metadata=res://*/` within the connection string – akg179 Jun 11 '19 at 12:44
  • Put "metadata= res://*/|res://*/|res://*/;" at the beginning of conn string. Exception: "Schema specified is not valid". – Djole Jun 11 '19 at 13:22
  • have u tried adding `res://*/` only once to the `metadata`. Exactly how I have written it in the earlier comment? – akg179 Jun 11 '19 at 13:24
  • I just tried, unfortunatelly with same results. – Djole Jun 11 '19 at 13:42
  • what is the exact error message that you are getting? – akg179 Jun 11 '19 at 13:43
  • Without res://*/, original message is: Additional information: Some required information is missing from the connection string. The 'metadata' keyword is always required. With res://*/, many, many lines of errors – Djole Jun 11 '19 at 13:48
  • maybe this SO answer can help u https://stackoverflow.com/a/2294308/10103607 – akg179 Jun 11 '19 at 13:52

0 Answers0