APaglia
APaglia

Reputation: 103

Entity Framework 4.1 complex POCOs

I am trying to make a decision about how to structure my Data Access Layer in a desktop application, using a not yet existing SQL Server Database. I have figured out that Entity Framework 4.1 Code-First could be a good candidate.

From what I see, the database is created mapping all properties in my POCOs to fields in the DB. For me this is not good, since there are objects, composed by other complex objects which I don't want to persist in the DB.

Is it possible to provide EF with indications about which objects to persist/map to the DB and which not.

Thanks to all in advance.

Upvotes: 0

Views: 110

Answers (1)

Wouter de Kort
Wouter de Kort

Reputation: 39898

Code First has a convention based model to map your POCO's to a database.

You can change these default settings by using Data Annotations or by using the Fluent API. If you want to ignore a property (or a whole entity) you can use the NotMapped attribute or use the Fluent API's Ignore method

Upvotes: 1

Related Questions