How to create a dbml file?

How to create a dbml file?

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

I want this for another project for documentation purposes. The database already exists. So, how can I get all the key relationships and the notorious nine yards from the sql server database into a cool graphical representation of a DBML file, as seen in visual studio.

I have done several searches on the Internet with several search engines, and so far everything that I see is working in a different direction, for example, "create a database from a DBML file?"

Something seems to be related to LINQ, but I have not yet found an explanation about this.

+4
source share
1 answer

In Visual Studio, right-click your project in Solution Explorer in the folder where you want to add DBML. Select "Add New Item", then "Data" select Linq-To-SQL Classes. This will create an empty DBML file. Then you need to create a connection to the server and drag the tables you need into the DBML constructor. After saving, Visual Studio will regenerate DBML with entities for your selected tables.

There are also various tools, such as Plinqo, that generate DBML files and offer robust templatimg solutions for more advanced code generation.

+9
source

Source: https://habr.com/ru/post/1525737/


All Articles