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
- UniqueIdentifierService.cs
- QueryParameter.cs
- ListBindingConverter.cs
- SequentialUshortCollection.cs
- HttpHandlerAction.cs
- ACE.cs
- RowParagraph.cs
- SafeReversePInvokeHandle.cs
- HideDisabledControlAdapter.cs
- SelectionRangeConverter.cs
- Pens.cs
- MetadataHelper.cs
- PageSettings.cs
- PathGradientBrush.cs
- SourceElementsCollection.cs
- EntityCommandExecutionException.cs
- TransformPatternIdentifiers.cs
- DataFieldEditor.cs
- tooltip.cs
- SimpleBitVector32.cs
- WebConfigurationHost.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- Range.cs
- GenericRootAutomationPeer.cs
- ConfigsHelper.cs
- AxisAngleRotation3D.cs
- LookupBindingPropertiesAttribute.cs
- AspNetSynchronizationContext.cs
- PropertyDescriptorCollection.cs
- WebPartsSection.cs
- SqlDataReaderSmi.cs
- ActivationWorker.cs
- NonParentingControl.cs
- MimeObjectFactory.cs
- TemplateInstanceAttribute.cs
- ProxyAttribute.cs
- WebResourceAttribute.cs
- DbExpressionVisitor.cs
- COSERVERINFO.cs
- BrowserCapabilitiesCodeGenerator.cs
- IconConverter.cs
- DataGridCell.cs
- datacache.cs
- Event.cs
- IProvider.cs
- ResourceAttributes.cs
- NamedElement.cs
- ValidatorAttribute.cs
- WebPartZone.cs
- FrameworkElement.cs
- GeometryDrawing.cs
- CustomCategoryAttribute.cs
- WebConfigurationHostFileChange.cs
- SqlVisitor.cs
- NamedPermissionSet.cs
- keycontainerpermission.cs
- TemplateBindingExpressionConverter.cs
- DesignerEventService.cs
- SQLDouble.cs
- XmlSchemaException.cs
- PartitionResolver.cs
- ValueQuery.cs
- DecoderBestFitFallback.cs
- ModulesEntry.cs
- DrawListViewItemEventArgs.cs
- UriTemplateMatch.cs
- Policy.cs
- NamespaceListProperty.cs
- ChangePasswordAutoFormat.cs
- ScriptResourceInfo.cs
- ComponentEditorPage.cs
- GuidelineCollection.cs
- ItemChangedEventArgs.cs
- BitArray.cs
- WindowsFormsSectionHandler.cs
- ASCIIEncoding.cs
- NativeMethods.cs
- EntityTypeEmitter.cs
- ExecutionContext.cs
- SafeHandles.cs
- RuntimeConfig.cs
- IncrementalHitTester.cs
- Quad.cs
- ThreadNeutralSemaphore.cs
- ScanQueryOperator.cs
- TextCompositionManager.cs
- CommandSet.cs
- ElementAction.cs
- TableLayoutPanelResizeGlyph.cs
- _ConnectOverlappedAsyncResult.cs
- DoubleUtil.cs
- SerializationAttributes.cs
- AuthorizationRule.cs
- BeginGetFileNameFromUserRequest.cs
- Repeater.cs
- DetailsViewInsertedEventArgs.cs
- Listener.cs
- CodeDefaultValueExpression.cs
- EntityDataSource.cs
- DataServiceHost.cs