Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Server / System / Data / Services / Caching / MetadataCacheItem.cs / 2 / MetadataCacheItem.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a class to cache metadata information.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Caching
{
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Data.Services.Providers;
/// Use this class to cache metadata for providers.
internal class MetadataCacheItem
{
#region Private fields.
/// list of top level entity sets
private readonly Dictionary entitySets;
/// Collection of service operations, keyed by name.
private readonly Dictionary serviceOperations;
/// Target type for the data provider.
private readonly Type type;
/// Cache of resource properties per type.
private readonly Dictionary typeCache;
/// Service configuration information.
private DataServiceConfiguration configuration;
/// If the metadata is compliant with the edm schema v1.0 other false, indicating that we need to use 1.1 schema
/// 1> Edm Schema 1.0 FunctionImport returns only collection of scalars or collection of entities
private bool edmVersion1Schema = true;
#endregion Private fields.
/// Initializes a new instance.
/// Type of data context for which metadata will be generated.
internal MetadataCacheItem(Type type)
{
Debug.Assert(type != null, "type != null");
this.serviceOperations = new Dictionary();
this.typeCache = new Dictionary();
this.entitySets = new Dictionary();
this.type = type;
}
#region Properties.
/// Service configuration information.
internal DataServiceConfiguration Configuration
{
[DebuggerStepThrough]
get
{
return this.configuration;
}
set
{
Debug.Assert(value != null, "value != null");
Debug.Assert(this.configuration == null, "this.configuration == null -- otherwise it's being set more than once");
this.configuration = value;
}
}
/// Collection of service operations, keyed by name.
internal Dictionary ServiceOperations
{
[DebuggerStepThrough]
get { return this.serviceOperations; }
}
/// Cache of resource properties per type.
internal Dictionary TypeCache
{
[DebuggerStepThrough]
get { return this.typeCache; }
}
/// list of top level entity sets
internal Dictionary EntitySets
{
[DebuggerStepThrough]
get { return this.entitySets; }
}
/// Target type for the data provider.
internal Type Type
{
[DebuggerStepThrough]
get { return this.type; }
}
/// Returns true if the metadata adheres to edm v1 constraints otherwise returns false.
internal bool EdmVersion1Schema
{
get { return this.edmVersion1Schema; }
set { this.edmVersion1Schema = value; }
}
#endregion Properties.
/// Seals this item instance and prevents further changes.
///
/// This method should be called after the configuration has been set up and before it's placed on the
/// metadata cache for sharing.
///
internal void Seal()
{
this.configuration.Seal();
foreach (ResourceType t in this.typeCache.Values)
{
t.TrimExcess();
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a class to cache metadata information.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Caching
{
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Data.Services.Providers;
/// Use this class to cache metadata for providers.
internal class MetadataCacheItem
{
#region Private fields.
/// list of top level entity sets
private readonly Dictionary entitySets;
/// Collection of service operations, keyed by name.
private readonly Dictionary serviceOperations;
/// Target type for the data provider.
private readonly Type type;
/// Cache of resource properties per type.
private readonly Dictionary typeCache;
/// Service configuration information.
private DataServiceConfiguration configuration;
/// If the metadata is compliant with the edm schema v1.0 other false, indicating that we need to use 1.1 schema
/// 1> Edm Schema 1.0 FunctionImport returns only collection of scalars or collection of entities
private bool edmVersion1Schema = true;
#endregion Private fields.
/// Initializes a new instance.
/// Type of data context for which metadata will be generated.
internal MetadataCacheItem(Type type)
{
Debug.Assert(type != null, "type != null");
this.serviceOperations = new Dictionary();
this.typeCache = new Dictionary();
this.entitySets = new Dictionary();
this.type = type;
}
#region Properties.
/// Service configuration information.
internal DataServiceConfiguration Configuration
{
[DebuggerStepThrough]
get
{
return this.configuration;
}
set
{
Debug.Assert(value != null, "value != null");
Debug.Assert(this.configuration == null, "this.configuration == null -- otherwise it's being set more than once");
this.configuration = value;
}
}
/// Collection of service operations, keyed by name.
internal Dictionary ServiceOperations
{
[DebuggerStepThrough]
get { return this.serviceOperations; }
}
/// Cache of resource properties per type.
internal Dictionary TypeCache
{
[DebuggerStepThrough]
get { return this.typeCache; }
}
/// list of top level entity sets
internal Dictionary EntitySets
{
[DebuggerStepThrough]
get { return this.entitySets; }
}
/// Target type for the data provider.
internal Type Type
{
[DebuggerStepThrough]
get { return this.type; }
}
/// Returns true if the metadata adheres to edm v1 constraints otherwise returns false.
internal bool EdmVersion1Schema
{
get { return this.edmVersion1Schema; }
set { this.edmVersion1Schema = value; }
}
#endregion Properties.
/// Seals this item instance and prevents further changes.
///
/// This method should be called after the configuration has been set up and before it's placed on the
/// metadata cache for sharing.
///
internal void Seal()
{
this.configuration.Seal();
foreach (ResourceType t in this.typeCache.Values)
{
t.TrimExcess();
}
}
}
}
// 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
- _NetRes.cs
- AssemblyAttributes.cs
- RelationshipEndCollection.cs
- ResourceReferenceExpression.cs
- TrackingMemoryStreamFactory.cs
- CircleHotSpot.cs
- TrustLevel.cs
- FileRecordSequenceHelper.cs
- FixedTextView.cs
- ProcessThread.cs
- InvalidOperationException.cs
- Deflater.cs
- InlinedAggregationOperatorEnumerator.cs
- ProxyManager.cs
- ScrollBar.cs
- TextServicesProperty.cs
- sortedlist.cs
- ProfileBuildProvider.cs
- WebPartCatalogCloseVerb.cs
- SymbolPair.cs
- ProxySimple.cs
- MsmqProcessProtocolHandler.cs
- UrlMappingsModule.cs
- SynchronizationContext.cs
- SqlDataSourceEnumerator.cs
- UrlMappingsSection.cs
- KeysConverter.cs
- InternalRelationshipCollection.cs
- ChineseLunisolarCalendar.cs
- DaylightTime.cs
- RenamedEventArgs.cs
- TypeInitializationException.cs
- DecimalConstantAttribute.cs
- CodeStatementCollection.cs
- ManagementOptions.cs
- QueryException.cs
- GridViewItemAutomationPeer.cs
- RecognitionResult.cs
- XmlNodeReader.cs
- HelpEvent.cs
- TableLayoutCellPaintEventArgs.cs
- DocumentDesigner.cs
- AudioLevelUpdatedEventArgs.cs
- UpDownEvent.cs
- SafeIUnknown.cs
- XpsSerializationManagerAsync.cs
- ExternalException.cs
- DBSqlParserColumn.cs
- StrokeSerializer.cs
- DataServiceQueryOfT.cs
- DelegatingTypeDescriptionProvider.cs
- MSAAEventDispatcher.cs
- MarshalByRefObject.cs
- ObjectNotFoundException.cs
- EventLogEntryCollection.cs
- FixedFlowMap.cs
- ActivityDesignerAccessibleObject.cs
- UmAlQuraCalendar.cs
- OleDbError.cs
- ToolStripPanelDesigner.cs
- TrackingProfile.cs
- EntityDataSourceChangingEventArgs.cs
- ExtenderProvidedPropertyAttribute.cs
- AppDomainFactory.cs
- PictureBox.cs
- UnsafeNetInfoNativeMethods.cs
- DataGridColumnEventArgs.cs
- BindingExpressionBase.cs
- EntityDataSourceDataSelection.cs
- DeobfuscatingStream.cs
- EdmConstants.cs
- FormViewInsertedEventArgs.cs
- MSAANativeProvider.cs
- MouseDevice.cs
- DataServiceProcessingPipelineEventArgs.cs
- DataRecordInternal.cs
- GeometryValueSerializer.cs
- MessageBuilder.cs
- _FixedSizeReader.cs
- MeshGeometry3D.cs
- PartManifestEntry.cs
- MethodSignatureGenerator.cs
- columnmapfactory.cs
- QilName.cs
- tooltip.cs
- XmlSchemaSimpleContent.cs
- FactoryId.cs
- SmtpFailedRecipientsException.cs
- Typeface.cs
- XmlDocumentSerializer.cs
- TableLayoutRowStyleCollection.cs
- ShaderEffect.cs
- HighContrastHelper.cs
- HttpCachePolicyWrapper.cs
- MutexSecurity.cs
- XmlNamespaceManager.cs
- DependencyPropertyChangedEventArgs.cs
- ThreadInterruptedException.cs
- PreDigestedSignedInfo.cs
- _UriTypeConverter.cs