dritterweg
dritterweg

Reputation: 401

EntityFramework: using association or add property manualy

I'm starting to use Entity Framework. Let's say I have to Entity from my tables in DB.

Here is the table schema

Profiles

Hobbies

So one profile can have many hobbies.

My Entity Framework:

ProfileEntity

HobbyEntity

my question: should I use the "Association" tool to make the relationship between the two entities, which in result create a property of each entity (in ProfileEntity will create a HobbyEntity and vica versa) or should I not use the association and only add a scalar property manually such as List<HobbyEntity> in my ProfileEntity and OwnerId in HobbyEntity.

Upvotes: 0

Views: 277

Answers (1)

kubal5003
kubal5003

Reputation: 7254

This depends on which Entity Framework are you using.

If you are using EF 1.0 (the one released with net framework 3.5 sp1) then you should use the designer, because only then the relationship will be managed properly.

However if you are using EF 2 (to be released with net framework 4.0) then the answer is that you can do both, because EF 2 (4.0) supports code-only and code-first strategies.

Upvotes: 0

Related Questions