Example #1
0
        /// <summary>
        /// Construct a new <see cref="AdoTrackingResourceAccessor" /> with the
        /// specified <see cref="IAdoResourceProvider" />,
        /// <see cref="ITrackingNameResolver" />, <see cref="IAdoValueReader" />
        /// and <see cref="IStateProvider" />. All work should be performed in
        /// the specified <see cref="Transaction" />.
        /// </summary>
        /// <param name="resourceProvider">
        /// An <see cref="IAdoResourceProvider" /> used to provide resources for
        /// accessing the tracking store.
        /// </param>
        /// <param name="nameResolver">
        /// An <see cref="ITrackingNameResolver" /> that resolves names
        /// of commands and parameters for the relevant tracking store.
        /// </param>
        /// <param name="valueReader">
        /// An <see cref="IAdoValueReader" /> that reads values from
        /// <see cref="IDbCommand" /> and <see cref="IDataReader" /> implementations.
        /// </param>
        /// <param name="transaction">
        /// An <see cref="Transaction" /> in which to perform the work.
        /// </param>
        /// <param name="stateProvider">
        /// An <see cref="IStateProvider" /> that can be used to store state.
        /// </param>
        public AdoTrackingResourceAccessor(IAdoResourceProvider resourceProvider,
                                           ITrackingNameResolver nameResolver, IAdoValueReader valueReader,
                                           Transaction transaction, IStateProvider stateProvider)
        {
            if (resourceProvider == null)
            {
                throw new ArgumentNullException("resourceProvider");
            }

            if (nameResolver == null)
            {
                throw new ArgumentNullException("nameResolver");
            }

            if (valueReader == null)
            {
                throw new ArgumentNullException("valueReader");
            }

            _resourceProvider = resourceProvider;
            _nameResolver     = nameResolver;
            _valueReader      = valueReader;
            _stateProvider    = stateProvider;

            if (transaction == null)
            {
                _isConnectionOwner = true;
                _dbConnection      = resourceProvider.CreateConnection();
                _dbConnection.Open();
            }
            else
            {
                _dbConnection = resourceProvider.CreateEnlistedConnection(transaction, out _isConnectionOwner);
            }
        }
Example #2
0
        /// <summary>
        /// Given a provider name locate the necessary
        /// <see cref="AdoTrackingResourceAccessor" /> in the configuration file.
        /// </summary>
        /// <returns>
        /// An <see cref="AdoTrackingResourceAccessor" />.
        /// </returns>
        public static AdoTrackingResourceAccessor Create(
            IAdoResourceProvider resourceProvider, ITrackingNameResolver nameResolver,
            IAdoValueReader valueReader, Transaction transaction, IStateProvider stateProvider)
        {
            // locate any mappings for the specified provider
            ProviderNameTypeMapping mapping = TrackingAdoProviderSettings.Get()
                                              .ResourceAccessors.FindByProviderName(resourceProvider.ProviderName);

            AdoTrackingResourceAccessor resourceAccessor;

            if (mapping != null)
            {
                resourceAccessor =
                    TypeUtilities.CreateInstance <AdoTrackingResourceAccessor>(
                        mapping.Type, new object[]
                {
                    resourceProvider, nameResolver, valueReader,
                    transaction, stateProvider
                });
            }
            else
            {
                return(new AdoTrackingResourceAccessor(
                           resourceProvider, nameResolver, valueReader,
                           transaction, stateProvider));
            }

            return(resourceAccessor);
        }
        /// <summary>
        /// Given a provider name locate the necessary 
        /// <see cref="AdoTrackingResourceAccessor" /> in the configuration file.
        /// </summary>
        /// <returns>
        /// An <see cref="AdoTrackingResourceAccessor" />.
        /// </returns>
        public static AdoTrackingResourceAccessor Create(
            IAdoResourceProvider resourceProvider, ITrackingNameResolver nameResolver,
            IAdoValueReader valueReader, Transaction transaction, IStateProvider stateProvider)
        {
            // locate any mappings for the specified provider
            ProviderNameTypeMapping mapping = TrackingAdoProviderSettings.Get()
                    .ResourceAccessors.FindByProviderName(resourceProvider.ProviderName);

            AdoTrackingResourceAccessor resourceAccessor;
            if (mapping != null)
            {
                resourceAccessor =
                    TypeUtilities.CreateInstance<AdoTrackingResourceAccessor>(
                        mapping.Type, new object[]
                            {
                                resourceProvider, nameResolver, valueReader,
                                transaction, stateProvider
                            });
            }
            else
            {
                return new AdoTrackingResourceAccessor(
                    resourceProvider, nameResolver, valueReader,
                    transaction, stateProvider);
            }

            return resourceAccessor;
        }
