/// <summary> /// Creates a new <see cref="LinkRepository{TEntity, TPrimaryKey}"/> /// </summary> /// <param name="context"><see cref="DwhDbContext"/> apply performance improvements per default</param> /// <param name="hashFunction">any hash function reducing the hubs business-key to it's primary key</param> /// <param name="logger"></param> public LinkRepository(DwhDbContext context , DataVaultHashFunction <TPrimaryKey> hashFunction , IPrimaryKeyCache keyCache = null , DVKeyCaching useKeyCaching = DVKeyCaching.Disabled , ILogger <LinkRepository <TEntity, TPrimaryKey, TReference> > logger = null) : base(context, hashFunction, logger) { UseKeyCaching = useKeyCaching; if (UseKeyCaching == DVKeyCaching.Enabled) { if (keyCache == null) { throw new ArgumentNullException(nameof(keyCache), $"Must provide instance of {nameof(IPrimaryKeyCache)} if parameter '{nameof(useKeyCaching)}' is not {DVKeyCaching.Disabled}"); } KeyCache = keyCache; if (!KeyCache.KeyCacheInitialized(typeof(TEntity))) { InitializePrimaryKeyCache(); } else { Logger?.LogTrace($"'{nameof(IPrimaryKeyCache)}' for type '{typeof(TEntity)}' already initialized."); } } else { Logger?.LogWarning($"Primary key caching was not activated. This can result in Unique-Key Constraint violations on runtime. Consider configuring '{nameof(DVKeyCaching)}{nameof(DVKeyCaching.Enabled)}'."); } }
/// <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."); } }
public LinkTimelineRepository(DwhDbContext context , DataVaultHashFunction <string> hashFunction , IPrimaryKeyCache keyCache = null , DVKeyCaching useKeyCaching = DVKeyCaching.Disabled , ILogger <LinkTimelineRepository <TLink, TSatelliteTimeline> > logger = null) : base(context, hashFunction, keyCache, useKeyCaching, logger) { }
public HubRepository(DwhDbContext context , DataVaultHashFunction <string> hashFunction , IPrimaryKeyCache keyCache = null , DVKeyCaching useKeyCaching = DVKeyCaching.Disabled , ILogger <HubRepository <TEntity, string, long> > logger = null) : base(context, hashFunction, keyCache, useKeyCaching, logger) { }
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) { }
/// <summary> /// Creates a new <see cref="LinkRepository{TEntity, TPrimaryKey, TReference}"/> /// </summary> /// <param name="context"><see cref="DwhDbContext"/> apply performance improvements per default</param> /// <param name="hashFunction">any hash function reducing the hubs business-key to it's primary key</param> /// <param name="logger"></param> public LinkTimelineRepository(DwhDbContext context , DataVaultHashFunction <TPrimaryKey> hashFunction , IPrimaryKeyCache keyCache = null , DVKeyCaching useKeyCaching = DVKeyCaching.Disabled , ILogger <LinkTimelineRepository <TLink, TPrimaryKey, TSatelliteTimeline, TReference> > logger = null) : base(context, hashFunction, keyCache, useKeyCaching, logger) { DbSetTimeline = Context.Set <TSatelliteTimeline>(); }
public BaseRepository(DwhDbContext context, DataVaultHashFunction <THashes> hashFunction, ILogger <BaseRepository <TEntity, TPrimaryKey, THashes, TReference> > logger) { this.Context = context; this.DbSet = context.Set <TEntity>(); if (hashFunction == null) { throw new ArgumentNullException("HashFunction", "'HashFunction' was not supplied. an implementation of DataVaultHashFunction<TPKey> has to be supplied."); } this.HashFunction = hashFunction; this.Logger = logger; }
/// <summary> /// Creates a new <see cref="HubRepository{TEntity, THubReference}"/> /// </summary> /// <param name="context"><see cref="DwhDbContext"/> apply performance improvements per default</param> /// <param name="hashFunction">any hash function reducing the hubs business-key to it's primary key</param> /// <param name="logger"></param> /// <param name="useKeyCaching">Enables or Disables (Default) the caching if primary keys -> entrie does not get added to db set if the key was seen before. Cache is built up on creation of the repo. </param> public SatelliteRepository(DwhDbContext context , DataVaultHashFunction <THubReference> hubKeyHashFunction , ILogger <SatelliteRepository <TEntity, THubReference, TReference> > logger = null) : base(context, hubKeyHashFunction, logger) { }
public SatelliteRepository(DwhDbContext context , DataVaultHashFunction <string> hubKeyHashFunction , ILogger <SatelliteRepository <TEntity, string, long> > logger = null) : base(context, hubKeyHashFunction, logger) { }