Best way to update LINQ to SQL classes after database schema change

前端 未结 7 2043
别那么骄傲
别那么骄傲 2020-11-29 16:08

I\'m using LINQ to SQL classes in a project where the database design is still in a bit of flux.

Is there an easy way of synchronising the classes with the schema, o

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 16:35

    You can use SQLMetal.exe to generate your dbml and or cs/vb file. Use a pre-build script to start it and target the directory where your datacontext project belongs.

    C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sqlmetal.exe 
      /server: 
      /database: 
      /code:"path\Solution\DataContextProject\dbContext.cs" 
      /language:csharp 
      /namespace:
    

提交回复
热议问题