Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Common / internal / materialization / shaperfactory.cs / 3 / shaperfactory.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System.Data.Common.QueryCache; using System.Data.Metadata.Edm; using System.Data.Objects; using System.Data.Objects.Internal; using System.Data.Query.InternalTrees; using System.Diagnostics; namespace System.Data.Common.Internal.Materialization { ////// An immutable type used to generate Shaper instances. /// internal abstract class ShaperFactory { internal static ShaperFactory Create(Type elementType, QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer) { ShaperFactoryCreator creator = (ShaperFactoryCreator)Activator.CreateInstance(typeof(TypedShaperFactoryCreator<>).MakeGenericType(elementType)); return creator.TypedCreate(cacheManager, columnMap, metadata, spanInfo, mergeOption, valueLayer); } private abstract class ShaperFactoryCreator { internal abstract ShaperFactory TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer); } private sealed class TypedShaperFactoryCreator: ShaperFactoryCreator { public TypedShaperFactoryCreator() {} internal override ShaperFactory TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer) { return Translator.TranslateColumnMap (cacheManager, columnMap, metadata, spanInfo, mergeOption, valueLayer); } } } /// /// Typed ShaperFactory /// internal class ShaperFactory: ShaperFactory { private readonly int _stateCount; private readonly CoordinatorFactory _rootCoordinatorFactory; private readonly Action _checkPermissions; private readonly MergeOption _mergeOption; internal ShaperFactory(int stateCount, CoordinatorFactory rootCoordinatorFactory, Action checkPermissions, MergeOption mergeOption) { _stateCount = stateCount; _rootCoordinatorFactory = rootCoordinatorFactory; _checkPermissions = checkPermissions; _mergeOption = mergeOption; } /// /// Factory method to create the Shaper for Object Layer queries. /// internal ShaperCreate(DbDataReader reader, ObjectContext context, MetadataWorkspace workspace, MergeOption mergeOption) { Debug.Assert(mergeOption == _mergeOption, "executing a query with a different mergeOption than was used to compile the delegate"); return new Shaper (reader, context, workspace, mergeOption, _stateCount, _rootCoordinatorFactory, _checkPermissions); } /// /// Factory method to create the Shaper for Value Layer queries. /// internal ShaperCreate(DbDataReader reader, MetadataWorkspace workspace) { Debug.Assert(MergeOption.NoTracking == _mergeOption, "executing a query with a different mergeOption than was used to compile the delegate"); return new Shaper (reader, null, workspace, MergeOption.NoTracking, _stateCount, _rootCoordinatorFactory, _checkPermissions); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System.Data.Common.QueryCache; using System.Data.Metadata.Edm; using System.Data.Objects; using System.Data.Objects.Internal; using System.Data.Query.InternalTrees; using System.Diagnostics; namespace System.Data.Common.Internal.Materialization { ////// An immutable type used to generate Shaper instances. /// internal abstract class ShaperFactory { internal static ShaperFactory Create(Type elementType, QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer) { ShaperFactoryCreator creator = (ShaperFactoryCreator)Activator.CreateInstance(typeof(TypedShaperFactoryCreator<>).MakeGenericType(elementType)); return creator.TypedCreate(cacheManager, columnMap, metadata, spanInfo, mergeOption, valueLayer); } private abstract class ShaperFactoryCreator { internal abstract ShaperFactory TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer); } private sealed class TypedShaperFactoryCreator: ShaperFactoryCreator { public TypedShaperFactoryCreator() {} internal override ShaperFactory TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer) { return Translator.TranslateColumnMap (cacheManager, columnMap, metadata, spanInfo, mergeOption, valueLayer); } } } /// /// Typed ShaperFactory /// internal class ShaperFactory: ShaperFactory { private readonly int _stateCount; private readonly CoordinatorFactory _rootCoordinatorFactory; private readonly Action _checkPermissions; private readonly MergeOption _mergeOption; internal ShaperFactory(int stateCount, CoordinatorFactory rootCoordinatorFactory, Action checkPermissions, MergeOption mergeOption) { _stateCount = stateCount; _rootCoordinatorFactory = rootCoordinatorFactory; _checkPermissions = checkPermissions; _mergeOption = mergeOption; } /// /// Factory method to create the Shaper for Object Layer queries. /// internal ShaperCreate(DbDataReader reader, ObjectContext context, MetadataWorkspace workspace, MergeOption mergeOption) { Debug.Assert(mergeOption == _mergeOption, "executing a query with a different mergeOption than was used to compile the delegate"); return new Shaper (reader, context, workspace, mergeOption, _stateCount, _rootCoordinatorFactory, _checkPermissions); } /// /// Factory method to create the Shaper for Value Layer queries. /// internal ShaperCreate(DbDataReader reader, MetadataWorkspace workspace) { Debug.Assert(MergeOption.NoTracking == _mergeOption, "executing a query with a different mergeOption than was used to compile the delegate"); return new Shaper (reader, null, workspace, MergeOption.NoTracking, _stateCount, _rootCoordinatorFactory, _checkPermissions); } } } // 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
- SafeRegistryHandle.cs
- AutoResizedEvent.cs
- CopyOnWriteList.cs
- ColorKeyFrameCollection.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- Timer.cs
- HitTestFilterBehavior.cs
- GraphicsPathIterator.cs
- AppDomainProtocolHandler.cs
- CompilerErrorCollection.cs
- EncryptedReference.cs
- Unit.cs
- ImageKeyConverter.cs
- unitconverter.cs
- WebPartConnectionsEventArgs.cs
- RecommendedAsConfigurableAttribute.cs
- ResourceExpression.cs
- DetailsViewUpdatedEventArgs.cs
- GeneralTransform3D.cs
- PackageFilter.cs
- ControlBuilderAttribute.cs
- Attachment.cs
- SafeLocalMemHandle.cs
- DateTime.cs
- IdentityValidationException.cs
- TextElementEditingBehaviorAttribute.cs
- NetTcpSection.cs
- WebBrowsableAttribute.cs
- PageHandlerFactory.cs
- HttpCachePolicyElement.cs
- UInt64Storage.cs
- MSAAWinEventWrap.cs
- IIS7WorkerRequest.cs
- HtmlImage.cs
- XPathMultyIterator.cs
- GridViewCommandEventArgs.cs
- EnvelopedSignatureTransform.cs
- XmlSchemaObject.cs
- ItemCollection.cs
- AttachedPropertyDescriptor.cs
- PageHandlerFactory.cs
- OpenTypeLayoutCache.cs
- RunClient.cs
- columnmapkeybuilder.cs
- Rect3DValueSerializer.cs
- HtmlElementErrorEventArgs.cs
- URLString.cs
- AddressHeader.cs
- XmlSerializerAssemblyAttribute.cs
- Util.cs
- BinaryUtilClasses.cs
- XmlILAnnotation.cs
- GeneralTransformCollection.cs
- WeakReferenceList.cs
- ClaimTypes.cs
- SafeRightsManagementSessionHandle.cs
- PrinterUnitConvert.cs
- PixelFormatConverter.cs
- CategoryGridEntry.cs
- AppModelKnownContentFactory.cs
- HtmlValidatorAdapter.cs
- TimeSpanOrInfiniteConverter.cs
- Normalization.cs
- XmlArrayAttribute.cs
- ToolTipAutomationPeer.cs
- TargetInvocationException.cs
- MethodAccessException.cs
- XhtmlBasicImageAdapter.cs
- IOThreadTimer.cs
- SerialPort.cs
- IndentTextWriter.cs
- WebPartZone.cs
- Baml2006ReaderContext.cs
- DbInsertCommandTree.cs
- GACIdentityPermission.cs
- StatusBarPanelClickEvent.cs
- StringConverter.cs
- CultureInfoConverter.cs
- DataGridViewMethods.cs
- SweepDirectionValidation.cs
- AssemblyCache.cs
- WebPartUserCapability.cs
- ReadOnlyDictionary.cs
- AutomationEventArgs.cs
- CompositeDesignerAccessibleObject.cs
- ToolStripItemTextRenderEventArgs.cs
- ObjectNotFoundException.cs
- TimeSpanSecondsConverter.cs
- MLangCodePageEncoding.cs
- arabicshape.cs
- ReadOnlyCollectionBase.cs
- AlgoModule.cs
- PrintingPermission.cs
- WebConfigurationManager.cs
- TypeConverterHelper.cs
- XmlSchemaAttribute.cs
- WebConvert.cs
- RemoteWebConfigurationHostStream.cs
- XPathNavigatorReader.cs
- SearchForVirtualItemEventArgs.cs