Samstag, 24. April 2010

Foreign keys for RIA Services with Entity Framework 4.0

For Visual Studio 2010

If you want to use the ORM-Mapper Entity Framework 4.0 in an Silverlight Business Application you have to use additional foreign key for 0..1 to many associations in your model.

It should look like this:

image

To get the foreign key automatically in your entity you have to add the association by the context menu in the designer:

image

Another intressting feature in Visual Studio / Entity Framework 4.0 is the existence of a good support for complex types. So you can define often clustered fields as complex type, which make your model more readable.

image

These complex type will be transfered in the corresponding database table by the DB model generator of Visual Studio 2010 in that way:

image

Keine Kommentare:

Kommentar veröffentlichen