Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityProviderServices.cs / 1305376 / EntityProviderServices.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //----------------------------------------------------------------------------- namespace System.Data.EntityClient { using System.Collections.Generic; using System.Data.Common.CommandTrees; using System.Data.Common; using System.IO; using System.Xml; using System.Data.Metadata.Edm; using System.Diagnostics; ////// The class for provider services of the entity client /// internal sealed class EntityProviderServices : DbProviderServices { ////// Singleton object; /// internal static readonly EntityProviderServices Instance = new EntityProviderServices(); ////// Create a Command Definition object, given the connection and command tree /// /// connection to the underlying provider /// command tree for the statement ///an exectable command definition object ///connection and commandTree arguments must not be null protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree) { EntityUtil.CheckArgumentNull(providerManifest, "providerManifest"); EntityUtil.CheckArgumentNull(commandTree, "commandTree"); StoreItemCollection storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace); return this.CreateCommandDefinition(storeMetadata.StoreProviderFactory, commandTree); } internal EntityCommandDefinition CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree) { EntityUtil.CheckArgumentNull(storeProviderFactory, "storeProviderFactory"); Debug.Assert(commandTree != null, "Command Tree cannot be null"); return new EntityCommandDefinition(storeProviderFactory, commandTree); } ////// Ensures that the data space of the specified command tree is the model (C-) space /// /// The command tree for which the data space should be validated internal override void ValidateDataSpace(DbCommandTree commandTree) { Debug.Assert(commandTree != null, "Ensure command tree is non-null before calling ValidateDataSpace"); if (commandTree.DataSpace != DataSpace.CSpace) { throw EntityUtil.ProviderIncompatible(Entity.Strings.EntityClient_RequiresNonStoreCommandTree); } } ////// Create a EntityCommandDefinition object based on the prototype command /// This method is intended for provider writers to build a default command definition /// from a command. /// /// ////// prototype argument must not be null ///prototype argument must be a EntityCommand public override DbCommandDefinition CreateCommandDefinition(DbCommand prototype) { EntityUtil.CheckArgumentNull(prototype, "prototype"); return ((EntityCommand)prototype).GetCommandDefinition(); } protected override string GetDbProviderManifestToken(DbConnection connection) { EntityUtil.CheckArgumentNull(connection, "connection"); if (connection.GetType() != typeof(EntityConnection)) { throw EntityUtil.Argument(System.Data.Entity.Strings.Mapping_Provider_WrongConnectionType(typeof(EntityConnection))); } return MetadataItem.EdmProviderManifest.Token; } protected override DbProviderManifest GetDbProviderManifest(string versionHint) { EntityUtil.CheckArgumentNull(versionHint, "versionHint"); return MetadataItem.EdmProviderManifest; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //----------------------------------------------------------------------------- namespace System.Data.EntityClient { using System.Collections.Generic; using System.Data.Common.CommandTrees; using System.Data.Common; using System.IO; using System.Xml; using System.Data.Metadata.Edm; using System.Diagnostics; ////// The class for provider services of the entity client /// internal sealed class EntityProviderServices : DbProviderServices { ////// Singleton object; /// internal static readonly EntityProviderServices Instance = new EntityProviderServices(); ////// Create a Command Definition object, given the connection and command tree /// /// connection to the underlying provider /// command tree for the statement ///an exectable command definition object ///connection and commandTree arguments must not be null protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree) { EntityUtil.CheckArgumentNull(providerManifest, "providerManifest"); EntityUtil.CheckArgumentNull(commandTree, "commandTree"); StoreItemCollection storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace); return this.CreateCommandDefinition(storeMetadata.StoreProviderFactory, commandTree); } internal EntityCommandDefinition CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree) { EntityUtil.CheckArgumentNull(storeProviderFactory, "storeProviderFactory"); Debug.Assert(commandTree != null, "Command Tree cannot be null"); return new EntityCommandDefinition(storeProviderFactory, commandTree); } ////// Ensures that the data space of the specified command tree is the model (C-) space /// /// The command tree for which the data space should be validated internal override void ValidateDataSpace(DbCommandTree commandTree) { Debug.Assert(commandTree != null, "Ensure command tree is non-null before calling ValidateDataSpace"); if (commandTree.DataSpace != DataSpace.CSpace) { throw EntityUtil.ProviderIncompatible(Entity.Strings.EntityClient_RequiresNonStoreCommandTree); } } ////// Create a EntityCommandDefinition object based on the prototype command /// This method is intended for provider writers to build a default command definition /// from a command. /// /// ////// prototype argument must not be null ///prototype argument must be a EntityCommand public override DbCommandDefinition CreateCommandDefinition(DbCommand prototype) { EntityUtil.CheckArgumentNull(prototype, "prototype"); return ((EntityCommand)prototype).GetCommandDefinition(); } protected override string GetDbProviderManifestToken(DbConnection connection) { EntityUtil.CheckArgumentNull(connection, "connection"); if (connection.GetType() != typeof(EntityConnection)) { throw EntityUtil.Argument(System.Data.Entity.Strings.Mapping_Provider_WrongConnectionType(typeof(EntityConnection))); } return MetadataItem.EdmProviderManifest.Token; } protected override DbProviderManifest GetDbProviderManifest(string versionHint) { EntityUtil.CheckArgumentNull(versionHint, "versionHint"); return MetadataItem.EdmProviderManifest; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PointKeyFrameCollection.cs
- Transform3D.cs
- CodeValidator.cs
- Thumb.cs
- EventMappingSettings.cs
- SendActivityDesignerTheme.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- SQLGuidStorage.cs
- KernelTypeValidation.cs
- SiteMapNodeItem.cs
- CategoryAttribute.cs
- ColorConvertedBitmap.cs
- ModelTreeEnumerator.cs
- ContextMarshalException.cs
- CompareValidator.cs
- MergeEnumerator.cs
- ObjectDataSourceSelectingEventArgs.cs
- TraceLog.cs
- ClientSettings.cs
- SettingsPropertyCollection.cs
- ClientConfigurationSystem.cs
- ConfigurationLocationCollection.cs
- LicenseContext.cs
- XmlArrayAttribute.cs
- Nullable.cs
- XmlText.cs
- LiteralSubsegment.cs
- PreservationFileReader.cs
- ConfigurationSectionGroup.cs
- CodeParameterDeclarationExpressionCollection.cs
- InstanceDescriptor.cs
- HttpCookieCollection.cs
- WaitForChangedResult.cs
- SystemBrushes.cs
- ElementNotEnabledException.cs
- SqlGatherConsumedAliases.cs
- StylusSystemGestureEventArgs.cs
- PagesSection.cs
- BitmapEncoder.cs
- HyperLinkStyle.cs
- EntityDataSourceValidationException.cs
- ExtendedPropertyCollection.cs
- XmlDataDocument.cs
- ScriptControlDescriptor.cs
- SpecialFolderEnumConverter.cs
- DictionaryItemsCollection.cs
- base64Transforms.cs
- ArcSegment.cs
- PrimaryKeyTypeConverter.cs
- XsdValidatingReader.cs
- FrameSecurityDescriptor.cs
- HMACSHA384.cs
- SHA384CryptoServiceProvider.cs
- PropertyInformationCollection.cs
- SymbolEqualComparer.cs
- ForeignKeyFactory.cs
- MailHeaderInfo.cs
- DataGridViewCheckBoxCell.cs
- MasterPageBuildProvider.cs
- SymbolUsageManager.cs
- Calendar.cs
- UIntPtr.cs
- FilteredXmlReader.cs
- Interlocked.cs
- BasePropertyDescriptor.cs
- TableCellCollection.cs
- _OverlappedAsyncResult.cs
- LineServicesCallbacks.cs
- WebContext.cs
- CryptoApi.cs
- WebPermission.cs
- FullTrustAssemblyCollection.cs
- GenericParameterDataContract.cs
- CodeGeneratorAttribute.cs
- Point3DCollection.cs
- DeflateInput.cs
- MaterialGroup.cs
- DragEvent.cs
- HwndAppCommandInputProvider.cs
- ProcessThread.cs
- VsPropertyGrid.cs
- TextEffectResolver.cs
- TimestampInformation.cs
- DataExpression.cs
- XmlDownloadManager.cs
- SmuggledIUnknown.cs
- ProfessionalColors.cs
- NativeRightsManagementAPIsStructures.cs
- ToolStripSettings.cs
- MappingModelBuildProvider.cs
- Version.cs
- ArgIterator.cs
- ItemType.cs
- LambdaExpression.cs
- _LocalDataStore.cs
- PrinterUnitConvert.cs
- BlobPersonalizationState.cs
- SourceFileInfo.cs
- InstanceData.cs
- DataGridViewComboBoxColumn.cs