Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityProviderServices.cs / 3 / 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
- DataPagerCommandEventArgs.cs
- NativeMethods.cs
- EventLogConfiguration.cs
- XomlCompilerResults.cs
- XsdDuration.cs
- PropertyItem.cs
- webbrowsersite.cs
- __ConsoleStream.cs
- SmiContextFactory.cs
- FrameworkElement.cs
- ContractReference.cs
- SelectionEditor.cs
- RadialGradientBrush.cs
- httpapplicationstate.cs
- IFlowDocumentViewer.cs
- RuntimeVariablesExpression.cs
- BinaryFormatter.cs
- _ScatterGatherBuffers.cs
- StateMachine.cs
- PassportAuthentication.cs
- SourceFileInfo.cs
- HtmlTableRow.cs
- SqlDataSource.cs
- LinkClickEvent.cs
- AuthenticationConfig.cs
- DataRowChangeEvent.cs
- ScalarOps.cs
- SqlVisitor.cs
- Column.cs
- LinearGradientBrush.cs
- CodeIndexerExpression.cs
- EventProviderBase.cs
- SortFieldComparer.cs
- MimeObjectFactory.cs
- DataServiceQueryOfT.cs
- DesignerProperties.cs
- DerivedKeySecurityTokenStub.cs
- Thread.cs
- HtmlLink.cs
- HiddenFieldPageStatePersister.cs
- DisposableCollectionWrapper.cs
- EventMetadata.cs
- DatatypeImplementation.cs
- SqlCaseSimplifier.cs
- DefaultProxySection.cs
- _ScatterGatherBuffers.cs
- ProfilePropertySettings.cs
- LocationSectionRecord.cs
- OperandQuery.cs
- UIHelper.cs
- HttpListenerResponse.cs
- ContentHostHelper.cs
- ArgumentValue.cs
- DataRelation.cs
- GridViewDeleteEventArgs.cs
- dataobject.cs
- TranslateTransform3D.cs
- CacheModeValueSerializer.cs
- TokenBasedSetEnumerator.cs
- DurableOperationAttribute.cs
- Menu.cs
- ApplicationGesture.cs
- ToolStripOverflowButton.cs
- TouchesOverProperty.cs
- SharedStatics.cs
- PermissionAttributes.cs
- DbCommandTree.cs
- RadioButton.cs
- RandomNumberGenerator.cs
- DataGridViewCellMouseEventArgs.cs
- MenuCommands.cs
- TaskFactory.cs
- PriorityQueue.cs
- MetadataException.cs
- BadImageFormatException.cs
- DataTableTypeConverter.cs
- XamlSerializer.cs
- RenderDataDrawingContext.cs
- ListViewHitTestInfo.cs
- WizardStepBase.cs
- HttpRequest.cs
- Region.cs
- MimeMapping.cs
- RtfToXamlReader.cs
- CodeDirectionExpression.cs
- ServiceInstallComponent.cs
- __TransparentProxy.cs
- MetaColumn.cs
- SafeRegistryKey.cs
- PrintPreviewGraphics.cs
- IFlowDocumentViewer.cs
- RadioButton.cs
- AuthenticateEventArgs.cs
- AttachedAnnotationChangedEventArgs.cs
- UnmanagedMemoryStream.cs
- XmlSchemaException.cs
- BackEase.cs
- DataReaderContainer.cs
- HotCommands.cs
- ConditionBrowserDialog.cs