Пример #1
0
        /// <summary>
        /// Initiates an instance of <see cref="SqlSagaRepository"/> with a connection string name.
        /// Actual connection string is taken from your app.config or web.config
        /// </summary>
        /// <param name="connectionFactory">An insantance implementing <see cref="IConnectionFactory"/></param>
        /// <param name="sagaFactory">An instance implementing <see cref="ISagaFactory"/></param>
        /// <param name="messageSerialiser">An instance implementing <see cref="IMessageSerialiser"/></param>
        public SqlSagaRepository(IConnectionFactory connectionFactory, ISagaFactory sagaFactory, IMessageSerialiser messageSerialiser)
        {
            Guard.ArgumentIsNotNull(connectionFactory, nameof(connectionFactory));
            Guard.ArgumentIsNotNull(sagaFactory, nameof(sagaFactory));
            Guard.ArgumentIsNotNull(messageSerialiser, nameof(messageSerialiser));

            this.messageSerialiser = messageSerialiser;
            this.sagaFactory       = sagaFactory;
            this.connectionFactory = connectionFactory;

            if (connectionFactory.ConnectionIsToMySql())
            {
                this.queryWrapper = new MySqlQueryWrapper();
            }
            else
            {
                this.queryWrapper = new SqlQueryWrapper();
            }
        }