简体   繁体   中英

Generate model classes from Database for Linq to SQL

I have VS Database project with schema and existing published Database. Now i have internal routines to arrange some data in this database and i'm going to use Linq to SQL for this. Is it possible to auto-generate model classes from Database project or existing database? I've created mapping XML, but to use it i need to generate classes. Is there any automation?

Yes. This is indeed possible. It is called database first. try this link for more info: http://msdn.microsoft.com/en-us/data/jj206878.aspx

This tutorial should help you: http://www.asp.net/mvc/tutorials/older-versions/models-(data)/creating-model-classes-with-linq-to-sql-cs

You have to add add "linq to sql classes" which will generate you models.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM