Just create the intermediate entity and use a LINQ projection over it.
Example:
class Book
{ ...
public virtual IEnumerable<Author> Authors
{
get { from bookAuthor in BookAuthors where !bookAuthor.IsDeleted select
bookAuthor.Author }
}
}
Diego
On Mon, Jul 26, 2010 at 22:30, Jim Geurts <[email protected]> wrote:
> Guys,
>
> First off, thanks for helping with the situation I brought up. Frans,
> I appreciate you taking the time to better explain my issue using more
> descriptive words & examples than I could have :) I thought my
> description, map file and classes were sufficient to show what I was
> attempting to accomplish, but it appears not and that seems to be the
> reason for the inactivity in the past. Had I known that, I would've
> tried to rephrase my question rather than just repeat it, thinking
> people were just ignoring it.
>
> As you mentioned, I am trying to map a many to many relationship
> without wanting to specifically have a map & class for the
> intermediary table. All three tables (primary, intermediary, and
> associate) have a logical delete column that I want to respect. The
> problem arises when the associate record is logically deleted. The
> intermediary record is still present and is not logically deleted, so
> the collection returns a null object. As a user, I expected that it
> wouldn't return an object in that case. It feels weird to me to have
> to check for null objects in a .net collection. I would think they
> should be filtered out before returning the collection to the user.
>
> I would be happy if I could just get read-only access working, but if
> this type of use case isn't supported by NH, then I will go a
> different route.
>
> Thanks again, and let me know if I can further explain what I'm trying
> to accomplish
>
> Jim
>
>
> On Jul 25, 2:23 pm, Sergej Koščejev <[email protected]> wrote:
> > On 24.7.2010 23:08, Jim Geurts wrote:
> >
> > > I don't mean to be rude, but you closed the bug. You asked me to post
> > > the issue to the list, which I did previously, multiple times...
> > > without reply. I created unit tests that reproduce this issue, yet
> > > still no reply from anyone. It seems like a common issue that people
> > > are going to run across. I'm just looking for either a description of
> > > how I'm mapping things wrong, or how to properly accomplish this type
> > > of situation...
> >
> > In your test case, author_book_map contains an entry with IsDeleted=0,
> > this is the reason why the Books collection contains one (null) element
> > when you load the author, even though the book itself is deleted.
> >
> > I'm not totally sure what the correct behavior here should be, whether
> > to return an empty collection as you want it, or not.
> >
> > Sergej
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.