This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi guys, I've been given the designer to play with and re-map our domain objects (was using Fluent NHibernate with Automapping). Using version 2.1.505 of the designer. We have an address table that's referenced by a bunch of other tables. A customer will have an address, an Organisation will have one or possibly two addresses (postal + physical) etc. The problem is setting up the relationship - one to many isn't right as while a single address can be used by more than one entity, the address itself doesn't need to know what they are (i.e. the designer is setting up a customers collection on the address object). One to one doesn't work as an organisation may have two separate addresses and the designer wont let me make two 1-1 mappings going from customer to address (its technically its not a strict 1-1 relationship). I tried setting up Address as a value type but that ran into problems as the Address table references a Country table, and value types are not allowed to reference other types/entities. My next thought was to not create a relationship in the designer and just use a partial mapping class to set up a mapping like so:
Which looks like it would work fine*, except that the designer doesn't give me partials for the mapping classes, just the entity class. By the way, I can get the above code generated by the designer if there is only one entity using the address entity and I delete the collection name in the one to many relationship (one to many going from address to customer). i.e. the designer does exactly what I want, until I tell it that there are other entities that want to use an addres. Then I get the error "Entity Address has multiple properties/associations named" There must be something obvious I'm missing here. Cheers, Matt.
|
|
|
Hm, I just tried compiling with the errors and its fine :) So:
So all is well and good, however I am still getting the "Entity Address has multiple properties/associations named ''" errors, so I'd still like to know if this is a bug or if I'm doing it wrong. Cheers, Matt. |
|
|
You will get that error because we are validating that there is uniqueness on the collection names, which in your case there is not (you have more than one collection with a blank name). So you can safely ignore these since it is actually fine. Ill have a look at adding in a check for an empty name so we dont generate errors in this case though since that seems a bit redundant :)
|
|
|
[edit] I'll start another question for this. [/edit] Cheers. Matt. |
|