Example #1
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);
        }
Example #2
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);
        }