/// <summary> /// Initializes a new instance of the <see cref="Table{TEntity, TPrimaryKey}"/> /// class. /// </summary> /// <param name="database"> The database. </param> /// <param name="primaryKey"> The primary key. </param> /// <param name="identitySpecification"> The identity specification. </param> public Table( IDatabase database, IKeyInfo <TEntity, TPrimaryKey> primaryKey, IdentitySpecification <TEntity> identitySpecification) : base(database, false) { this.VerifyType(); this.id = Interlocked.Increment(ref counter); this.indexes = new List <IIndex <TEntity> >(); this.constraints = new ConstraintCollection <TEntity>(); this.entityService = database .DatabaseEngine .ServiceProvider .GetService <IEntityService>(); this.primaryKeyIndex = this.CreateUniqueIndex(new DictionaryIndexFactory(), primaryKey); this.RegisterTimestampConstraints(); if (identitySpecification != null) { this.identityField = new IdentityField <TEntity>(identitySpecification); } }
public void RestoreIdentityField() { if (originalIdentitySpecification != null) { identityField = new IdentityField <TEntity>(originalIdentitySpecification); } }