Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / internal / materialization / shaperfactory.cs / 1599186 / 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; using System.Runtime.CompilerServices; namespace System.Data.Common.Internal.Materialization { ////// An immutable type used to generate Shaper instances. /// internal abstract class ShaperFactory { [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] 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, bool readerOwned) { 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, readerOwned); } } } // 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; using System.Runtime.CompilerServices; namespace System.Data.Common.Internal.Materialization { ////// An immutable type used to generate Shaper instances. /// internal abstract class ShaperFactory { [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] 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, bool readerOwned) { 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, readerOwned); } } } // 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
- RequestCache.cs
- CompositeKey.cs
- Matrix3DValueSerializer.cs
- _BasicClient.cs
- ADConnectionHelper.cs
- XmlHelper.cs
- XXXOnTypeBuilderInstantiation.cs
- DataGridCaption.cs
- SubMenuStyle.cs
- SqlDataSource.cs
- ErrorLog.cs
- DataFieldConverter.cs
- MultiPropertyDescriptorGridEntry.cs
- WaveHeader.cs
- XamlInt32CollectionSerializer.cs
- DbConnectionClosed.cs
- Renderer.cs
- GZipDecoder.cs
- DataServiceConfiguration.cs
- ToolStripProgressBar.cs
- InlineCollection.cs
- Compiler.cs
- IpcManager.cs
- CuspData.cs
- RequestNavigateEventArgs.cs
- TextElement.cs
- ToolbarAUtomationPeer.cs
- AdRotator.cs
- ReferenceConverter.cs
- CookielessHelper.cs
- Repeater.cs
- EventLogHandle.cs
- UnsafePeerToPeerMethods.cs
- DynamicRouteExpression.cs
- BaseParagraph.cs
- TextElementCollectionHelper.cs
- PassportAuthenticationModule.cs
- AssociationType.cs
- UseAttributeSetsAction.cs
- SymmetricSecurityProtocol.cs
- IsolatedStorageFileStream.cs
- VScrollBar.cs
- MetadataItemEmitter.cs
- AssemblyBuilder.cs
- WebBrowserEvent.cs
- COSERVERINFO.cs
- CodeAccessPermission.cs
- ToolStripContentPanelRenderEventArgs.cs
- ForeignConstraint.cs
- DataGridViewSelectedCellCollection.cs
- MemberJoinTreeNode.cs
- TemplatingOptionsDialog.cs
- DateTimeFormatInfoScanner.cs
- JavaScriptSerializer.cs
- AttachedPropertyInfo.cs
- NameTable.cs
- ExpressionEditorAttribute.cs
- ZipPackagePart.cs
- ClientSideProviderDescription.cs
- AddInController.cs
- ResourceReferenceKeyNotFoundException.cs
- AuditLogLocation.cs
- ExceptionHandlersDesigner.cs
- AssemblyBuilder.cs
- Automation.cs
- BaseParser.cs
- MatchingStyle.cs
- Parser.cs
- VerificationException.cs
- EntityException.cs
- RadioButtonFlatAdapter.cs
- XmlDataDocument.cs
- CompilerGlobalScopeAttribute.cs
- XmlSerializationWriter.cs
- AnnotationService.cs
- NetCodeGroup.cs
- AspProxy.cs
- ProxyWebPartConnectionCollection.cs
- NavigatorOutput.cs
- SymbolTable.cs
- EmptyEnumerator.cs
- Suspend.cs
- DBConcurrencyException.cs
- DrawingBrush.cs
- WeakReferenceEnumerator.cs
- ExpressionLexer.cs
- CSharpCodeProvider.cs
- SchemaDeclBase.cs
- EntityDataSourceState.cs
- VisualBasicReference.cs
- _HelperAsyncResults.cs
- Header.cs
- RootDesignerSerializerAttribute.cs
- DocumentPageView.cs
- BitmapEffectrendercontext.cs
- ComAdminWrapper.cs
- IntMinMaxAggregationOperator.cs
- OdbcConnectionPoolProviderInfo.cs
- SqlRowUpdatedEvent.cs
- SourceFileInfo.cs