Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- XmlSchemaSimpleContentRestriction.cs
- ResourceProviderFactory.cs
- DbProviderSpecificTypePropertyAttribute.cs
- MembershipSection.cs
- _Win32.cs
- NoneExcludedImageIndexConverter.cs
- WebSysDisplayNameAttribute.cs
- StyleXamlTreeBuilder.cs
- OracleTransaction.cs
- GACMembershipCondition.cs
- PerformanceCounterPermissionEntry.cs
- ManifestResourceInfo.cs
- FormsAuthenticationUser.cs
- HierarchicalDataBoundControl.cs
- PowerModeChangedEventArgs.cs
- CopyCodeAction.cs
- LogReserveAndAppendState.cs
- RelationshipType.cs
- TrustManager.cs
- X509UI.cs
- WsdlInspector.cs
- XPathNavigatorReader.cs
- ColorConvertedBitmap.cs
- DecimalAnimationBase.cs
- CalendarDataBindingHandler.cs
- X509Certificate2Collection.cs
- Cursors.cs
- CodeDefaultValueExpression.cs
- _IPv4Address.cs
- SatelliteContractVersionAttribute.cs
- ThreadAttributes.cs
- DBPropSet.cs
- _SSPIWrapper.cs
- TableLayoutCellPaintEventArgs.cs
- DelimitedListTraceListener.cs
- StringCollection.cs
- CommonProperties.cs
- PolicyVersionConverter.cs
- StatusBarItemAutomationPeer.cs
- ThumbButtonInfo.cs
- DbConnectionPoolGroup.cs
- WindowsProgressbar.cs
- PublisherMembershipCondition.cs
- DesignerValidatorAdapter.cs
- Literal.cs
- FeedUtils.cs
- GridViewColumnCollectionChangedEventArgs.cs
- ViewStateModeByIdAttribute.cs
- WpfXamlLoader.cs
- BlockCollection.cs
- X509AsymmetricSecurityKey.cs
- OdbcParameterCollection.cs
- ConstNode.cs
- BitmapEffectGeneralTransform.cs
- ConfigurationException.cs
- StyleSelector.cs
- DoubleAnimation.cs
- ProtocolImporter.cs
- MenuItemCollection.cs
- _Win32.cs
- _emptywebproxy.cs
- StyleXamlParser.cs
- SchemaSetCompiler.cs
- ClientRuntimeConfig.cs
- SystemFonts.cs
- WSHttpSecurity.cs
- KnownBoxes.cs
- ButtonPopupAdapter.cs
- DesignerMetadata.cs
- TreeViewItemAutomationPeer.cs
- TaiwanLunisolarCalendar.cs
- EndpointFilterProvider.cs
- FixedSOMLineRanges.cs
- UnauthorizedWebPart.cs
- RadioButtonFlatAdapter.cs
- EmptyStringExpandableObjectConverter.cs
- StackBuilderSink.cs
- KeyEvent.cs
- RenderTargetBitmap.cs
- HtmlPhoneCallAdapter.cs
- RowToParametersTransformer.cs
- DataGridViewCellMouseEventArgs.cs
- DecoderNLS.cs
- WebPartEditorApplyVerb.cs
- KeyValuePairs.cs
- ComboBox.cs
- Input.cs
- Array.cs
- TypeElement.cs
- XamlFilter.cs
- DataGridColumnCollection.cs
- RightsManagementResourceHelper.cs
- HttpPostedFile.cs
- WmfPlaceableFileHeader.cs
- ObjectStorage.cs
- ContentType.cs
- LogicalTreeHelper.cs
- HttpContext.cs
- OleDbInfoMessageEvent.cs
- _NativeSSPI.cs