• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IConnectionProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IConnectionProvider的典型用法代码示例。如果您正苦于以下问题:C# IConnectionProvider类的具体用法?C# IConnectionProvider怎么用?C# IConnectionProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IConnectionProvider类属于命名空间,在下文中一共展示了IConnectionProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AccessSchemaProvider

		public AccessSchemaProvider(IConnectionProvider connectionProvider)
		{
			if (connectionProvider == null)
				throw new ArgumentNullException("connectionProvider");

			_connectionProvider = connectionProvider;
		}
开发者ID:nkoterba,项目名称:Simple.Data.Access,代码行数:7,代码来源:AccessSchemaProvider.cs


示例2: GetCitiesNames

 public GetCitiesNames(
     IConnectionProvider connectionProvider, 
     IEventAggregator eventAggregator)
 {
     _connectionProvider = connectionProvider;
     _eventAggregator = eventAggregator;
 }
开发者ID:jsikorski,项目名称:Databases-Project,代码行数:7,代码来源:GetCitiesNames.cs


示例3: Execute

    protected virtual string Execute(IQuery query,
      IDictionary<string, string> parameters, IConnectionProvider provider) {
      using (IDbConnection connection = provider.CreateConnection())
      using (var builder = new CommandBuilder(connection)) {
        builder
          .SetText(query.QueryText)
          .SetType(GetCommandType(query.Options))
          .SetTimeout(query.Options
            .GetInteger(Strings.kCommandTimeoutOption, 30));

        BindParameters(builder, query.Parameters, parameters);

        string preferred_json_collection = query.Options
          .GetString(Strings.kJsonCollectionOption,
            Strings.kDefaultJsonCollection);

        IDbCommand cmd = builder.Build();
        connection.Open();
        string response =
          (query.QueryMethod == QueryMethod.Get)
            ? ExecuteReader(cmd, query, preferred_json_collection)
            : ExecuteNonQuery(cmd, query, preferred_json_collection);
        connection.Close();
        return response;
      }
    }
开发者ID:joethinh,项目名称:nohros-must,代码行数:26,代码来源:AbstractSqlQueryExecutor.cs


示例4: ClusterHeartBeat

 public ClusterHeartBeat(Cluster cluster, IConnectionProvider provider, TimeSpan pollingInterval)
 {
     Cluster = cluster;
     NodeChecks = new Dictionary<INode, IFixedSizeStack<ConnectivityCheck>>();
     ConnectionProvider = provider;
     PollingInterval = pollingInterval;
 }
开发者ID:KeithLee208,项目名称:helios,代码行数:7,代码来源:ClusterHeartBeat.cs


