예제 #1
0
        /// <summary>
        /// Sets the database factory using the database instance <see cref="IMongoDatabase"/>
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="database"></param>
        public static void Database(this IMongoDbSagaRepositoryConfigurator configurator, IMongoDatabase database)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (database == null)
            {
                throw new ArgumentNullException(nameof(database));
            }

            configurator.DatabaseFactory(_ => database);
        }
예제 #2
0
        /// <summary>
        /// Sets the collection name formatter instance <see cref="ICollectionNameFormatter"/>
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="collectionNameFormatter"></param>
        public static void CollectionNameFormatter(this IMongoDbSagaRepositoryConfigurator configurator, ICollectionNameFormatter collectionNameFormatter)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (collectionNameFormatter == null)
            {
                throw new ArgumentNullException(nameof(collectionNameFormatter));
            }

            configurator.CollectionNameFormatter(_ => collectionNameFormatter);
        }
예제 #3
0
        /// <summary>
        /// Configure saga class mapping using <see cref="BsonClassMap{TClass}"/>
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="classMap"></param>
        /// <typeparam name="TSaga"></typeparam>
        public static void ClassMap <TSaga>(this IMongoDbSagaRepositoryConfigurator <TSaga> configurator, BsonClassMap <TSaga> classMap)
            where TSaga : class, IVersionedSaga
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (classMap == null)
            {
                throw new ArgumentNullException(nameof(classMap));
            }

            configurator.ClassMap(_ => classMap);
        }
예제 #4
0
        /// <summary>
        /// Configure saga class mapping using <see cref="BsonClassMap{TClass}"/>
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="classMapConfigurator"></param>
        /// <typeparam name="TSaga"></typeparam>
        public static void ClassMap <TSaga>(this IMongoDbSagaRepositoryConfigurator <TSaga> configurator,
                                            Func <IConfigurationServiceProvider, Action <BsonClassMap <TSaga> > > classMapConfigurator)
            where TSaga : class, IVersionedSaga
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (classMapConfigurator == null)
            {
                throw new ArgumentNullException(nameof(classMapConfigurator));
            }

            configurator.ClassMap(provider => new BsonClassMap <TSaga>(classMapConfigurator(provider)));
        }
예제 #5
0
 /// <summary>
 /// Sets the database factory using the database instance <see cref="IMongoDatabase"/>
 /// </summary>
 /// <param name="configurator"></param>
 /// <param name="database"></param>
 public static void Database(this IMongoDbSagaRepositoryConfigurator configurator, IMongoDatabase database)
 {
     configurator.DatabaseFactory(_ => database);
 }
예제 #6
0
 /// <summary>
 /// Sets the collection name formatter instance <see cref="ICollectionNameFormatter"/>
 /// </summary>
 /// <param name="configurator"></param>
 /// <param name="collectionNameFormatter"></param>
 public static void CollectionNameFormatter(this IMongoDbSagaRepositoryConfigurator configurator, ICollectionNameFormatter collectionNameFormatter)
 {
     configurator.CollectionNameFormatter(_ => collectionNameFormatter);
 }