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
- DataObjectFieldAttribute.cs
- ToolboxItemSnapLineBehavior.cs
- StringToken.cs
- ConfigPathUtility.cs
- Avt.cs
- AcceleratedTokenProvider.cs
- TableLayoutSettings.cs
- ListBoxItemWrapperAutomationPeer.cs
- FileChangesMonitor.cs
- InputElement.cs
- MobileSysDescriptionAttribute.cs
- MediaSystem.cs
- StatusBarPanelClickEvent.cs
- SuppressMergeCheckAttribute.cs
- IdentityModelStringsVersion1.cs
- PtsPage.cs
- SafeArrayRankMismatchException.cs
- WaitHandleCannotBeOpenedException.cs
- ToolStripDropDownButton.cs
- WindowsSecurityToken.cs
- SqlServices.cs
- LoginViewDesigner.cs
- SelectionPatternIdentifiers.cs
- DesignerForm.cs
- PrivateFontCollection.cs
- BindingManagerDataErrorEventArgs.cs
- PresentationTraceSources.cs
- TableAdapterManagerMethodGenerator.cs
- TraversalRequest.cs
- ScriptResourceHandler.cs
- CalendarButton.cs
- AccessKeyManager.cs
- DmlSqlGenerator.cs
- BrowserInteropHelper.cs
- DrawingBrush.cs
- XmlNodeWriter.cs
- MasterPage.cs
- ObjectDataSourceFilteringEventArgs.cs
- CodeDirectoryCompiler.cs
- CompilationLock.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- CryptoKeySecurity.cs
- IOThreadScheduler.cs
- ResourcePermissionBase.cs
- VisualStyleInformation.cs
- StaticTextPointer.cs
- AsyncStreamReader.cs
- BaseServiceProvider.cs
- CssTextWriter.cs
- ConvertBinder.cs
- ActivityBuilderHelper.cs
- RijndaelManagedTransform.cs
- Timer.cs
- Light.cs
- SignalGate.cs
- MonthChangedEventArgs.cs
- SqlTypesSchemaImporter.cs
- AncestorChangedEventArgs.cs
- SystemEvents.cs
- TcpTransportManager.cs
- SymbolMethod.cs
- ImmComposition.cs
- _ConnectionGroup.cs
- Native.cs
- EditorZone.cs
- MethodExecutor.cs
- OleCmdHelper.cs
- SingleAnimationBase.cs
- XmlSerializationReader.cs
- HyperLinkStyle.cs
- DynamicResourceExtension.cs
- ContainerSelectorActiveEvent.cs
- BindingBase.cs
- IisTraceListener.cs
- X509KeyIdentifierClauseType.cs
- NavigationService.cs
- IntSecurity.cs
- Comparer.cs
- WebPartDisplayModeEventArgs.cs
- EntitySqlQueryCacheEntry.cs
- UriTemplate.cs
- EventDescriptorCollection.cs
- AutomationPropertyInfo.cs
- HtmlInputHidden.cs
- Vector3D.cs
- TextTreeTextBlock.cs
- Helpers.cs
- XXXOnTypeBuilderInstantiation.cs
- PagedDataSource.cs
- PolygonHotSpot.cs
- DataTable.cs
- GridViewCommandEventArgs.cs
- WithStatement.cs
- ToolStripOverflowButton.cs
- _Win32.cs
- DesignerAutoFormat.cs
- RawStylusInputCustomData.cs
- Constraint.cs
- WebEventTraceProvider.cs
- LinqDataSourceStatusEventArgs.cs