Join date: May 12, 2022

Swiftec V1 7 7l [March-2022]




 . .Q: Fluent NHibernate: How to map a class with a Composite ID Using the fluent NHibernate mapping approach (lots of configuration classes for mappings) I'm trying to map a class that contains a composite ID (GUID) property. The code below should work but doesn't. If I replace the type for UserObject with a Guid instead of a Guid? I can't get the composite property to save. Thanks for your help! public class UserObjectMap : ClassMap { public UserObjectMap() { Schema("dbo"); Id(x => x.ID).GeneratedBy.GuidComb(); Map(x => x.UserObjectType); HasMany(x => x.UserObjects) .KeyColumn("ID") .ForeignKeyConstraintName("FK_UserObjects_ID"); References(x => x.User).ForeignKeyConstraintName("FK_UserObjects_ID"); //Can't get this to work either - UserObjectType is a Guid? References(x => x.UserObjectType).ForeignKeyConstraintName("FK_UserObjects_ID"); } } A: You are right about composite-primary key, but you must configure references as follows: References(x => x.User).ForeignKeyConstraintName("FK_UserObjects_ID"); References(x => x.UserObjectType).ForeignKeyConstraintName("FK_UserObjects_ID"); And also, you need to generate the composite primary key before persisting the domain entity, so you must configure one-to-one and one-to-many in an one-time-event for the save action. If you configure it in the class-level mapping, NHibernate will not track the entities that reference the domain entity to add the foreign key constraints. FRIDAY, Jan. 11




management a global and entrepreneurial perspective 13th edition pdf free 13

generation kill 1080p download movies

Latest Nod32 Keys 2020 ESET Smart Security Eset Internet Security

Vitafon Uputstvo Na Srpskom Ru

Swiftec V1 7 7l [March-2022]
More actions