コード例 #1
0
ファイル: Table`2.cs プロジェクト: waqashaneef/nmemory
        /// <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);
            }
        }
コード例 #2
0
ファイル: Table`2.cs プロジェクト: waqasm78/nmemory
 public void RestoreIdentityField()
 {
     if (originalIdentitySpecification != null)
     {
         identityField = new IdentityField <TEntity>(originalIdentitySpecification);
     }
 }