How do I override the automapping for a composite Id, one to many relationship with fluent nhibernate?

You may want to use a composite key class. Here's an example of using a key class: stackoverflow.com/questions/1329068/nhib... You may have to drop down and use an HBM file instead of using Fluent N.

You may want to use a composite key class. Here's an example of using a key class: stackoverflow.com/questions/1329068/nhib.... You may have to drop down and use an HBM file instead of using Fluent N.

I did endup hand editing the hbm files. It looks like the most recent build on fluent Nhibernate addresses this issue. Here is what my hbm file look like.... properties hidden for breviety here is the file for roles.... properties hidden for breviety.

HasMany relationship in the AutoMapper override. You'll notice that I don't have domainUser. DomainUserId and role.

RoleId which make this much more simple (no compositeIds.) I've avoided those fields because I've already got a natural composite key and it will be populate when I pull this data from the downstream domain. If I add those artificial keys, I'll have to pre-fetch their values before I call session. I'm trying to avoid doing that.

The entity objects are obvious (I hope) but here is what I've got. My db schema is pretty simple. I've got the IAutoMappingOverride classes started like this.

But, I'm at a loss of how to setup the hasMany for roles. How do I setup that foreign key to use both those fields?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions