jeudi 28 avril 2016

Create ConnectionString on fly for SQLite and Entity Framework

I am owndering about a way to create a ConnectionString on fly for SQLite and Entity Framework (MS VS2015, MS .NET Framework 4.5.6).

Basically I would like to do here

MyAppEntities context = new MyAppEntities();

The class itself looks like

public partial class MyAppEntities : DbContext
    {
        public MyAppEntities ()
            : base("name=MyAppEntities")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }

        public virtual DbSet<Commands> Commands { get; set; }
        public virtual DbSet<Errors> Errors { get; set; }

    }

Any clue how it can be done?

Aucun commentaire:

Enregistrer un commentaire