示例#1
0
        public DbLogicModule(IHashCalculater hashCalc, bool hashFromValue,
                             IUserCommandCreator <TCommand, TConnection, TKey, TValue, TReader> userCommandCreator,
                             IMetaDataCommandCreator <TCommand, TReader> metaDataCommandCreator,
                             DbImplModule <TCommand, TConnection, TReader> implModule)
        {
            Contract.Requires(hashCalc != null);
            Contract.Requires(userCommandCreator != null);
            Contract.Requires(implModule != null);
            Contract.Requires(metaDataCommandCreator != null);
            _hashCalculater         = hashCalc;
            _userCommandCreator     = userCommandCreator;
            _implModule             = implModule;
            _hashFromValue          = hashFromValue;
            _metaDataCommandCreator = metaDataCommandCreator;

            var idName = _userCommandCreator.GetKeyName();

            _metaDataCommandCreator.SetKeyName(idName);

            var tableName = _userCommandCreator.GetTableNameList();

            _metaDataCommandCreator.SetTableName(tableName);

            _tableName = tableName.Aggregate("", (current, result) => current + result + "_");
            _tableName = _tableName.Remove(_tableName.Length - 1);
        }
示例#2
0
 public TestDbInMemory(string tableName, IHashCalculater hashCalculater)
     : base(
         hashCalculater, true,
         new TestUserCommandCreator(tableName),
         new TestMetaDataCommandCreator(), TestDbHelper.NewInstance
         )
 {
     _impl = TestDbHelper.Instance;
 }
示例#3
0
        public static InnerData CreateEvent(IHashCalculater calc, int id)
        {
            string hash = calc.CalculateHashFromKey(id);

            var ev = new InnerData(new Transaction(hash, "")
            {
                OperationName = OperationName.Read
            })
            {
                Data = calc.SerializeValue(CreateStoredData(id))
            };

            return(ev);
        }
示例#4
0
        public IStorageInner CreateApi(string tableName, bool hashFromValue, IHashCalculater hashCalculater)
        {
            if (_apis.ContainsKey(tableName))
            {
                return(null);
            }

            var api = new ProxyInputModule(
                tableName, hashFromValue, _asyncProxyCache, hashCalculater, _distributor, this);

            _apis.Add(tableName, api);

            return(api);
        }
示例#5
0
        public ProxyInputModule(string tableName, bool hashFromValue, AsyncProxyCache asyncProxyCache,
                                IHashCalculater hashCalculater, ProxyDistributorModule distributor, ProxyInputModuleCommon processTransaction)
        {
            Contract.Requires(distributor != null);
            Contract.Requires(hashCalculater != null);
            Contract.Requires(asyncProxyCache != null);
            Contract.Requires(processTransaction != null);

            _tableName          = tableName;
            _distributor        = distributor;
            _processTransaction = processTransaction;
            _hashFromValue      = hashFromValue;
            _hashCalculater     = hashCalculater;
            _asyncProxyCache    = asyncProxyCache;
        }
示例#6
0
 public TestInMemoryDbFactory(string tableName, IHashCalculater hashCalculater)
 {
     _tableName      = tableName;
     _hashCalculater = hashCalculater;
 }