Exemplo n.º 1
0
 /// <summary>
 /// 创建数据库执行对象。
 /// </summary>
 /// <param name="provider">数据提供程序。</param>
 /// <param name="connection">当前连接对象。</param>
 /// <param name="contextOwnsConnection">当前数据上下文是否拥有连接对象。</param>
 internal DatabaseExecutor(IDbAccessProvider provider, DbConnection connection, bool contextOwnsConnection)
 {
     _AccessProvider         = provider;
     _ProviderFactory        = provider.Factory;
     Connection              = connection;
     Connection.StateChange += ConnectionStateChange;
     _ContextOwnsConnection  = contextOwnsConnection;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicDbFunction"/> class.
        /// </summary>
        /// <param name="dbAccessProvider">
        /// The db Access Provider.
        /// </param>
        /// <param name="serviceLocator">
        /// The service Locator.
        /// </param>
        public DynamicDbFunction(
            [NotNull] IDbAccessProvider dbAccessProvider,
            IServiceLocator serviceLocator)
        {
            this._dbAccessProvider = dbAccessProvider;
            this._serviceLocator   = serviceLocator;

            this._queryProxy  = new TryInvokeMemberProxy(this.InvokeQuery);
            this._scalarProxy = new TryInvokeMemberProxy(this.InvokeScalar);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 注册或替换数据库访问提供者。
 /// </summary>
 /// <param name="provider">提供者实例。</param>
 public static void RegisterOrReplace(IDbAccessProvider provider)
 {
     _Providers.AddOrUpdate(provider.ProviderName.ToLower(), provider);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DynamicDbFunction"/> class.
 /// </summary>
 /// <param name="dbAccessProvider">
 /// The db Access Provider.
 /// </param>
 /// <param name="dbSpecificFunctions">
 /// The db Specific Functions. 
 /// </param>
 public DynamicDbFunction([NotNull] IDbAccessProvider dbAccessProvider, IEnumerable<IDbSpecificFunction> dbSpecificFunctions)
 {
     this._dbAccessProvider = dbAccessProvider;
     this._dbSpecificFunctions = dbSpecificFunctions;
     this._getDataProxy = new TryInvokeMemberProxy(this.InvokeGetData);
     this._getDataSetProxy = new TryInvokeMemberProxy(this.InvokeGetDataSet);
     this._queryProxy = new TryInvokeMemberProxy(this.InvokeQuery);
     this._scalarProxy = new TryInvokeMemberProxy(this.InvokeScalar);
 }