Esempio n. 1
0
        public AffiliateCategoryMongoDbRepository(IMongoWrapper wrapper)
        {
            Wrapper = wrapper ?? throw new ArgumentNullException(nameof(wrapper));

            Wrapper.CreateCollectionIfNotExistsAsync <AffiliateCategory>(CollectinoName);
            Wrapper.CreateIndexIfNotExistsAsync <AffiliateCategory>(CollectinoName, "categoryId", null, e => e.CategoryId);
        }
 protected Repository(
     IMongoWrapper mongoWrapper,
     ILogger <Repository <T> > logger)
 {
     Logger = logger;
     Db     = mongoWrapper.Database;
     _mongoCollectionInstance = new Lazy <IMongoCollection <T> >(() => Db.GetCollection <T>(CollectionName));
 }
Esempio n. 3
0
        public CouponMongoDbRepository(AdvertiserMongoSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Wrapper = settings.CreateWrapper();
            Wrapper.CreateCollectionIfNotExistsAsync <Coupon>(CollectinoName);
        }
Esempio n. 4
0
        public FailedEventsToSubmitMongoDbRepository(LogMongoSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Wrapper = settings.CreateWrapper();
            Wrapper.CreateCollectionIfNotExistsAsync <FailedEvent>(CollectinoName);
        }
Esempio n. 5
0
        public StoreMongoDbRepository(AdvertiserMongoSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Wrapper = settings.CreateWrapper();
            Wrapper.CreateCollectionIfNotExistsAsync <Store>(CollectinoName);
            SaveAsync(Store.GetDefaultStore()).ConfigureAwait(false).GetAwaiter().GetResult();
        }
Esempio n. 6
0
        public AffiliateStoreMatchesMongoDbRepository(AdvertiserMongoSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Wrapper = settings.CreateWrapper();
            Wrapper.CreateCollectionIfNotExistsAsync <AffiliateStoreMatch>(CollectinoName);
            Wrapper.CreateIndexIfNotExistsAsync <AffiliateStoreMatch>(CollectinoName, "AdvertiseStoreId",
                                                                      null,
                                                                      advertiseStoreId => advertiseStoreId.AdvertiseStoreId,
                                                                      program => program.AffiliateProgram,
                                                                      storeId => storeId.AffiliateStoreId);
        }
Esempio n. 7
0
 public MongoRepository(IMongoWrapper mongo, string collectionName)
 {
     _collectionName = collectionName;
     _database       = mongo.GetDatabase();
 }
Esempio n. 8
0
        private static readonly IEnumerable <BsonElement> ClassMap; // Intentional
// ReSharper restore StaticFieldInGenericType

        /// <summary>
        /// Initializes a new instance of <see cref="MongoDBAdapter{T}" />
        /// </summary>
        /// <param name="wrapper">The wrapper.</param>
        public MongoDBAdapter(IMongoWrapper wrapper)
        {
            collection = wrapper.Database.GetCollection <T>(CollectionName);
        }
Esempio n. 9
0
 public AccessTokenRepository(
     IMongoWrapper mongoWrapper,
     ILogger <AccessTokenRepository> logger) : base(mongoWrapper, logger)
 {
 }
Esempio n. 10
0
 public RefreshTokenRepository(
     IMongoWrapper mongoWrapper,
     ILogger <RefreshTokenRepository> logger) : base(mongoWrapper, logger)
 {
 }
 public ConfigurationRepository(IMongoWrapper mongo) : base(mongo, "configuration")
 {
 }