Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityProviderServices.cs / 2 / EntityProviderServices.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //----------------------------------------------------------------------------- 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); } ////// 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 [....], [....] //----------------------------------------------------------------------------- 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); } ////// 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
- GeneralTransform.cs
- DataGridColumnFloatingHeader.cs
- RoleManagerSection.cs
- SessionStateSection.cs
- PropertyTab.cs
- DigitalSignatureProvider.cs
- EllipseGeometry.cs
- OutOfMemoryException.cs
- XmlSchemaSet.cs
- WebServiceErrorEvent.cs
- UpDownBaseDesigner.cs
- XmlExceptionHelper.cs
- HashHelper.cs
- DataSourceExpression.cs
- PixelFormatConverter.cs
- UnsafeNativeMethodsTablet.cs
- StylusShape.cs
- Double.cs
- TextServicesDisplayAttributePropertyRanges.cs
- RefreshEventArgs.cs
- StatusBarPanel.cs
- EdmError.cs
- SqlDataSourceStatusEventArgs.cs
- DispatcherFrame.cs
- WindowsMenu.cs
- HandlerBase.cs
- PageEventArgs.cs
- UnsupportedPolicyOptionsException.cs
- OpenFileDialog.cs
- ManagementException.cs
- CodeBinaryOperatorExpression.cs
- GraphicsPath.cs
- CroppedBitmap.cs
- JsonServiceDocumentSerializer.cs
- ColorIndependentAnimationStorage.cs
- ErrorProvider.cs
- ObjectViewFactory.cs
- CellPartitioner.cs
- Rules.cs
- RedirectionProxy.cs
- SqlLiftWhereClauses.cs
- WorkflowQueueInfo.cs
- DefaultDiscoveryServiceExtension.cs
- XmlIlGenerator.cs
- MemberRelationshipService.cs
- SignatureConfirmationElement.cs
- OrderPreservingPipeliningMergeHelper.cs
- WebBrowserDocumentCompletedEventHandler.cs
- SafeRightsManagementHandle.cs
- PackagingUtilities.cs
- ParserContext.cs
- SqlParameterCollection.cs
- DbXmlEnabledProviderManifest.cs
- SpStreamWrapper.cs
- RenderData.cs
- WebPartConnectionCollection.cs
- FormViewInsertEventArgs.cs
- MessageBox.cs
- ChannelSinkStacks.cs
- ActivityCodeDomReferenceService.cs
- SafeMILHandle.cs
- PropertyCondition.cs
- WizardPanelChangingEventArgs.cs
- BindStream.cs
- XmlSchemaComplexType.cs
- ColorConvertedBitmap.cs
- XsltSettings.cs
- ScriptControlManager.cs
- TabControlDesigner.cs
- PolyLineSegment.cs
- SubMenuStyleCollection.cs
- WebPartCatalogAddVerb.cs
- ImageClickEventArgs.cs
- ListBindingHelper.cs
- SecureStringHasher.cs
- AutomationElement.cs
- TreeViewDesigner.cs
- UserValidatedEventArgs.cs
- EntityParameter.cs
- Int64KeyFrameCollection.cs
- MediaContext.cs
- MsmqInputMessagePool.cs
- Container.cs
- ReaderWriterLock.cs
- OperationPickerDialog.designer.cs
- FusionWrap.cs
- BindingBase.cs
- HyperLinkField.cs
- XmlMembersMapping.cs
- URLIdentityPermission.cs
- IImplicitResourceProvider.cs
- ConstraintCollection.cs
- PropertyEmitter.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- Operators.cs
- assemblycache.cs
- HuffModule.cs
- SecurityTokenParameters.cs
- HostVisual.cs
- SqlErrorCollection.cs