Example #4
0
        /// <summary>
        /// Perform startup duties associated with this persistence service.
        /// <remarks>
        /// This implementation calls a virtual method to create a single
        /// <see cref="ITrackingNameResolver" /> and <see cref="IAdoValueReader" />
        /// for this persistence service.
        /// </remarks>
        /// </summary>
        protected override void Start()
        {
            this.nameResolver     = CreateNameResolver();
            this.valueReader      = CreateValueReader();
            this.workBatchService = base.Runtime.GetService <AdoWorkBatchService>();

            base.Start();
        }
Example #5
0
        /// <summary>
        /// Perform startup duties associated with this persistence service.
        /// <remarks>
        /// This implementation calls a virtual method to create a single
        /// <see cref="ITrackingNameResolver" /> and <see cref="IAdoValueReader" />
        /// for this persistence service.
        /// </remarks>
        /// </summary>
        protected override void Start()
        {
            _nameResolver     = CreateNameResolver();
            _valueReader      = CreateValueReader();
            _workBatchService = Runtime.GetService <AdoWorkBatchService>();

            base.Start();
        }
Example #6
0
        /// <summary>
        /// Create an instance of the <see cref="AdoTrackingChannel" />
        /// with the specified <see cref="IAdoResourceProvider" />, <see cref="ITrackingNameResolver" />
        /// and <see cref="IAdoValueReader" />.
        /// </summary>
        /// <param name="resourceProvider">
        /// An <see cref="IAdoResourceProvider" /> that provides resources
        /// for manipulating the underlying tracking store.
        /// </param>
        /// <param name="valueReader">
        /// An <see cref="IAdoValueReader" /> that is responsible for
        /// reading values from the underlying tracking store.
        /// </param>
        /// <param name="nameResolver">
        /// An <see cref="ITrackingNameResolver" /> that is responsible for
        /// resolving names for the underlying tracking store.
        /// </param>
        /// <param name="trackingParameters">
        /// <see cref="TrackingParameters" /> from the <see cref="TrackingService" />.
        /// </param>
        public AdoTrackingChannel(IAdoResourceProvider resourceProvider, 
            IAdoValueReader valueReader, ITrackingNameResolver nameResolver,
            TrackingParameters trackingParameters) : base(resourceProvider, 
            trackingParameters)
        {
            if (valueReader == null)
                throw new ArgumentNullException("valueReader");

            if (nameResolver == null)
                throw new ArgumentNullException("nameResolver");

            this.valueReader = valueReader;
            this.nameResolver = nameResolver;
        }
Example #7
0
        /// <summary>
        /// Given a provider name locate the necessary <see cref="ITrackingNameResolver" />
        /// in the configuration file.
        /// </summary>
        /// <param name="providerName">
        /// The name that uniquely identifies an ADO.NET provider.
        /// </param>
        /// <returns>
        /// An <see cref="ITrackingNameResolver" />.
        /// </returns>
        public static ITrackingNameResolver Create(string providerName)
        {
            // locate any mappings for the specified provider
            ProviderNameTypeMapping mapping = TrackingAdoProviderSettings.Get()
                                              .NameResolvers.FindByProviderName(providerName);

            ITrackingNameResolver nameResolver = null;

            if (mapping != null)
            {
                nameResolver = TypeUtilities.CreateInstance <ITrackingNameResolver>(mapping.Type);
            }

            return(nameResolver);
        }
