/// <summary> /// Construct a new <see cref="AdoPersistenceResourceAccessor" /> with the /// specified <see cref="IAdoResourceProvider" />, /// <see cref="IPersistenceNameResolver" /> and <see cref="IAdoValueReader" /> /// 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="IPersistenceNameResolver" /> 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> public AdoPersistenceResourceAccessor(IAdoResourceProvider resourceProvider, IPersistenceNameResolver nameResolver, IAdoValueReader valueReader, Transaction transaction) { 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; if (transaction == null) { _isConnectionOwner = true; _dbConnection = resourceProvider.CreateConnection(); _dbConnection.Open(); } else { _dbConnection = resourceProvider.CreateEnlistedConnection(transaction, out _isConnectionOwner); } }
/// <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); }
/// <summary> /// Construct a new <see cref="AdoPersistenceResourceAccessor" /> with the /// specified <see cref="IAdoResourceProvider" />, /// <see cref="IPersistenceNameResolver" /> and <see cref="IAdoValueReader" /> /// 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="IPersistenceNameResolver" /> 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> public AdoPersistenceResourceAccessor(IAdoResourceProvider resourceProvider, IPersistenceNameResolver nameResolver, IAdoValueReader valueReader, Transaction transaction) { if (resourceProvider == null) throw new ArgumentNullException("resourceProvider"); if (nameResolver == null) throw new ArgumentNullException("nameResolver"); if (valueReader == null) throw new ArgumentNullException("valueReader"); this.resourceProvider = resourceProvider; this.nameResolver = nameResolver; this.valueReader = valueReader; if (transaction == null) { this.isConnectionOwner = true; this.dbConnection = resourceProvider.CreateConnection(); this.dbConnection.Open(); } else this.dbConnection = resourceProvider.CreateEnlistedConnection(transaction, out this.isConnectionOwner); }
public AdoResourceAccessor(IAdoResourceProvider resourceProvider, IAdoNameResolver nameResolver, IAdoValueReader valueReader, Transaction transaction) { if (resourceProvider == null) { throw new ArgumentNullException("resourceProvider"); } if (nameResolver == null) { throw new ArgumentNullException("nameResolver"); } if (valueReader == null) { throw new ArgumentNullException("valueReader"); } this.resourceProvider = resourceProvider; this.nameResolver = nameResolver; this.valueReader = valueReader; if (transaction == null) { this.dbConnection = resourceProvider.CreateConnection(); this.dbConnection.Open(); } else { this.dbConnection = resourceProvider.CreateEnlistedConnection(transaction); } }
///<summary> ///Must be overridden in the derived class, and when implemented, returns the channel that the runtime tracking infrastructure uses to send tracking records to the tracking service. ///</summary> /// ///<returns> ///The <see cref="T:System.Workflow.Runtime.Tracking.TrackingChannel"></see> that is used to send tracking records to the tracking service. ///</returns> /// ///<param name="parameters">The <see cref="T:System.Workflow.Runtime.Tracking.TrackingParameters"></see> associated with the workflow instance.</param> protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { IAdoResourceProvider resourceProvider = ResourceProvider as IAdoResourceProvider; if (resourceProvider == null) { throw new ArgumentException(RM.Get_Error_NotIAdoResourceProvider()); } return(new AdoTrackingChannel(resourceProvider, valueReader, nameResolver, parameters)); }
/// <summary> /// Create an <see cref="ITrackingServiceResourceAccessor" /> that is responsible /// for manipulating the underlying tracking store. /// </summary> /// <param name="resourceProvider"> /// The active <see cref="IResourceProvider" />. /// </param> protected override ITrackingProfileResourceAccessor CreateAccessor(IResourceProvider resourceProvider) { IAdoResourceProvider adoResourceProvider = resourceProvider as IAdoResourceProvider; if (adoResourceProvider == null) { throw new ArgumentException(RM.Get_Error_NotIAdoResourceProvider()); } return(AdoTrackingResourceAccessorFactory.Create( adoResourceProvider, nameResolver, valueReader)); }
/// <summary> /// Create an <see cref="ITrackingChannelResourceAccessor" /> that is responsible /// for manipulating the underlying tracking store. /// </summary> /// <param name="resourceProvider"> /// The active <see cref="IResourceProvider" />. /// </param> /// <param name="transaction"> /// Transaction to perform operations within. /// </param> protected override ITrackingChannelResourceAccessor CreateAccessor(IResourceProvider resourceProvider, Transaction transaction) { IAdoResourceProvider adoResourceProvider = resourceProvider as IAdoResourceProvider; if (adoResourceProvider == null) { throw new ArgumentException(RM.Get_Error_NotIAdoResourceProvider()); } return(AdoTrackingResourceAccessorFactory.Create( adoResourceProvider, _nameResolver, _valueReader, transaction, stateProvider)); }
/// <summary> /// Create an <see cref="IPersistenceResourceAccessor" /> that is responsible /// for manipulating the underlying persistence store. /// </summary> /// <param name="resourceProvider"> /// The active <see cref="IResourceProvider" />. /// </param> /// <param name="transaction"> /// Transaction to perform operations within. /// </param> protected override IPersistenceResourceAccessor CreateAccessor(IResourceProvider resourceProvider, Transaction transaction) { IAdoResourceProvider adoResourceProvider = resourceProvider as IAdoResourceProvider; if (adoResourceProvider == null) { throw new ArgumentException(RM.Get_Error_NotIAdoResourceProvider()); } return(new AdoPersistenceResourceAccessor( adoResourceProvider, _nameResolver, _valueReader, transaction)); }
/// <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; }
/// <summary> /// Create an <see cref="IAdoResourceProvider" /> that provides /// resources necessary for manipulating the underlying ADO persistence store. /// </summary> protected override IResourceProvider CreateResourceProvider() { string providerName = connectionStringSettings.ProviderName; // grab the resource provider from the factory IAdoResourceProvider resourceProvider = AdoResourceProviderFactory.Create(ConfigurationSectionName, providerName); if (resourceProvider != null) { // initialise it with our connection string settings resourceProvider.Initialise(connectionStringSettings); } return(resourceProvider); }
/// <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> /// Given a provider name either locate the necessary <see cref="IAdoResourceProvider" /> /// in the configuration file or return the default (<see cref="DefaultAdoResourceProvider" />). /// </summary> /// <param name="connectionStringSettings"> /// The name that uniquely identifies an ADO.NET provider. /// </param> /// <returns> /// An <see cref="IAdoResourceProvider" />. /// </returns> public static IAdoResourceProvider Create(ConnectionStringSettings connectionStringSettings) { // locate any mappings for the specified provider ProviderNameTypeMapping mapping = CommonAdoProviderSettings.Get() .ResourceProviders.FindByProviderName(connectionStringSettings.ProviderName); IAdoResourceProvider resourceProvider = null; if (mapping != null) { resourceProvider = TypeUtilities.CreateInstance <IAdoResourceProvider>(mapping.Type); } if (resourceProvider == null) { // no resource provider mapping found in config // return the default resource provider resourceProvider = new DefaultAdoResourceProvider(); } resourceProvider.Initialise(connectionStringSettings); return(resourceProvider); }
/// <summary> /// Construct a new <see cref="AdoPersistenceResourceAccessor" /> with the /// specified <see cref="IAdoResourceProvider" />, /// <see cref="IPersistenceNameResolver" /> 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="IPersistenceNameResolver" /> 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 AdoPersistenceResourceAccessor(IAdoResourceProvider resourceProvider, IPersistenceNameResolver nameResolver, IAdoValueReader valueReader) : this(resourceProvider, nameResolver, valueReader, null) { }
/// <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) { }
/// <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) { }
/// <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) { }