Hello,

If memory serves I seem to recall something like this might be doable,
if a bit clumsily, via (Fluent) NHibernate.

I've got a somewhat peculiar use case in which I need to inject some
"settings" into two completely separate aspects of the domain model,
and the best possible way for me to do that is to setup a many-to-many
relationship among the moving parts. I will explain briefly.

This is maybe not the best illustration, but here goes. Suppose I have:

class Library
{
    public virtual Settings Settings { get; set; }
}

class Book
{
    public virtual Settings Settings { get; set; }
}

class Settings
{
    public virtual IList<Library> Libraries { get; set; }
    public virtual IList<Book> Books { get; set; }
}

Does not make much sense to establish a base class, even between them
and something like "DomainModel", per se.

However, I want to minimize the duplicate Settings as much as possible:

class AppliedSettings // Representing the joining table, with
impedance mismatch opportunities
{
    public Library Library { get; set; }
    public Book Book { get; set; }
    public Settings Settings { get; set; }
}

Which changes the domain model to:

class Library
{
    public virtual IList<AppliedSettings> AppliedSettings { get; set; }
}

class Book
{
    public virtual IList<AppliedSettings> AppliedSettings { get; set; }
}

class Settings
{
    public virtual IList<AppliedSettings> AppliedSettings { get; set; }
}

I'm not sure if this makes sense to anyone. Perhaps there is a way to
discriminate an Id based on Type, something like a "C/C++" union might
do?

Best regards,

Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to