ComponentCompositeIdentifier example

Showing 1-2 of 2 messages
ComponentCompositeIdentifier example Trygve Lorentzen 4/5/11 4:45 AM
Hello, is there any examples of using the ComponentCompositeIdentifier
mapping for a composite Id? I can't find any when searching this group
or google. I found this post with something similar although I don't
use interfaces for the key components.

Entity: Company
int Id
string Name
PostalPlace postalPlace

Entity: PostalPlace
PostalPlaceKey Key
string Name
bool IsMailBox

ValueObject: PostalPlaceKey
string CountryCode
string PostalCode
Re: ComponentCompositeIdentifier example Trygve Lorentzen 4/7/11 9:43 AM
                        Id(x => x.Id, "companyid").GeneratedBy.Native();
                        Map(x => x.Name, "name");
                        References(x => x.PostalPlace)
                                .Columns("countrycode", "postalcode")

                        CompositeId().ComponentCompositeIdentifier<PostalPlaceKey>(pkk =>
                                .KeyProperty(x => x.Key.PostalCode, "postalcode")
                                .KeyProperty(x => x.Key.CountryCode, "countrycode");
                        Map(x => x.IsMailBox, "postbox");
                        Map(x => x.Name, "postalplacename");
                        HasMany(x => x.Companies)
                                .KeyColumns.Add("postalcode", "countrycode")
                        Version(x => x.Ts);