Is there an NHibernate <component> equivalent in the Entity Framework?

We are studying which ORM technology we could use in our project, more specifically NHibernate vs. Entity Framework 4.

NHibernate has one good opportunity to map multiple columns to a custom type, thanks to the component mapping option. That is, I can map a group of columns as a property of a given type, for example:

Component<MyCustomType>(e => e.CreatedBy, p => { p.Map(customTypeItem => customTypeItem .prop1, "column1"); p.Map(customTypeItem => customTypeItem .prop2, "column2"); }); 

I did not find a similar function in Entity Framework 4. Does it exist? or is there similar functionality?

+7
source share
1 answer

I don’t know much about NHibernate, but you can try EF4 Complex type objects .

You define them on the actual objects of your EDMX (Add β†’ Complex Type), as opposed to scalar properties.

I have not tried it before - but maybe this is suitable for your scenario.

+12
source

All Articles