SQL Server inquiry about DbContext

ebdffaop  于 2023-08-02  发布在  其他
关注(0)|答案(1)|浏览(89)

I am using database first approach ,when i create **Module1 **that have my database structure ,whene I need to create my database againe by using this code

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim createdb As New Model1
        createdb.Database.Create()
    End Sub

its create databse and tables corectly,but Views in my organal database converts th tables. Can anyone help me to avoid that

I want to reflect my database with all its structures "tables,vwies,functions,,, and so on. with using vb.net EF

pn9klfpd

pn9klfpd1#

If you're recreating a DB using code-first to mirror the original DB, then you cannot create views without some effort

What you really want to do is create the code equivalent of your DB using a tool, in this case EF Designer that comes with Visual Studio. You have to create the model (ie the code representing the DB) and then the views as a separate step.

相关问题