示例5: Execute

 /// <summary>Executes <see cref="UpdateStatement"/>. Bulk updates are executed in multiple round trips - one update at a time.</summary>
 public int Execute(UpdateStatement update, DbmsType dbms, IConnectionProvider conn, out CommandExecutionStatistics lastExecutedCommandInfo, int cmdTimeout = 30)
 {
     if (IsBulkUpdate(update))
         return ExecuteBulkUpdate(update, dbms, conn, out lastExecutedCommandInfo, cmdTimeout);
     else
         return ExecuteSingleTableUpdate(update, dbms, conn, out lastExecutedCommandInfo, cmdTimeout);
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:8,代码来源:GenericUpdater.cs


示例6: GetReservationsForUser

 public GetReservationsForUser(
     IConnectionProvider connectionProvider, 
     IEventAggregator eventAggregator)
 {
     _connectionProvider = connectionProvider;
     _eventAggregator = eventAggregator;
 }
开发者ID:jsikorski,项目名称:Databases-Project,代码行数:7,代码来源:GetReservationsForUser.cs


示例7: GetExpectedSchemaProvider

 private ISchemaProvider GetExpectedSchemaProvider(IConnectionProvider connectionProvider)
 {
     var serverVersion = GetServerVersion(connectionProvider);
     if (!string.IsNullOrEmpty(serverVersion) && serverVersion.StartsWith("5"))
         return new MysqlSchemaProvider(connectionProvider, new MysqlSchemaDataProvider50(connectionProvider));
     return new MysqlSchemaProvider(connectionProvider, new MysqlSchemaDataProvider40(connectionProvider));
 }
开发者ID:hojm,项目名称:Simple.Data.Mysql,代码行数:7,代码来源:SchemaDataProviderSelectionTest.cs


示例8: TryGetProvider

        public override bool TryGetProvider(string connectionString, out IConnectionProvider provider, out Exception exception)
        {
            try
            {
                var _ = new SqlConnectionStringBuilder(connectionString);
            }
            catch (KeyNotFoundException ex)
            {
                exception = ex;
                provider = null;
                return false;
            }
            catch (FormatException ex)
            {
                exception = ex;
                provider = null;
                return false;
            }
            catch (ArgumentException ex)
            {
                exception = ex;
                provider = null;
                return false;
            }

            provider = new SqlConnectionProvider(connectionString);
            exception = null;
            return true;
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:29,代码来源:SqlServerProviderAttribute.cs


示例9: GetDao

 private static IEntityDAO GetDao(IConnectionProvider conn, IEntity entity, IEntityDaoFactory daoFactory)
 {
     if (daoFactory != null)
         return daoFactory.GetEntityDAO(entity, conn);
     else
         return DefaultDaoFactory.GetEntityDAO(entity, conn);
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:7,代码来源:SqlServerBulkSaver.cs


示例10: SetUp

 public void SetUp()
 {
     provider = MockRepository.GenerateMock<IConnectionProvider>();
     connection = MockRepository.GenerateMock<IDbConnection>();
     command = MockRepository.GenerateMock<IDbCommand>();
     reader = MockRepository.GenerateMock<IDataReader>();
 }
开发者ID:octoberclub,项目名称:ProtoDal,代码行数:7,代码来源:SprocExtensionTests.cs


示例11: ESSession

		public ESSession(IConnectionProvider connectionProvider)
		{
			if (Current != null)
				throw new ElasticSearchException("Cannot create a new session while there is one already active.");
			ConnectionProvider = connectionProvider;
			Current = this;
		}
开发者ID:starckgates,项目名称:ElasticSearch.Net,代码行数:7,代码来源:ElasticSession.cs


示例12: EnsureOpenConnection

 private static bool EnsureOpenConnection(IConnectionProvider conn)
 {
     bool connIsOpennedLocally = !conn.IsOpen;
     if (connIsOpennedLocally)
         conn.OpenConnection();
     return connIsOpennedLocally;
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:7,代码来源:DbUtil.cs


示例13: ExecuteQuery

        /// <summary>
        /// Creates and executes query using the given ConnectionProvider.
        /// </summary>
        /// <param name="conn">Connection provider.</param>
        /// <param name="cmdText">Command text.</param>
        /// <param name="parameters">Command parameters.</param>
        /// <param name="cmdType">Command type (stored procedure or text).</param>
        /// <param name="cmdTimeout">Set timeout for specified command.</param>
        /// <param name="dataTableName">Name of the datatable that will be returned. May be null.</param>
        /// <returns>DataTable containing retrieved data.</returns>
        public static DataTable ExecuteQuery(IConnectionProvider conn, string cmdText, DbParameterCollection parameters, CommandType cmdType, string dataTableName, int cmdTimeout)
        {
            IDbCommand cmd = CreateCommand(conn.DBMS, cmdText, parameters, cmdType, cmdTimeout);
            cmd.Connection = conn.Connection;
            IDataAdapterBuilder builder = DbmsComponentFactory.GetComponent<IDataAdapterBuilder>(conn.DBMS);
            IDataAdapter adapter = builder.BuildAdapter(cmd);
            bool connIsOpennedLocally = EnsureOpenConnection(conn);
            try
            {
                AssignExistingPendingTransactionToCommand(conn, cmd);

                // Execute query.
                DataSet data = new DataSet();
                data.Locale = CultureInfo.InvariantCulture;
                adapter.Fill(data);
                PopulateOutputParameterValues(parameters, cmd);

                DataTable table = (data.Tables.Count > 0)
                    ? data.Tables[0]
                    : new DataTable() { Locale = CultureInfo.InvariantCulture };
                if (!string.IsNullOrEmpty(dataTableName))
                    table.TableName = dataTableName;

                return table;
            }
            finally
            {
                CloseConnectionIfLocal(conn, connIsOpennedLocally);
                cmd.Dispose();
                IDisposable disposableAdapter = adapter as IDisposable;
                if (disposableAdapter != null)
                    disposableAdapter.Dispose();
            }
        }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:44,代码来源:DbUtil.cs


示例14: FlumeSession

 public FlumeSession(IConnectionProvider connectionProvider)
 {
     if (Current != null)
         throw new BrokenCollectorException("Cannot create a new session while there is one already active.");
     ConnectionProvider = connectionProvider;
     Current = this;
 }
开发者ID:MingHuaL1,项目名称:Test,代码行数:7,代码来源:FlumeSession.cs


示例15: AttributeTypeRepository

 public AttributeTypeRepository(IConnectionProvider connectionProvider, IDataTypeConverter dataTypeConverter,
                                IEntityAttributeTypeRepository entityAttributeTypeRepository)
 {
     _connectionProvider = connectionProvider;
     _dataTypeConverter = dataTypeConverter;
     _entityAttributeTypeRepository = entityAttributeTypeRepository;
 }
开发者ID:Hoejsgaard,项目名称:Hsc.Core,代码行数:7,代码来源:AttributeTypeRepository.cs


示例16: AgentUpdater

 /// <summary>
 /// Initializes a new instance of the <see cref="AgentUpdater"/> class.
 /// </summary>
 /// <param name="connectionProvider">The connection provider.</param>
 /// <param name="versionProvider">The version provider.</param>
 /// <param name="updateSource">The update source.</param>
 /// <param name="agents">The agents.</param>
 /// <param name="log">The log.</param>
 public AgentUpdater(IConnectionProvider connectionProvider, IVersionProvider versionProvider, IUpdateSource updateSource, AgentsCollection agents, ILog log)
 {
     this.connectionProvider = connectionProvider;
     this.versionProvider = versionProvider;
     this.updateSource = updateSource;
     this.agents = agents;
     this.log = log;
 }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:16,代码来源:AgentUpdater.cs


示例17: MigrationInitializer

 public MigrationInitializer(IConfiguration configuration, IDatabaseProvider databaseProvider, ISchemaProvider schemaProvider, ICommonTransformations commonTransformations, IConnectionProvider connectionProvider)
 {
   _configuration = configuration;
   _commonTransformations = commonTransformations;
   _databaseProvider = databaseProvider;
   _schemaProvider = schemaProvider;
   _connectionProvider = connectionProvider;
 }
开发者ID:Odyl,项目名称:machine.migrations,代码行数:8,代码来源:MigrationInitializer.cs


示例18: AdoAdapter

 internal AdoAdapter(IConnectionProvider connectionProvider) : this()
 {
     _connectionProvider = connectionProvider;
     _schema = DatabaseSchema.Get(_connectionProvider, _providerHelper);
     _relatedFinder = new Lazy<AdoAdapterRelatedFinder>(CreateRelatedFinder);
     _commandOptimizer = ProviderHelper.GetCustomProvider<CommandOptimizer>(_connectionProvider) ??
                         new CommandOptimizer();
 }
开发者ID:loozhang,项目名称:Simple.Data,代码行数:8,代码来源:AdoAdapter.cs


示例19: SearchConnections

 public SearchConnections(
     IConnectionProvider connectionProvider,
     IEventAggregator eventAggregator,
     ConnectionsSearchData connectionsSearchData)
 {
     _connectionProvider = connectionProvider;
     _eventAggregator = eventAggregator;
     _connectionsSearchData = connectionsSearchData;
 }
开发者ID:jsikorski,项目名称:Databases-Project,代码行数:9,代码来源:SearchConnections.cs


示例20: RemoveReservation

 public RemoveReservation(
     IConnectionProvider connectionProvider,
     RESERVATION reservationToRemove, 
     IEventAggregator eventAggregator)
 {
     _connectionProvider = connectionProvider;
     _reservationToRemove = reservationToRemove;
     _eventAggregator = eventAggregator;
 }
开发者ID:jsikorski,项目名称:Databases-Project,代码行数:9,代码来源:RemoveReservation.cs



注:本文中的IConnectionProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IConnectionString类代码示例发布时间:2022-05-24
下一篇:
C# IConnectionPool类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap