I think that an interceptor or event on the side of the writer would be the right solution for this. In our current project, we did something similar, and it works great.
Using this approach, you retained the ability to switch the database below or-match and could develop your update event from a simple TableUpdate trigger, which, it seems to me, should be done within a few hours for a specific update event containing all the changed data.
EDIT:
First of all, I would not only track OnSave, but also AfterTransactionCompleted to ensure the transaction. It also allows you to collect all tx objects. The easiest way to do this is to override the EmptyInterceptor object as follows:
public class EntityInterceptor : EmptyInterceptor { private IList<object> entities = new List<object>(); public override bool OnSave(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types) { entities.Add(entity); return base.OnSave(entity, id, state, propertyNames, types); } public override void AfterTransactionCompletion(ITransaction tx) { if (tx.WasCommitted) { Console.WriteLine("Data has been inserted. Notify the reader here."); } entities = new List<object>(); } }
The most complex approach for exchanging information between IMO processes would be .Net-remote. There are several examples of how to do this. Here can be found here . Or, if you want to try WCF, see here . Or look for SO, there are many good examples here.
zoidbeck
source share