I have some code that does something like this:
public void DoDatabaseWork()
{
_repositoryIDontControl.SaveSomeStuff(objectThatNeedsStuff.Stuff);
using (var session = ... )
{
session.Save(objectThatNeedsStuff);
}
}
The crux here is that within my NHibernate mapped data model I have an object that references another object from a library that is not mapped using NHibernate. So before I save my object using the session, I need to separately save this non-Nhibernate object (that's implemented in a different dll library) via a repository that's in a separate dll.
Is there anything I can do to make my session see these objects (so the foreign key constaint isn't violated) if I'm doing both of these within one transaction scope? Or should I give up on using NHibernate for my data model if I need to reference an object that's not mapped within my project?