public GlimpseProfileDbProviderServices(DbProviderServices innerProviderServices, ProviderStats stats)
 {
     InnerProviderServices = innerProviderServices;
     Stats = stats;
 }
示例#2
0
 /// <summary>
 /// Return an XML reader which represents the CSDL description
 /// </summary>
 /// <returns>An XmlReader that represents the CSDL description</returns>
 internal static XmlReader GetConceptualSchemaDefinition(string csdlName)
 {
     return(DbProviderServices.GetXmlResource("System.Data.Resources.DbProviderServices." + csdlName + ".csdl"));
 }
		/// <summary>
		/// Initializes a new instance of the TracingProviderFactory class.
		/// </summary>
		/// <param name="providerProviderServices">The provider services.</param>
		public TracingProviderFactory(DbProviderServices providerProviderServices)
			: base(providerProviderServices)
		{
		}
示例#4
0
        public LegacyDbProviderServicesWrapper(Legacy.DbProviderServices wrappedProviderServices)
        {
            Debug.Assert(wrappedProviderServices != null, "wrappedProviderServices != null");

            _wrappedProviderServices = wrappedProviderServices;
        }
        /// <summary>
        /// Updates storeParameter size, precision and scale properties from user provided parameter properties.
        /// </summary>
        /// <param name="entityParameter"></param>
        /// <param name="storeParameter"></param>
        private static void SyncParameterProperties(EntityParameter entityParameter, DbParameter storeParameter, DbProviderServices storeProviderServices) {
            IDbDataParameter dbDataParameter = (IDbDataParameter)storeParameter;

            // DBType is not currently syncable; it's part of the cache key anyway; this is because we can't guarantee
            // that the store provider will honor it -- (SqlClient doesn't...)
            //if (entityParameter.IsDbTypeSpecified)
            //{
            //    storeParameter.DbType = entityParameter.DbType;
            //}

            // Give the store provider the opportunity to set the value before any parameter state has been copied from
            // the EntityParameter.
            TypeUsage parameterTypeUsage = TypeHelpers.GetPrimitiveTypeUsageForScalar(entityParameter.GetTypeUsage());
            storeProviderServices.SetParameterValue(storeParameter, parameterTypeUsage, entityParameter.Value);

            // Override the store provider parameter state with any explicitly specified values from the EntityParameter.
            if (entityParameter.IsDirectionSpecified)
            {
                storeParameter.Direction = entityParameter.Direction;
            }
            if (entityParameter.IsIsNullableSpecified)
            {
                storeParameter.IsNullable = entityParameter.IsNullable;
            }
            if (entityParameter.IsSizeSpecified)
            {
                storeParameter.Size = entityParameter.Size;
            }
            if (entityParameter.IsPrecisionSpecified)
            {
                dbDataParameter.Precision = entityParameter.Precision;
            }
            if (entityParameter.IsScaleSpecified)
            {
                dbDataParameter.Scale = entityParameter.Scale;
            }
        }
 public ProfilableDbProviderServices(DbProviderServices tail)
 {
     this._wrapped = tail;
 }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the DbProviderFactoryBase class.
 /// </summary>
 /// <param name="providerServices">The provider services.</param>
 protected DbProviderFactoryBase(DbProviderServices providerServices)
 {
     this.services = providerServices;
 }
 public DbTracingProviderServices(DbProviderServices providerServices)
 {
     this.providerServices = providerServices;
 }
 public ProfiledDbProviderServices(DbProviderServices tail, IDbProfiler profiler)
 {
     this.wrapped = tail;
     this.profiler = profiler;
 }
        private static MetadataWorkspace GetProviderSchemaMetadataWorkspace(DbProviderServices providerServices, DbConnection providerConnection, Version targetEntityFrameworkVersion)
        {
            XmlReader csdl = null;
            XmlReader ssdl = null;
            XmlReader msl = null;

            Debug.Assert(EntityFrameworkVersions.IsValidVersion(targetEntityFrameworkVersion), "EntityFrameworkVersions.IsValidVersion(targetEntityFrameworkVersion)");
            string csdlName;
            string ssdlName;
            string mslName;
            if (targetEntityFrameworkVersion >= EntityFrameworkVersions.Version3)
            {
                csdlName = DbProviderManifest.ConceptualSchemaDefinitionVersion3;
                ssdlName = DbProviderManifest.StoreSchemaDefinitionVersion3;
                mslName = DbProviderManifest.StoreSchemaMappingVersion3;
            }
            else
            {
                csdlName = DbProviderManifest.ConceptualSchemaDefinition;
                ssdlName = DbProviderManifest.StoreSchemaDefinition;
                mslName = DbProviderManifest.StoreSchemaMapping;
            }

            try
            {
                // create the metadata workspace
                MetadataWorkspace workspace = new MetadataWorkspace();

                string manifestToken = providerServices.GetProviderManifestToken(providerConnection);
                DbProviderManifest providerManifest = providerServices.GetProviderManifest(manifestToken);

                // create the EdmItemCollection
                IList<EdmSchemaError> errors;
                ssdl = providerManifest.GetInformation(ssdlName);
                string location = Strings.DbProviderServicesInformationLocationPath(providerConnection.GetType().Name, ssdlName);
                List<string> ssdlLocations = new List<string>(1);
                ssdlLocations.Add(location);
                StoreItemCollection storeItemCollection = new StoreItemCollection(new XmlReader[] { ssdl }, ssdlLocations.AsReadOnly(), out errors);
                ThrowOnError(errors);
                workspace.RegisterItemCollection(storeItemCollection);

                csdl = DbProviderServices.GetConceptualSchemaDefinition(csdlName);
                location = Strings.DbProviderServicesInformationLocationPath(typeof(DbProviderServices).Name, csdlName);
                List<string> csdlLocations = new List<string>(1);
                csdlLocations.Add(location);
                EdmItemCollection edmItemCollection = new EdmItemCollection(new XmlReader[] { csdl }, csdlLocations.AsReadOnly(), out errors);
                ThrowOnError(errors);
                workspace.RegisterItemCollection(edmItemCollection);

                msl = providerManifest.GetInformation(mslName);
                location = Strings.DbProviderServicesInformationLocationPath(providerConnection.GetType().Name, DbProviderManifest.StoreSchemaMapping);
                List<string> mslLocations = new List<string>(1);
                mslLocations.Add(location);
                StorageMappingItemCollection mappingItemCollection = new StorageMappingItemCollection(edmItemCollection,
                                                                         storeItemCollection,
                                                                         new XmlReader[] { msl },
                                                                         mslLocations,
                                                                         out errors);
                ThrowOnError(errors);
                workspace.RegisterItemCollection(mappingItemCollection);

                // make the views generate here so we can wrap the provider schema problems
                // in a ProviderIncompatibleException
                ForceViewGeneration(workspace);
                return workspace;
            }
            catch (ProviderIncompatibleException)
            {
                // we don't really want to catch this one, just rethrow it
                throw;
            }
            catch (Exception e)
            {
                if (MetadataUtil.IsCatchableExceptionType(e))
                {
                    throw EDesignUtil.ProviderIncompatible(Strings.ProviderSchemaErrors, e);
                }

                throw;
            }
            finally
            {
                if (csdl != null) ((IDisposable)csdl).Dispose();
                if (ssdl != null) ((IDisposable)ssdl).Dispose();
                if (msl != null) ((IDisposable)msl).Dispose();
            }
        }
 public ProxyDbProviderServices(DbProviderServices proxiedDbProviderServices)
 {
     this.ProxiedDbProviderServices = proxiedDbProviderServices;
 }
 public LINQPadSqlOrCEProviderServices(DbConnection prototypeCx)
 {
     this._proxy = DbProviderServices.GetProviderServices(prototypeCx);
 }
 /// <summary>
 /// Initialises a new instance of the <see cref="ProfiledDbProviderServices"/> class.
 /// </summary>
 /// <param name="tail">The tail.</param>
 /// <param name="profiler">The profiler.</param>
 public ProfiledDbProviderServices(DbProviderServices tail, IDbProfiler profiler)
 {
     _wrapped = tail;
     _profiler = profiler;
 }
        public LegacyDbProviderServicesWrapper(Legacy.DbProviderServices wrappedProviderServices)
        {
            Debug.Assert(wrappedProviderServices != null, "wrappedProviderServices != null");

            _wrappedProviderServices = wrappedProviderServices;
        }