Hi, I've this code. when run, throws next error.

  NHibernate.HibernateException: identifier of an instance of
Test.MockEntity was altered from 47 to 9.

Well, it is correct! But, is posible configure Nhibernate to persist
same object (entity) in memory to diferent databases without
instantiate new entity?

sorry, for my english!!!

Thanks in advance!

ICrudDAO<MockEntity> crudDao =
Framework.Locator.Resolve<ICrudDAO<MockEntity>>("NHibernateBase");
            ICrudDAO<MockEntity> crudDao2 =
Application.Locator.Resolve<ICrudDAO<MockEntity>>("NHibernateBase2");
            MockEntity mockEntity = new MockEntity();
            mockEntity.EntityId = 1;
            mockEntity.MockValue1 = "value1";
            mockEntity.MockValue2 = 2;

            using (var scope = new
TransactionScope(TransactionScopeOption.RequiresNew))
            {
                crudDao.Save(mockEntity);
                Assert.IsNotNull(mockEntity.EntityId);
                this.entityId = mockEntity.EntityId.Value;

                mockEntity.EntityId = null;
                crudDao2.Save(mockEntity);
                Assert.IsNotNull(mockEntity.EntityId);
                this.entityId2 = mockEntity.EntityId.Value;
                scope.Complete();
            }

-- 
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.

Reply via email to