Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Common / internal / materialization / shaperfactory.cs / 1 / 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
- DataFieldCollectionEditor.cs
- AppSettingsReader.cs
- Debug.cs
- LeaseManager.cs
- WebBrowsableAttribute.cs
- _TLSstream.cs
- TableParagraph.cs
- ToolStripLabel.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- ObjectAssociationEndMapping.cs
- GetResponse.cs
- ImageAutomationPeer.cs
- TemplateControlCodeDomTreeGenerator.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- Normalization.cs
- XmlQueryTypeFactory.cs
- PointF.cs
- FormViewPagerRow.cs
- GridViewRowPresenterBase.cs
- RowType.cs
- Point3D.cs
- XmlElement.cs
- XmlRawWriterWrapper.cs
- BindingGroup.cs
- DynamicILGenerator.cs
- FixedSOMLineRanges.cs
- DynamicMetaObjectBinder.cs
- MenuItem.cs
- StaticTextPointer.cs
- Viewport3DVisual.cs
- ExceptionUtil.cs
- LogicalExpr.cs
- UnsafeNativeMethods.cs
- StylusPlugInCollection.cs
- WindowsIdentity.cs
- CommentEmitter.cs
- CookieParameter.cs
- RegionIterator.cs
- ShimAsPublicXamlType.cs
- TextBlock.cs
- _ShellExpression.cs
- TemplatedEditableDesignerRegion.cs
- ExpressionParser.cs
- TextElementCollectionHelper.cs
- ViewBox.cs
- XmlLoader.cs
- RowToFieldTransformer.cs
- SqlGatherConsumedAliases.cs
- TextTreeRootNode.cs
- ColorMatrix.cs
- Frame.cs
- ThreadExceptionDialog.cs
- ManagedFilter.cs
- ChildChangedEventArgs.cs
- unitconverter.cs
- SchemaNamespaceManager.cs
- TypeUsageBuilder.cs
- AggregateNode.cs
- WebPartConnectionsDisconnectVerb.cs
- ExceptionHelpers.cs
- ProtectedConfiguration.cs
- WmpBitmapEncoder.cs
- CryptoKeySecurity.cs
- PropertyMetadata.cs
- IndentTextWriter.cs
- ConfigDefinitionUpdates.cs
- ImageListUtils.cs
- FileNameEditor.cs
- NetworkInformationPermission.cs
- CompilerGlobalScopeAttribute.cs
- PageSetupDialog.cs
- CLRBindingWorker.cs
- DiscoveryExceptionDictionary.cs
- Types.cs
- XPathParser.cs
- TimeSpan.cs
- EncoderReplacementFallback.cs
- QilCloneVisitor.cs
- JsonFormatReaderGenerator.cs
- SQLInt16.cs
- Underline.cs
- PopupEventArgs.cs
- DbException.cs
- TextSelection.cs
- BamlResourceDeserializer.cs
- InternalMappingException.cs
- SchemaNamespaceManager.cs
- SyndicationSerializer.cs
- BlurEffect.cs
- Attributes.cs
- DynamicObjectAccessor.cs
- RedBlackList.cs
- Method.cs
- PasswordDeriveBytes.cs
- SafeFileMappingHandle.cs
- TypeBuilderInstantiation.cs
- QuaternionAnimationUsingKeyFrames.cs
- TypeReference.cs
- RequestResizeEvent.cs
- Environment.cs