Пример #1
0
        /// <summary>
        /// Creates a new <see cref="SatelliteValueHashedRepository{TEntity, THubReference, TValueHash,TReference}"/>
        /// </summary>
        /// <param name="context"><see cref="DwhDbContext"/> apply performance improvements per default</param>
        /// <param name="hashFunction">any hash function reducing the business-key to it's primary key</param>
        /// <param name="logger"></param>
        public SatelliteValueHashedRepository(DwhDbContext context
                                              , DataVaultHashFunction <THubReference> hashFunction
                                              , DataVaultHashFunction <TValueHash> valueHashFunction
                                              , IValueHashCache valueHashCache
                                              , ILogger <SatelliteValueHashedRepository <TEntity, THubReference, TValueHash, TReference> > logger = null)
            : base(context, hashFunction, logger)
        {
            if (valueHashFunction == null)
            {
                throw new ArgumentNullException(nameof(valueHashFunction), $"Instance of {nameof(DataVaultHashFunction<TValueHash>)} must be provided.");
            }
            ValueHashFunction = valueHashFunction;
            if (valueHashCache == null)
            {
                throw new ArgumentNullException(nameof(valueHashCache), $"Instance of {nameof(IValueHashCache)} must be provided.");
            }
            ValueHashCache = valueHashCache;

            if (!ValueHashCache.ValueHashCacheInitialized(typeof(TEntity)))
            {
                InitializeReferenceKeyValueHashCache();
            }
            else
            {
                Logger?.LogTrace($"'{nameof(IValueHashCache)}' for type '{typeof(TEntity)}' already initialized.");
            }
        }
Пример #2
0
 public ValueHashedSatelliteRepository(DwhDbContext context
                                       , DataVaultHashFunction <string> hashFunction
                                       , DataVaultHashFunction <string> valueHashFunction
                                       , IValueHashCache valueHashCache
                                       , ILogger <SatelliteValueHashedRepository <TEntity, string, string, long> > logger = null)
     : base(context, hashFunction, valueHashFunction, valueHashCache, logger)
 {
 }