We can generate sql metal file or Linq to sql clasess(.dbml) to our project by going into add new items. It will just add file, we have to drag drop the tables from server explorer and we have to configure our sql table clasess design. If any changes in database are made we have to change the entire structure of the .dbml file.
To avoid this problem we can generate our own SQL Metal file......
The sql metal tool is located under the following directory
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SqlMetal.exe
Fallow this steps to generate sql metal file
1.Open the command prompt
2.Go into the C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SqlMetal.exe by typing cd program files....
3. it will Execute the SqlMetal.exe file and generate some lines gow to create sql metal file.
.................
Now we will create our own sql Metal file where ever we want..
1. Create an empty folder for SQLMetal output file E.g : D:\MyProject
2. Then open a Command Window and navigate to the directory (see location) where SqlMetal is located.
3. Then use the following command for generating a single file called NorthWind.dbml.
SqlMetal.exe /server:localhost /database:NorthWind /dbml:C:\MyProject\NorthWind.dbml /namespace:NorthWind.DAL/Context:NorthWindDataContext /provider:SQL2005 /pluralize
Tuesday, May 25, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment