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
- PublisherIdentityPermission.cs
- TreeWalkHelper.cs
- CompositeTypefaceMetrics.cs
- BooleanToVisibilityConverter.cs
- LinkAreaEditor.cs
- DoubleStorage.cs
- WebControl.cs
- ToolStripPanelCell.cs
- QueryReaderSettings.cs
- Delegate.cs
- TableMethodGenerator.cs
- SecondaryIndex.cs
- SafeLocalMemHandle.cs
- TransformDescriptor.cs
- ActiveXHost.cs
- StorageEntityContainerMapping.cs
- XmlResolver.cs
- FileUtil.cs
- CodeIterationStatement.cs
- UserControl.cs
- DataServiceQueryOfT.cs
- DataServiceProviderWrapper.cs
- TraceUtility.cs
- AbsoluteQuery.cs
- DelimitedListTraceListener.cs
- XmlReturnReader.cs
- RangeContentEnumerator.cs
- SamlSerializer.cs
- _UriTypeConverter.cs
- InvokeWebServiceDesigner.cs
- DeferredTextReference.cs
- LongValidator.cs
- ClassImporter.cs
- SmtpDigestAuthenticationModule.cs
- XmlChoiceIdentifierAttribute.cs
- ScrollProperties.cs
- PieceDirectory.cs
- AssemblyName.cs
- ReadOnlyDictionary.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- ThreadAbortException.cs
- HostProtectionException.cs
- SoapAttributeAttribute.cs
- CacheHelper.cs
- DataMemberFieldConverter.cs
- HostingPreferredMapPath.cs
- TimelineGroup.cs
- EncoderReplacementFallback.cs
- ExpressionBindings.cs
- SqlClientFactory.cs
- DbUpdateCommandTree.cs
- BrowserDefinition.cs
- DataGridViewCellMouseEventArgs.cs
- CompositionAdorner.cs
- DrawListViewColumnHeaderEventArgs.cs
- PolygonHotSpot.cs
- GridViewUpdateEventArgs.cs
- ToolbarAUtomationPeer.cs
- PartDesigner.cs
- SerialErrors.cs
- EventWaitHandleSecurity.cs
- MdbDataFileEditor.cs
- SkipStoryboardToFill.cs
- FilePrompt.cs
- WorkflowApplicationAbortedException.cs
- ConfigXmlText.cs
- MaskDescriptor.cs
- BufferAllocator.cs
- Attachment.cs
- EdmType.cs
- PassportIdentity.cs
- FixedFlowMap.cs
- ConsoleEntryPoint.cs
- XmlQualifiedName.cs
- EpmHelper.cs
- OrderedDictionary.cs
- DataGridViewAutoSizeModeEventArgs.cs
- DictionaryBase.cs
- InlineCollection.cs
- _PooledStream.cs
- AsmxEndpointPickerExtension.cs
- SettingsPropertyCollection.cs
- BackgroundWorker.cs
- Size.cs
- UseAttributeSetsAction.cs
- CodeTypeConstructor.cs
- CodeTypeReferenceExpression.cs
- XmlTextReader.cs
- Point3DAnimation.cs
- XmlSerializationGeneratedCode.cs
- PartialCachingAttribute.cs
- ToolStripDropTargetManager.cs
- SegmentInfo.cs
- CultureInfoConverter.cs
- ForeignConstraint.cs
- PenThread.cs
- HierarchicalDataSourceControl.cs
- KnownTypeAttribute.cs
- SessionIDManager.cs
- SqlTransaction.cs