Language: C#
SagaPersister
public class FluentSagaPersister : ISagaPersister { /// <summary> /// Injected session factory. /// </summary> public ISessionFactory SessionFactory { get; set; } #region ISagaPersister Members public void Save(ISagaEntity saga) { SessionFactory.GetCurrentSession().Save(saga); } public void Update(ISagaEntity saga) { SessionFactory.GetCurrentSession().Update(saga); } public T Get<T>(Guid sagaId) where T : ISagaEntity { return SessionFactory.GetCurrentSession().Get<T>(sagaId); } public T Get<T>(string property, object value) where T : ISagaEntity { return SessionFactory.GetCurrentSession().CreateCriteria(typeof (T)) .Add(Restrictions.Eq(property, value)) .UniqueResult<T>(); } public void Complete(ISagaEntity saga) { SessionFactory.GetCurrentSession().Delete(saga); } #endregion }
Tags:
Description:
My custom saga persister for nservicebus using fluent nhibernate.
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

