How to specify database name in Code First?

后端 未结 7 1330
广开言路
广开言路 2020-12-13 06:00

How do I tell EF what to name the database and where to put it?

If there is no connection string in the Web.Config, it tries to put it in the local SQLEXPRESS Server

相关标签:
7条回答
  • 2020-12-13 06:31

    For reference, here is how to do it in code using VB.NET:

    Public Class DatabaseContext : Inherits DbContext
    
    Public Property Users As DbSet(Of User)
    
    Public Sub New()
        MyBase.New("NewFileName.sdf")
    End Sub
    

    End Class

    0 讨论(0)
提交回复
热议问题