You can take a look to NHibernateIntegration facility from Castle. Talking
to different databases is solved by having a SessionFactory per database.
Then you can work with entities from different databases.
As of relations between entities from different databases one of the
solutions will be to create a User Type that will go to other database to
store and read the value.Your model will change slightly:
class Article { IPublication p; }
class Publication : IPublication {}
PublicationUserType : IUserType { // storing IPublication to proper
database. }
In table Article you'll store only ID (preferably a guid) of the
publication. Using this ID you'll load/store Publication to other database.
This is one of the solutions. May be it isn't optimal, but worked for us.
On Thu, Mar 5, 2009 at 6:48 PM, graphicsxp <[email protected]>wrote:
>
> Hi,
>
> I've got two business entities which are linked with a one to many
> association :
>
> class Article
> {
> Publication p;
> }
>
> class Publication
> {
> }
>
> An article belongs to one publication only and a publication can
> contais 0 to n articles.
>
> Now in my relational model this translates as :
>
> [Article] {articleId, PublicationId}
>
> [Publication {PublicationId}
>
> This is pretty classic (I guess...), and it should be easy for
> nHibernate to persist the entities to my database. However, here is
> the catch : The two tables. [Article] and [Publication] are NOT in the
> same database, hence a different connection string, hence a diffrent
> NH mapping file....
>
> How can I workaround this ? Is there something that can be done ?
>
> Thanks
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---