views:

128

answers:

1

Hi, can I force the DBML designer to use my custom types instead of the Auto-generated Types? I can edit the database.designer.cs, but these changes will be lost when I modify the tables.

If not, how can I easily "convert" from the auto-generated type to my custom type in Linq?

A: 

The DBML designer is code-gen, plain and simple - although the dml may help as the mapping file

There are various options here:

  • use SqlMetal to generate the mapping file
  • decorate your existing objects with the standard attributes
  • use an external xml file to describe the relationships

Resources:

Note also that EF in 4.0 also supports POCO.


If you just want to manually project from the LINQ type to your type; if they have similar properties, something like PropertyCopy in MiscUtil may help - see this answer.

Marc Gravell