DynamicData: use custom type as return type


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?

Best Solution

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


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.