Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / EntityClient / EntityProviderFactory.cs / 2 / EntityProviderFactory.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- 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 [....], [....] //--------------------------------------------------------------------- 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
- DecimalKeyFrameCollection.cs
- DecoderNLS.cs
- UnsafeNativeMethods.cs
- XmlAttributeAttribute.cs
- XslTransform.cs
- CollectionView.cs
- ImageConverter.cs
- MimeTypeMapper.cs
- RetrieveVirtualItemEventArgs.cs
- DownloadProgressEventArgs.cs
- SafeWaitHandle.cs
- HttpInputStream.cs
- FramingChannels.cs
- LineServicesCallbacks.cs
- EntityContainerEntitySet.cs
- KnownTypesProvider.cs
- SaveCardRequest.cs
- ConfigurationValidatorAttribute.cs
- ServiceOperationInvoker.cs
- Pkcs7Signer.cs
- DynamicResourceExtension.cs
- EntityUtil.cs
- Transactions.cs
- ProfileEventArgs.cs
- GenericIdentity.cs
- Viewport3DVisual.cs
- FontDialog.cs
- ValidatingReaderNodeData.cs
- DrawingGroupDrawingContext.cs
- ListViewCancelEventArgs.cs
- Object.cs
- ObjectDataSourceDisposingEventArgs.cs
- ObjectStateEntryDbDataRecord.cs
- EdmError.cs
- COM2ColorConverter.cs
- ActivityUtilities.cs
- EventProperty.cs
- Automation.cs
- safemediahandle.cs
- Byte.cs
- ParenthesizePropertyNameAttribute.cs
- MSAANativeProvider.cs
- ImmComposition.cs
- PowerStatus.cs
- SendActivityDesigner.cs
- StyleSelector.cs
- ConstantProjectedSlot.cs
- DivideByZeroException.cs
- Subtree.cs
- MdiWindowListStrip.cs
- FileAuthorizationModule.cs
- PropertyInfoSet.cs
- ListBindingConverter.cs
- HtmlElementEventArgs.cs
- TextDecorations.cs
- SerializationAttributes.cs
- URLAttribute.cs
- FirstMatchCodeGroup.cs
- PageStatePersister.cs
- ChtmlTextWriter.cs
- SafeEventLogWriteHandle.cs
- EncodingDataItem.cs
- SystemIcmpV6Statistics.cs
- ViewManager.cs
- MembershipPasswordException.cs
- DeclarativeCatalogPartDesigner.cs
- SqlMethodCallConverter.cs
- NavigationService.cs
- ControlType.cs
- WebException.cs
- prompt.cs
- PageAsyncTask.cs
- SerialErrors.cs
- WebServiceEnumData.cs
- DetailsView.cs
- ConnectionManagementSection.cs
- Span.cs
- ProfileModule.cs
- ScaleTransform.cs
- LinkButton.cs
- SqlDataReader.cs
- SearchForVirtualItemEventArgs.cs
- TextDecorationUnitValidation.cs
- ArithmeticException.cs
- WSSecurityPolicy12.cs
- PathData.cs
- WsatConfiguration.cs
- BaseUriHelper.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- BrowsableAttribute.cs
- Operators.cs
- RuntimeHandles.cs
- RuntimeCompatibilityAttribute.cs
- SQLString.cs
- CustomAttributeSerializer.cs
- XPathChildIterator.cs
- DbLambda.cs
- OleDbStruct.cs
- UpDownEvent.cs
- DataGridViewCellStyleEditor.cs