Example #8
0
        /// <summary>
        /// Create an instance of the <see cref="AdoTrackingChannel" />
        /// with the specified <see cref="IAdoResourceProvider" />, <see cref="ITrackingNameResolver" />
        /// and <see cref="IAdoValueReader" />.
        /// </summary>
        /// <param name="resourceProvider">
        /// An <see cref="IAdoResourceProvider" /> that provides resources
        /// for manipulating the underlying tracking store.
        /// </param>
        /// <param name="valueReader">
        /// An <see cref="IAdoValueReader" /> that is responsible for
        /// reading values from the underlying tracking store.
        /// </param>
        /// <param name="nameResolver">
        /// An <see cref="ITrackingNameResolver" /> that is responsible for
        /// resolving names for the underlying tracking store.
        /// </param>
        /// <param name="trackingParameters">
        /// <see cref="TrackingParameters" /> from the <see cref="TrackingService" />.
        /// </param>
        public AdoTrackingChannel(IAdoResourceProvider resourceProvider,
                                  IAdoValueReader valueReader, ITrackingNameResolver nameResolver,
                                  TrackingParameters trackingParameters) : base(resourceProvider,
                                                                                trackingParameters)
        {
            if (valueReader == null)
            {
                throw new ArgumentNullException("valueReader");
            }

            if (nameResolver == null)
            {
                throw new ArgumentNullException("nameResolver");
            }

            _valueReader  = valueReader;
            _nameResolver = nameResolver;
        }
 /// <summary>
 /// Construct a new <see cref="OdpTrackingResourceAccessor" /> with the
 /// specified <see cref="IAdoResourceProvider" />,
 /// <see cref="ITrackingNameResolver" />, <see cref="IAdoValueReader" />
 /// and <see cref="IStateProvider" />.
 /// </summary>
 /// <param name="resourceProvider">
 /// An <see cref="IAdoResourceProvider" /> used to provide resources for
 /// accessing the tracking store.
 /// </param>
 /// <param name="nameResolver">
 /// An <see cref="ITrackingNameResolver" /> that resolves names
 /// of commands and parameters for the relevant tracking store.
 /// </param>
 /// <param name="valueReader">
 /// An <see cref="IAdoValueReader" /> that reads values from
 /// <see cref="IDbCommand" /> and <see cref="IDataReader" /> implementations.
 /// </param>
 public OdpTrackingResourceAccessor(IAdoResourceProvider resourceProvider,
                                    ITrackingNameResolver nameResolver, IAdoValueReader valueReader) :
     base(resourceProvider, nameResolver, valueReader)
 {
 }
Example #10
0
 /// <summary>
 /// Construct a new <see cref="OdpTrackingResourceAccessor" /> with the
 /// specified <see cref="IAdoResourceProvider" />,
 /// <see cref="ITrackingNameResolver" />, <see cref="IAdoValueReader" />
 /// and <see cref="IStateProvider" />. All work should be performed in
 /// the specified <see cref="Transaction" />.
 /// </summary>
 /// <param name="resourceProvider">
 /// An <see cref="IAdoResourceProvider" /> used to provide resources for
 /// accessing the tracking store.
 /// </param>
 /// <param name="nameResolver">
 /// An <see cref="ITrackingNameResolver" /> that resolves names
 /// of commands and parameters for the relevant tracking store.
 /// </param>
 /// <param name="valueReader">
 /// An <see cref="IAdoValueReader" /> that reads values from
 /// <see cref="IDbCommand" /> and <see cref="IDataReader" /> implementations.
 /// </param>
 /// <param name="transaction">
 /// An <see cref="Transaction" /> in which to perform the work.
 /// </param>
 /// <param name="stateProvider">
 /// An <see cref="IStateProvider" /> that can be used to store state.
 /// </param>
 /// </summary>
 public OdpTrackingResourceAccessor(IAdoResourceProvider resourceProvider,
                                    ITrackingNameResolver nameResolver, IAdoValueReader valueReader,
                                    Transaction transaction, IStateProvider stateProvider) :
     base(resourceProvider, nameResolver, valueReader, transaction, stateProvider)
 {
 }
