Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I generate a dbml file?

How do I generate a dbml file?

In a Visual Studio file, A project contains a DBML file that, when opened, shows a very cool representation graphical of a database and all the interconnections between the tables.

I want that for another project for documentation purposes. The database already exists. So how do I get from the sql server database with all the key relationships and the proverbial whole nine yards to the cool graphic representation of ta DBML file as seen in visual studio.

I did some searching on the internet with several search engines and so far everything I see is working in the other direction such as "create database from DBML file? "

It seems to have something to do with LINQ but I have yet to find an explanation about this.

like image 881
xarzu Avatar asked Feb 07 '14 05:02

xarzu


1 Answers

In Visual Studio, right click on your project in the Solution Explorer, on the folder where you want to add the DBML. Choose Add New Item, then under Data, choose Linq-To-SQL Classes. This will create an empty DBML file. You'll then need to create a server connection to a database and drag the tables you want into the DBML designer. Once you save, Visual Studio will regenerate the DBML with entities for your chosen tables.

Also there are various tools, such as Plinqo, which generate DBML files and offer robust templatimg solutions for more advanced code generation.

like image 126
Dmitriy Khaykin Avatar answered Nov 12 '22 03:11

Dmitriy Khaykin