예제 #1
0
        public ActionResult <IEnumerable <string> > Event()
        {
            var nhConfig       = new Configuration().Configure();
            var sessionFactory = nhConfig.BuildSessionFactory();

            using (var session = sessionFactory.OpenSession())
                using (var tx = session.BeginTransaction())
                {
                    new SchemaExport(nhConfig).Execute(true, true, false, session.Connection, null);

                    IDomainEvent domainEvent = new CartCreatedDomainEvent()
                    {
                        DomainEventId   = Guid.NewGuid().ToString(),
                        DomainEventType = (int)DomainEventTypeConstants.CartCreatedDomainEvent,
                        DomainEventName = "CartCreated",
                        OccurredOn      = DateTime.Now,
                        CartId          = "test-cart-id"
                    };
                    session.Save(_storedEventTranslator.TranslateToStoredEvent(domainEvent));
                    tx.Commit();
                }
            return(new string[] { "value1", "value2" });
        }
예제 #2
0
 public void Store(IDomainEvent e)
 {
     _session.Save(_domainEventTranslator.TranslateToStoredEvent(e));
 }