fluent-nhibernate icon indicating copy to clipboard operation
fluent-nhibernate copied to clipboard

Table name of automapped value collection isn't correct

Open jagregory opened this issue 13 years ago • 5 comments

The table name that's generated by the automapper for element collections is the property name of the collection. If different entities use the same collection name then there'll be conflicts. We should prefix the table name with the Entity name or something.

jagregory avatar Jul 21 '11 22:07 jagregory

can you please provide more detail, I'm not sure I understand the issue

chester89 avatar Sep 11 '12 17:09 chester89

oh, I think I understand - you mean, when automapping entities that contains a collection with the same property name and different element type, these collections are being mapped to the same table? like here: https://gist.github.com/3699969 ?

chester89 avatar Sep 11 '12 17:09 chester89

@chester89 this appears to be exactly it - https://groups.google.com/forum/?fromgroups=#!topic/fluent-nhibernate/g4M1l3S3YWI - there's a one-line fix there which you can patch your code with. Presumably this hasn't been applied due to the risk of breaking existing code.

Is there any way I can achieve the same thing with a convention?

davidcornish avatar Sep 25 '12 16:09 davidcornish

implementing ICollectionConvention would be it, but i don't know how to know if the collection is a element collection (maybe instance.Element is null or something)

firo222 avatar Dec 06 '12 05:12 firo222

This is a breaking change, so it'll have to wait until 2.0

chester89 avatar May 14 '14 15:05 chester89