tags:

views:

77

answers:

3

Hi All,

How do we mention the Table information in the command when we want to generate the external mapping file directly from the database. We have the /Database option but how do we mention the table information

+1  A: 

You can't use SqlMetal to specify which tables in a database to generate mapping for - it's all or nothing, unfortunately.

You could use SqlMetal to generate a DBML file for the database first, then filter out <Table> elements in the DBML file as needed, using a custom process you write yourself. A DBML file is just an XML file that matches the DBML schema, so it's easy to manipulate using LINQ to XML, for example.

Once the DBML file is ready, you can pass it to SqlMetal again to generate code and an external mapping file.

Sam
A: 

Hey, having a similiar question, wondering if you found any easy way to script this ?

Using a macros in Visual studio for example ?

Exception Duck
A: 

Try using SqlMetal Include.

RedFilter

related questions