public void TestSetup() { var testSetup = new NhibernateTestSetupHelper(); _nhSessionHelper = new NhSessionHelper(testSetup.SessionForTest, testSetup.FakeFrameworkContext); _rdbmsTypeMapper = new RdbmsModelMapper(_nhSessionHelper, testSetup.FakeFrameworkContext); _rdbmsTypeMapper.ConfigureMappings(); }
public RevisionRepository(ProviderMetadata providerMetadata, IProviderTransaction providerTransaction, ISession nhSession, IFrameworkContext frameworkContext, bool isReadOnly) : base(providerMetadata, providerTransaction, frameworkContext) { IsReadonly = isReadOnly; Transaction = providerTransaction; Helper = new NhSessionHelper(nhSession, frameworkContext); }
public SchemaRepository(ProviderMetadata providerMetadata, AbstractRevisionRepository <EntitySchema> revisions, IProviderTransaction providerTransaction, ISession nhSession, IFrameworkContext frameworkContext, bool isReadOnly) : base(providerMetadata, revisions, providerTransaction, frameworkContext) { IsReadonly = isReadOnly; Transaction = providerTransaction; Helper = new NhSessionHelper(nhSession, frameworkContext); }
public void FixtureSetup() { this.testContainerProvider = new TestContainerProvider(new TestedPeristenceModelsSource()); this.nhSessionHelper = new NhSessionHelper(this.NhConfiguration); this.fixture = FixtureFactory.Build(); this.PrepareFixture(); }
public static void OnDeleteCheckAggregate(object entity, ISession nhSession) { // We only care about NodeVersion as that's the only thing that has an aggregation var casted = entity as NodeVersion; if (casted != null) { // We have to issue deletes to the aggregate now before we hit PostFlush, as obviously PostFlush might issue // statements that refer to items that need to be deleted and could cause an FK constraint error NhSessionHelper.DeleteAggregateForNodeIds(casted.Node.Id.AsEnumerableOfOne(), nhSession); } }
public override void OnDelete(object entity, object id, object[] state, string[] propertyNames, global::NHibernate.Type.IType[] types) { // We only care about NodeVersion as that's the only thing that has an aggregation var casted = entity as NodeVersion; if (casted != null) { // We have to issue deletes to the aggregate now before we hit PostFlush, as obviously PostFlush might issue // statements that refer to items that need to be deleted and could cause an FK constraint error NhSessionHelper.DeleteAggregateForNodeIds(casted.Node.Id.AsEnumerableOfOne(), _nhSession); } base.OnDelete(entity, id, state, propertyNames, types); }
public static void UpdateAggregatesPostFlush(ConcurrentHashedCollection <Guid> modifiedVersionIds, ISession nhSession) { // After a flush, keep the aggregates up to date // We do this after a flush so that if other queries are run in the same // transaction, the aggregate table will have been updated before those // selects get run in the db engine try { var updatedNodeIds = modifiedVersionIds.ToArray(); NhSessionHelper.DeleteAggregateForNodeIds(updatedNodeIds, nhSession); NhSessionHelper.RunAggregateForNodeIds(updatedNodeIds, "AggregateNodeStatus_PerNode", nhSession); } finally { modifiedVersionIds.Clear(); } }
public EntityRepository(ProviderMetadata providerMetadata, AbstractSchemaRepository schemas, AbstractRevisionRepository <TypedEntity> revisions, IProviderTransaction providerTransaction, ISession nhSession, IFrameworkContext frameworkContext, bool isReadOnly) : base(providerMetadata, providerTransaction, revisions, schemas, frameworkContext) { Helper = new NhSessionHelper(nhSession, frameworkContext); IsReadonly = isReadOnly; #if DEBUG if (schemas is SchemaRepository) { var sesh = schemas as SchemaRepository; if (sesh.Helper.NhSession != Helper.NhSession) { throw new InvalidOperationException("NHibernate provider can only be used in conjunction with an NHibernate schema provider when they share the same NHibernate session"); } } #endif }
public NhAggregateCriteriaVisitor(NhSessionHelper activeSession) { _activeSession = activeSession; _typesToQuery = new List <DataSerializationTypes>(); _typesAlreadyEstablished = new List <string>(); }
public NhAggCriteriaVisitor(NhSessionHelper activeSession) { _activeSession = activeSession; }
public RdbmsModelMapper(NhSessionHelper nhSessionHelper, IFrameworkContext frameworkContext) : base(frameworkContext) { _nhSessionHelper = nhSessionHelper; }