Esempio n. 1
0
        public DataManager(ITableCache cache, string connectionStrings, string commandString)
        {
            _cache = cache;
            _type  = 1;

            _connectionStrings = connectionStrings;
            _commandString     = commandString;
        }
        internal TableDefinitionWrapperBase(Table tableDefinition, Type tableEntityType, object hashKeyValue, ITableCache cacheImplementation, bool consistentRead)
        {
            this.TableDefinition = tableDefinition;
            this.TableEntityType = tableEntityType;
            this._consistentRead = consistentRead;

            // if a predefined HashKey value was specified
            if (hashKeyValue != null)
            {
                this._hashKeyType = hashKeyValue.GetType();
                this.HashKeyValue = hashKeyValue.ToPrimitive(this._hashKeyType);
            }

            this.Cache = cacheImplementation;
            this.Cache.Initialize(tableDefinition.TableName, this.TableEntityType, this.HashKeyValue);
        }
 internal TableDefinitionWrapper(Table tableDefinition, Type tableEntityType, object hashKeyValue, ITableCache cacheImplementation, bool consistentRead)
     : base(tableDefinition, tableEntityType, hashKeyValue, cacheImplementation, consistentRead)
 {
     if (this.HashKeyValue == null)
     {
         this.ToDocumentConversionFunctor = DynamoDbConversionUtils.ToDocumentConverter(this.TableEntityType);
     }
     else
     {
         var converter = DynamoDbConversionUtils.ToDocumentConverter(this.TableEntityType);
         // adding a step for filling in the predefined HashKey value
         this.ToDocumentConversionFunctor = entity =>
             {
                 var doc = converter(entity);
                 doc[this.TableDefinition.HashKeys[0]] = this.HashKeyValue;
                 return doc;
             };
     }
 }
 internal TableDefinitionWrapper(Table tableDefinition, Type tableEntityType, object hashKeyValue, ITableCache cacheImplementation, bool consistentRead)
     :
     base(tableDefinition, tableEntityType, hashKeyValue, cacheImplementation, consistentRead)
 {
     if (this.HashKeyValue == null)
     {
         this.ToDocumentConversionFunctor = DynamoDbConversionUtils.ToDocumentConverter(this.TableEntityType);
     }
     else
     {
         var converter = DynamoDbConversionUtils.ToDocumentConverter(this.TableEntityType);
         // adding a step for filling in the predefined HashKey value
         this.ToDocumentConversionFunctor = entity =>
         {
             var doc = converter(entity);
             doc[this.TableDefinition.HashKeys[0]] = this.HashKeyValue;
             return(doc);
         };
     }
 }
 public bool TryGetValue(ITableIdentifier key, out ITableCache value)
 {
     return(_dic.TryGetValue(key, out value));
 }
 public void Add(ITableIdentifier key, ITableCache value)
 {
     _dic.Add(key, value);
 }
Esempio n. 7
0
 public DataManager(ITableCache cache)
 {
     _cache = cache;
     _type  = 0;
 }
        internal TableDefinitionWrapperBase(Table tableDefinition, Type tableEntityType, object hashKeyValue, ITableCache cacheImplementation, bool consistentRead)
        {
            this.TableDefinition = tableDefinition;
            this.TableEntityType = tableEntityType;
            this._consistentRead = consistentRead;

            // if a predefined HashKey value was specified
            if (hashKeyValue != null)
            {
                this._hashKeyType = hashKeyValue.GetType();
                this.HashKeyValue = hashKeyValue.ToPrimitive(this._hashKeyType);
            }

            this.Cache = cacheImplementation;
            this.Cache.Initialize(tableDefinition.TableName, this.TableEntityType, this.HashKeyValue);
        }