Example #11
0
 /// <summary>
 /// Construct a new <see cref="AdoTrackingResourceAccessor" /> with the
 /// specified <see cref="IAdoResourceProvider" />,
 /// <see cref="ITrackingNameResolver" /> and <see cref="IAdoValueReader" />.
 /// </summary>
 /// <param name="resourceProvider">
 /// An <see cref="IAdoResourceProvider" /> used to provide resources for
 /// accessing the tracking store.
 /// </param>
 /// <param name="nameResolver">
 /// An <see cref="ITrackingNameResolver" /> that resolves names
 /// of commands and parameters for the relevant tracking store.
 /// </param>
 /// <param name="valueReader">
 /// An <see cref="IAdoValueReader" /> that reads values from
 /// <see cref="IDbCommand" /> and <see cref="IDataReader" /> implementations.
 /// </param>
 public AdoTrackingResourceAccessor(IAdoResourceProvider resourceProvider,
                                    ITrackingNameResolver nameResolver, IAdoValueReader valueReader) :
     this(resourceProvider, nameResolver, valueReader, null, null)
 {
 }
Example #12
0
 /// <summary>
 /// Construct a new <see cref="OdpTrackingResourceAccessor" /> with the
 /// specified <see cref="IAdoResourceProvider" />, 
 /// <see cref="ITrackingNameResolver" />, <see cref="IAdoValueReader" /> 
 /// and <see cref="IStateProvider" />.
 /// </summary>
 /// <param name="resourceProvider">
 /// An <see cref="IAdoResourceProvider" /> used to provide resources for
 /// accessing the tracking store.
 /// </param>
 /// <param name="nameResolver">
 /// An <see cref="ITrackingNameResolver" /> that resolves names
 /// of commands and parameters for the relevant tracking store.
 /// </param>
 /// <param name="valueReader">
 /// An <see cref="IAdoValueReader" /> that reads values from
 /// <see cref="IDbCommand" /> and <see cref="IDataReader" /> implementations.
 /// </param>
 public OdpTrackingResourceAccessor(IAdoResourceProvider resourceProvider, 
     ITrackingNameResolver nameResolver, IAdoValueReader valueReader) : 
     base(resourceProvider, nameResolver, valueReader) { }
Example #13
0
 /// <summary>
 /// Construct a new <see cref="OdpTrackingResourceAccessor" /> with the
 /// specified <see cref="IAdoResourceProvider" />, 
 /// <see cref="ITrackingNameResolver" />, <see cref="IAdoValueReader" /> 
 /// and <see cref="IStateProvider" />. All work should be performed in
 /// the specified <see cref="Transaction" />.
 /// </summary>
 /// <param name="resourceProvider">
 /// An <see cref="IAdoResourceProvider" /> used to provide resources for
 /// accessing the tracking store.
 /// </param>
 /// <param name="nameResolver">
 /// An <see cref="ITrackingNameResolver" /> that resolves names
 /// of commands and parameters for the relevant tracking store.
 /// </param>
 /// <param name="valueReader">
 /// An <see cref="IAdoValueReader" /> that reads values from
 /// <see cref="IDbCommand" /> and <see cref="IDataReader" /> implementations.
 /// </param>
 /// <param name="transaction">
 /// An <see cref="Transaction" /> in which to perform the work.
 /// </param>
 /// <param name="stateProvider">
 /// An <see cref="IStateProvider" /> that can be used to store state.
 /// </param>
 /// </summary>
 public OdpTrackingResourceAccessor(IAdoResourceProvider resourceProvider, 
     ITrackingNameResolver nameResolver, IAdoValueReader valueReader, 
     Transaction transaction, IStateProvider stateProvider) : 
     base(resourceProvider, nameResolver, valueReader, transaction, stateProvider) { }
Example #14
0
        /// <summary>
        /// Perform startup duties associated with this persistence service.
        /// <remarks>
        /// This implementation calls a virtual method to create a single 
        /// <see cref="ITrackingNameResolver" /> and <see cref="IAdoValueReader" />
        /// for this persistence service.
        /// </remarks>
        /// </summary>
        protected override void Start()
        {
            this.nameResolver = CreateNameResolver();
            this.valueReader = CreateValueReader();
            this.workBatchService = base.Runtime.GetService<AdoWorkBatchService>();

            base.Start();
        }