Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityProviderFactory.cs / 1305376 / EntityProviderFactory.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Data; using System.Data.Common; using System.Security; using System.Security.Permissions; namespace System.Data.EntityClient { ////// Class representing a provider factory for the entity client provider /// public sealed class EntityProviderFactory : DbProviderFactory, IServiceProvider { ////// A singleton object for the entity client provider factory object /// [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "EntityProviderFactory implements the singleton pattern and it's stateless. This is needed in order to work with DbProviderFactories.")] public static readonly EntityProviderFactory Instance = new EntityProviderFactory(); ////// Constructs the EntityProviderFactory object, this is private as users shouldn't create it directly /// private EntityProviderFactory() { } ////// Creates a EntityCommand object and returns it /// ///A EntityCommand object public override DbCommand CreateCommand() { return new EntityCommand(); } ////// Creates a EntityCommandBuilder object and returns it /// ///A EntityCommandBuilder object ///public override DbCommandBuilder CreateCommandBuilder() { throw EntityUtil.NotSupported(); } /// /// Creates a EntityConnection object and returns it /// ///A EntityConnection object public override DbConnection CreateConnection() { return new EntityConnection(); } ////// Creates a EntityConnectionStringBuilder object and returns it /// ///A EntityConnectionStringBuilder object public override DbConnectionStringBuilder CreateConnectionStringBuilder() { return new EntityConnectionStringBuilder(); } ////// Creates a DbDataAdapter object and returns it, this method is currently not supported /// ///A DbDataAdapter object ///public override DbDataAdapter CreateDataAdapter() { throw EntityUtil.NotSupported(); } /// /// Creates a EntityParameter object and returns it /// ///A EntityParameter object public override DbParameter CreateParameter() { return new EntityParameter(); } ////// Creates a CodeAccessPermission object and returns it /// /// The permission state level for the code access ///A CodeAccessPermission object public override CodeAccessPermission CreatePermission(PermissionState state) { throw EntityUtil.NotSupported(); } ////// Extension mechanism for additional services; /// ///requested service provider or null. object IServiceProvider.GetService(Type serviceType) { object result = null; if (serviceType == typeof(DbProviderServices)) { result = EntityProviderServices.Instance; } else if (serviceType == typeof(IEntityAdapter)) { result = new EntityAdapter(); } return result; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Data; using System.Data.Common; using System.Security; using System.Security.Permissions; namespace System.Data.EntityClient { ////// Class representing a provider factory for the entity client provider /// public sealed class EntityProviderFactory : DbProviderFactory, IServiceProvider { ////// A singleton object for the entity client provider factory object /// [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "EntityProviderFactory implements the singleton pattern and it's stateless. This is needed in order to work with DbProviderFactories.")] public static readonly EntityProviderFactory Instance = new EntityProviderFactory(); ////// Constructs the EntityProviderFactory object, this is private as users shouldn't create it directly /// private EntityProviderFactory() { } ////// Creates a EntityCommand object and returns it /// ///A EntityCommand object public override DbCommand CreateCommand() { return new EntityCommand(); } ////// Creates a EntityCommandBuilder object and returns it /// ///A EntityCommandBuilder object ///public override DbCommandBuilder CreateCommandBuilder() { throw EntityUtil.NotSupported(); } /// /// Creates a EntityConnection object and returns it /// ///A EntityConnection object public override DbConnection CreateConnection() { return new EntityConnection(); } ////// Creates a EntityConnectionStringBuilder object and returns it /// ///A EntityConnectionStringBuilder object public override DbConnectionStringBuilder CreateConnectionStringBuilder() { return new EntityConnectionStringBuilder(); } ////// Creates a DbDataAdapter object and returns it, this method is currently not supported /// ///A DbDataAdapter object ///public override DbDataAdapter CreateDataAdapter() { throw EntityUtil.NotSupported(); } /// /// Creates a EntityParameter object and returns it /// ///A EntityParameter object public override DbParameter CreateParameter() { return new EntityParameter(); } ////// Creates a CodeAccessPermission object and returns it /// /// The permission state level for the code access ///A CodeAccessPermission object public override CodeAccessPermission CreatePermission(PermissionState state) { throw EntityUtil.NotSupported(); } ////// Extension mechanism for additional services; /// ///requested service provider or null. object IServiceProvider.GetService(Type serviceType) { object result = null; if (serviceType == typeof(DbProviderServices)) { result = EntityProviderServices.Instance; } else if (serviceType == typeof(IEntityAdapter)) { result = new EntityAdapter(); } return result; } } } // 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
- RequestQueue.cs
- NullReferenceException.cs
- SkipStoryboardToFill.cs
- DynamicDataManager.cs
- X509CertificateValidator.cs
- IdleTimeoutMonitor.cs
- assertwrapper.cs
- FixedHyperLink.cs
- HttpServerUtilityWrapper.cs
- HtmlTableCell.cs
- DateTimeOffsetConverter.cs
- FieldNameLookup.cs
- TypeSystemHelpers.cs
- RepeaterItemCollection.cs
- InputGestureCollection.cs
- LassoHelper.cs
- _Connection.cs
- TreeNodeCollection.cs
- BinaryReader.cs
- BulletedList.cs
- ExpressionVisitorHelpers.cs
- FlowPosition.cs
- SQLInt16.cs
- BitmapPalettes.cs
- TraceContext.cs
- CommonDialog.cs
- EnvironmentPermission.cs
- TextSpan.cs
- WrapperEqualityComparer.cs
- DataPagerFieldCommandEventArgs.cs
- ScrollViewer.cs
- InputGestureCollection.cs
- Span.cs
- SettingsAttributes.cs
- HtmlTableCell.cs
- _AuthenticationState.cs
- DataGridLinkButton.cs
- ObjectViewEntityCollectionData.cs
- BroadcastEventHelper.cs
- ProfileModule.cs
- SemanticTag.cs
- Command.cs
- SchemaNames.cs
- XamlStream.cs
- VirtualPath.cs
- DataKeyCollection.cs
- HtmlShim.cs
- InputLanguage.cs
- TextBoxBase.cs
- ContentIterators.cs
- FieldToken.cs
- Section.cs
- OdbcEnvironment.cs
- ComponentEditorForm.cs
- MethodImplAttribute.cs
- LicenseContext.cs
- AnimationClock.cs
- RawStylusSystemGestureInputReport.cs
- ButtonBaseAutomationPeer.cs
- HwndHostAutomationPeer.cs
- ScriptReferenceBase.cs
- SecurityTokenException.cs
- BitmapEffectrendercontext.cs
- StyleBamlRecordReader.cs
- MainMenu.cs
- Point3DCollection.cs
- SemanticResolver.cs
- _ConnectStream.cs
- MenuCommands.cs
- DropShadowEffect.cs
- StoryFragments.cs
- MenuItemCollectionEditorDialog.cs
- XmlDownloadManager.cs
- FontConverter.cs
- EventProviderWriter.cs
- DocumentPageTextView.cs
- ScriptServiceAttribute.cs
- CreateBookmarkScope.cs
- InputLanguageCollection.cs
- PeerService.cs
- SessionStateItemCollection.cs
- MaskedTextBox.cs
- ColorContext.cs
- AtomEntry.cs
- InternalControlCollection.cs
- ProgressiveCrcCalculatingStream.cs
- AsymmetricAlgorithm.cs
- LexicalChunk.cs
- MinMaxParagraphWidth.cs
- IDispatchConstantAttribute.cs
- AuthenticatingEventArgs.cs
- DirectoryNotFoundException.cs
- DXD.cs
- WebHttpSecurityElement.cs
- MappingModelBuildProvider.cs
- SQLUtility.cs
- AssemblyName.cs
- Empty.cs
- ComponentChangingEvent.cs
- Set.cs