Cannot find my Entity Framework database

后端 未结 3 653
梦毁少年i
梦毁少年i 2021-01-14 21:27

I am a little confused on the code first entity framework database.

I created a new DbContext and class that I will be storing in that context, like this:

         


        
3条回答
  •  伪装坚强ぢ
    2021-01-14 22:19

    using (var db = new BloggingContext()) 
    { 
      var connectionString = db.Database.Connection.ConnectionString;
      Console.WriteLine(connectionString); 
    }
    

    The above code uses the Microsoft example; for BloggingContext substitute your DbContext class. It will give you the connection string that the entity framework is using, which includes the instance name.

提交回复
热议问题