0

I'm new to LINQ to SQL. I have tried Object Relational Designer(O/R Designer) Approach to generate classes and worked well. But, I wondering is there any way I can generate the same .dbml file for my database using SQLmetal tool. can anyone please send me the command to fire. I just want to use SQLmetal command against my database and everything should be place to go.

Is it also possible to create separate class file each table and views in database as It will be helpful to handle in Visual Studio.

p.campbell
  • 98,673
  • 67
  • 256
  • 322
TJP
  • 85
  • 1
  • 12

2 Answers2

0

Try:

sqlmetal --server={server} --database={db} --user={user} --password={pass} --namespace={namespace-you-want-may-be-empty} --entitybase={dbobject-if-you-need-a-base-class-may-be-empty} --generate-equals-hash --pluralize --culture=en --dbml=dblinq.dbml

BlackR2D
  • 46
  • 4
  • This should cover just about everything you'll need. I don't believe SQLMetal will translate your db schema into multiple class files. You can either do a dbml file or a .cs file, not both. – Philter Feb 09 '12 at 16:17
0

Simply run these two commands

SqlMetal /server:<server> /database:<db> /dbml:<file>.dbml
SqlMetal /server:<server> /database:<db> /code:<file>.designer.cs
Ahmed
  • 85
  • 3
  • 8