EntityFramework: using association or add property manualy

Posted by dritterweg on Stack Overflow See other posts from Stack Overflow or by dritterweg
Published on 2009-10-29T20:44:46Z Indexed on 2010/05/13 18:04 UTC
Read the original article Hit count: 193

Filed under:

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

  • ProfileId
  • FirstName
  • LastName

Hobbies

  • Id
  • HobbyName
  • OwnerId

So one profile can have many hobbies.

My Entity Framework:

ProfileEntity

  • ProfileId
  • FirstName
  • LastName
  • Hobbies (collection of HobbyEntity) note: this created by the Association tool

HobbyEntity

  • Id
  • HobbyName
  • Owner (type of ProfileEntity) note: this created by the Association tool, for me this property is not important

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.

© Stack Overflow or respective owner

Related posts about entity-framework