Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityProviderServices.cs / 1 / 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
- InfoCardService.cs
- Activity.cs
- Registry.cs
- dataobject.cs
- ECDsaCng.cs
- AdCreatedEventArgs.cs
- BuilderElements.cs
- FontFamilyConverter.cs
- GenericUriParser.cs
- RuleInfoComparer.cs
- BackoffTimeoutHelper.cs
- ByValueEqualityComparer.cs
- ServiceModelConfigurationSection.cs
- LogRecordSequence.cs
- WeakReferenceList.cs
- WaitingCursor.cs
- ArrayTypeMismatchException.cs
- FileLevelControlBuilderAttribute.cs
- EncodingStreamWrapper.cs
- MethodBuilder.cs
- FocusManager.cs
- DomainUpDown.cs
- NewItemsContextMenuStrip.cs
- LicenseException.cs
- Rect.cs
- MessageQuerySet.cs
- MatrixAnimationUsingPath.cs
- ContractAdapter.cs
- OdbcConnectionFactory.cs
- HiddenFieldPageStatePersister.cs
- MorphHelper.cs
- RequestUriProcessor.cs
- PointHitTestParameters.cs
- TrackingWorkflowEventArgs.cs
- DateTimeValueSerializerContext.cs
- RowTypeElement.cs
- TextWriterTraceListener.cs
- TcpProcessProtocolHandler.cs
- InputBinding.cs
- XhtmlBasicSelectionListAdapter.cs
- PropertyInfoSet.cs
- BinaryFormatter.cs
- ContextStack.cs
- XmlReflectionMember.cs
- RTLAwareMessageBox.cs
- CodeGroup.cs
- _AutoWebProxyScriptHelper.cs
- ValidatorUtils.cs
- XdrBuilder.cs
- CacheRequest.cs
- MexServiceChannelBuilder.cs
- EncodingInfo.cs
- EdmTypeAttribute.cs
- SmtpFailedRecipientsException.cs
- AttributeQuery.cs
- WindowHelperService.cs
- ExpressionLexer.cs
- StringConcat.cs
- ListCollectionView.cs
- DebugController.cs
- AddInBase.cs
- Accessible.cs
- StringWriter.cs
- SortDescription.cs
- DataGridViewDataErrorEventArgs.cs
- EndOfStreamException.cs
- ReturnEventArgs.cs
- XdrBuilder.cs
- BoolLiteral.cs
- LookupNode.cs
- HiddenFieldPageStatePersister.cs
- EnumerationRangeValidationUtil.cs
- OleDbEnumerator.cs
- ServerProtocol.cs
- DataServiceContext.cs
- TableFieldsEditor.cs
- HostSecurityManager.cs
- WindowsListBox.cs
- StylusSystemGestureEventArgs.cs
- COM2ColorConverter.cs
- ColumnHeaderCollectionEditor.cs
- TemplateKey.cs
- NavigationExpr.cs
- WorkflowItemsPresenter.cs
- ToolStripArrowRenderEventArgs.cs
- SelectionEditor.cs
- SQLInt32Storage.cs
- MulticastOption.cs
- Baml2006SchemaContext.cs
- ToolStripContentPanelRenderEventArgs.cs
- PerfCounterSection.cs
- DataGridTablesFactory.cs
- ButtonChrome.cs
- TypeElement.cs
- MergeFilterQuery.cs
- PrinterResolution.cs
- PrePostDescendentsWalker.cs
- TypeForwardedToAttribute.cs
- EventLogInformation.cs
- TraceHwndHost.cs