maxtoroq / DbExtensions

Data-access framework with a strong focus on query composition, granularity and code aesthetics.
https://maxtoroq.github.io/DbExtensions/
Apache License 2.0
227 stars 41 forks source link

Setting container object when loading 1:n sometimes fails #25

Closed maxtoroq closed 8 years ago

maxtoroq commented 10 years ago

SqlTable.cs#L1852

Here's the source of the problem: AttributedMetaModel.cs#L995

maxtoroq commented 8 years ago

The algorithm to determine the other member of an association is very simplistic. The names, as specified in [Association(Name)], must match. If you don't use names, and the other type has more than one association, and the other member is not the first in declaration order, then it picks the wrong member.

maxtoroq commented 8 years ago

The fix was to only match names when they are not null (only needed for corner cases). If names are null, match types.