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
- XmlSchemaValidationException.cs
- ImageListImage.cs
- DynamicResourceExtensionConverter.cs
- LinqDataSourceDeleteEventArgs.cs
- NavigatorInput.cs
- Win32.cs
- EdmType.cs
- ProfileManager.cs
- ContainerParaClient.cs
- ErrorInfoXmlDocument.cs
- SelectionEditingBehavior.cs
- ExcCanonicalXml.cs
- SmiRecordBuffer.cs
- ContainerParaClient.cs
- BamlBinaryReader.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- DataBindEngine.cs
- DesignerValidationSummaryAdapter.cs
- CompiledQueryCacheEntry.cs
- DefaultProxySection.cs
- XmlHierarchyData.cs
- QueryCoreOp.cs
- BuildProvidersCompiler.cs
- AppPool.cs
- RectKeyFrameCollection.cs
- AnonymousIdentificationModule.cs
- TextSelectionProcessor.cs
- SessionSwitchEventArgs.cs
- Comparer.cs
- mda.cs
- AnnotationObservableCollection.cs
- KeyFrames.cs
- NetworkCredential.cs
- PointAnimationUsingKeyFrames.cs
- GC.cs
- AnnotationResourceChangedEventArgs.cs
- PageRanges.cs
- Compensate.cs
- SR.cs
- XmlSerializationGeneratedCode.cs
- SubMenuStyleCollection.cs
- Rotation3D.cs
- ImageAnimator.cs
- KeyedHashAlgorithm.cs
- SqlExpander.cs
- StoreItemCollection.cs
- COM2ICategorizePropertiesHandler.cs
- SizeAnimationBase.cs
- GridViewCancelEditEventArgs.cs
- FixUpCollection.cs
- XmlSerializationGeneratedCode.cs
- SafeFileMappingHandle.cs
- SystemWebCachingSectionGroup.cs
- AliasedSlot.cs
- LogEntryHeaderSerializer.cs
- dbenumerator.cs
- PathSegment.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- CustomAttributeBuilder.cs
- DataListItem.cs
- ControlBuilder.cs
- DesignerVerbCollection.cs
- DateTimeSerializationSection.cs
- X509Extension.cs
- _NTAuthentication.cs
- ServiceNameElementCollection.cs
- WebPartConnection.cs
- DbConnectionPool.cs
- StoreItemCollection.cs
- OleDbPropertySetGuid.cs
- SHA512Cng.cs
- HtmlInputFile.cs
- SqlTrackingWorkflowInstance.cs
- DataDocumentXPathNavigator.cs
- ToolBarPanel.cs
- WindowsFont.cs
- ElementInit.cs
- PropertyIdentifier.cs
- XmlnsDictionary.cs
- ImmutableClientRuntime.cs
- AccessDataSourceView.cs
- RangeValuePattern.cs
- ConfigurationManager.cs
- DurableRuntimeValidator.cs
- PersonalizationStateInfo.cs
- SharedPersonalizationStateInfo.cs
- ProxyAttribute.cs
- NetworkInformationPermission.cs
- InputScope.cs
- exports.cs
- NumericUpDown.cs
- MediaPlayer.cs
- DataGridViewCellStyle.cs
- TabControlCancelEvent.cs
- ExtractorMetadata.cs
- EventHandlers.cs
- SoapInteropTypes.cs
- LinqDataSourceInsertEventArgs.cs
- SpecialFolderEnumConverter.cs
- FormsIdentity.cs