First of all, we need to add a DBML (Database Markup Language) file. DBML file, .dbml, can de added as follows:
- Right click on Application's Root and select Add New Item. Add New Item option box will be opened.
- Select LINQ to SQL Classes (Visual C#) and provide the relevant name. In
our case, its Technoscatter.dbml
- Click on Add.
Along with Technoscatter.dbml, two other files will be created in the App_Code folder under Technoscatter.dbml file :
- Object Relational Designer will be opened. You can now create Data Classes
and Methods by dragging it from Server Explorer.
In our case, we have added, two tables, namely, Members and Organisations and two Stored Procedures, namely, AddAndUpdateMembershipDetails and CheckIfOrganisationExists
Note: Shortcut for viewing Server Explorer is Ctrl+W, L
- Save and Exit the file.
Created DBML file will look like as shown below:
Concept of *.dbml.layout file
.dbml.layout file is just to show you how your model classes are laid out in the designer. I don't believe it has any information about the actual schema etc.
Concept of *.designer.cs file
.designer.cs file contains DataContext class and the classes for tables, views and Stored Procedures. For example, in our case, Technoscatter.designer.cs contains the following classes: