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
- CodeTypeDeclarationCollection.cs
- TaiwanLunisolarCalendar.cs
- SharedDp.cs
- KeyValueConfigurationElement.cs
- ServicePerformanceCounters.cs
- PropertyContainer.cs
- Size.cs
- SafeProcessHandle.cs
- ManagedFilter.cs
- XsdDateTime.cs
- StandardOleMarshalObject.cs
- RegexNode.cs
- ExtentKey.cs
- SQLRoleProvider.cs
- CommandDesigner.cs
- ClientRoleProvider.cs
- RuntimeHandles.cs
- PolicyStatement.cs
- ProfileProvider.cs
- DispatcherSynchronizationContext.cs
- SchemaImporter.cs
- SqlClientPermission.cs
- ThemeDirectoryCompiler.cs
- DbParameterCollectionHelper.cs
- ThicknessKeyFrameCollection.cs
- TransactionManager.cs
- CallbackTimeoutsBehavior.cs
- StreamUpdate.cs
- VersionedStream.cs
- DSASignatureFormatter.cs
- TreeNodeEventArgs.cs
- CqlErrorHelper.cs
- LayoutEditorPart.cs
- IpcChannel.cs
- CachedTypeface.cs
- FixUpCollection.cs
- XPathParser.cs
- COMException.cs
- EntityDataSourceReferenceGroup.cs
- LeafCellTreeNode.cs
- X509CertificateTokenFactoryCredential.cs
- ColorInterpolationModeValidation.cs
- ConnectionConsumerAttribute.cs
- TrustManager.cs
- AlphaSortedEnumConverter.cs
- ModifierKeysValueSerializer.cs
- TabletDeviceInfo.cs
- Messages.cs
- WebRequestModuleElement.cs
- CodeLinePragma.cs
- ExpressionVisitor.cs
- BuildProviderCollection.cs
- PropertyManager.cs
- SmtpSection.cs
- WebEncodingValidatorAttribute.cs
- AuthenticationModuleElementCollection.cs
- AppSettingsSection.cs
- SubqueryRules.cs
- DurableInstanceManager.cs
- ProcessModelInfo.cs
- WpfXamlType.cs
- FormViewPagerRow.cs
- ServiceDescriptionReflector.cs
- GridViewColumnHeader.cs
- CachedCompositeFamily.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Win32.cs
- SerializationInfoEnumerator.cs
- SelectionRange.cs
- ItemsChangedEventArgs.cs
- UnsignedPublishLicense.cs
- CompModSwitches.cs
- KnownIds.cs
- FileSystemInfo.cs
- RadioButtonList.cs
- ParagraphVisual.cs
- DrawingContextDrawingContextWalker.cs
- TakeQueryOptionExpression.cs
- SelectionChangedEventArgs.cs
- SignatureHelper.cs
- Util.cs
- RuntimeConfig.cs
- ConfigurationException.cs
- Certificate.cs
- DrawListViewSubItemEventArgs.cs
- TextBlockAutomationPeer.cs
- VoiceChangeEventArgs.cs
- SerializationAttributes.cs
- WebEventTraceProvider.cs
- XmlSerializerFactory.cs
- ReplyChannelBinder.cs
- LinearGradientBrush.cs
- Lease.cs
- ConstrainedDataObject.cs
- ISFTagAndGuidCache.cs
- XsltCompileContext.cs
- ConfigurationLocation.cs
- BindingRestrictions.cs
- HttpResponseBase.cs
- DesigntimeLicenseContext.cs