SqlHiLoDao CreateSqlDao(IDictionary <string, string> options)
        {
            var factory = new SqlConnectionProviderFactory();
            var sql_connection_provider = factory
                                          .CreateProvider(options) as SqlConnectionProvider;

            return(new SqlHiLoDao(sql_connection_provider));
        }
        /// <summary>
        /// Create a object of type <typeparamref name="T"/> using the given
        /// collection of options and factory.
        /// </summary>
        /// <param name="options">
        /// A collection of key/value pairs containing the keys that is required to
        /// create an instance of the <see cref="SqlConnectionProvider"/> class.
        /// </param>
        /// <param name="factory">
        /// The method taht receives a <see cref="SqlConnectionProvider"/> and
        /// returns an instance of the tyep <typeparamref name="T"/>.
        /// </param>
        /// <returns>
        /// The newly created object.
        /// </returns>
        protected T CreateProvider(IDictionary <string, string> options,
                                   SqlDaoFactoryDelegate factory)
        {
            var sql_connection_provider =
                new SqlConnectionProviderFactory()
                .CreateProvider(options) as SqlConnectionProvider;

            return(factory(sql_connection_provider));
        }
Пример #3
0
        /// <summary>
        /// Creates an instance of the <see cref="IAppState"/> that uses the
        /// SQL Server engine as the state storage.
        /// </summary>
        /// <param name="options">
        /// A collection of key/value pairs containing the options used to create
        /// the app state and its associated connection string.
        /// </param>
        /// <returns>
        /// A <see cref="IAppState"/> object that uses the SQL Server engine to
        /// store the states.
        /// </returns>
        /// <see cref="kSupressTransactions"/>
        /// <see cref="SqlConnectionProvider"/>
        /// <see cref="SqlConnectionProviderFactory"/>
        /// <see cref="SqlConnectionProviderFactory.kConnectionStringOption"/>
        /// <see cref="SqlConnectionProviderFactory.kInitialCatalogOption"/>
        /// <see cref="SqlConnectionProviderFactory.kLoginOption"/>
        /// <see cref="SqlConnectionProviderFactory.kPasswordOption"/>
        /// <see cref="SqlConnectionProviderFactory.kServerOption"/>
        public IAppState CreateAppState(IDictionary <string, string> options)
        {
            var factory = new SqlConnectionProviderFactory();
            var sql_connection_provider = factory
                                          .CreateProvider(options) as SqlConnectionProvider;
            bool supress_dtc =
                bool.Parse(options.GetString(kSupressTransactions, "false"));

            return(new SqlAppState(sql_connection_provider, supress_dtc));
        }