Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Mapping / StorageSetMapping.cs / 1305376 / StorageSetMapping.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Data.Metadata.Edm;
using System.Data.Common.Utils;
using System.Diagnostics;
using System.Linq;
namespace System.Data.Mapping {
using Triple = Pair>;
///
/// Represents the Mapping metadata for an Extent in ES space.
///
///
/// For Example if conceptually you could represent the ES MSL file as following
/// --Mapping
/// --EntityContainerMapping ( CNorthwind-->SNorthwind )
/// --EntitySetMapping
/// --EntityTypeMapping
/// --TableMappingFragment
/// --EntityTypeMapping
/// --TableMappingFragment
/// --AssociationSetMapping
/// --AssociationTypeMapping
/// --TableMappingFragment
/// --EntityContainerMapping ( CMyDatabase-->SMyDatabase )
/// --CompositionSetMapping
/// --CompositionTypeMapping
/// This class represents the metadata for all the extent map elements in the
/// above example namely EntitySetMapping, AssociationSetMapping and CompositionSetMapping.
/// The SetMapping elements that are children of the EntityContainerMapping element
/// can be accessed through the properties on this type.
///
internal abstract class StorageSetMapping
{
#region Constructors
///
/// Construct the new ExtentMapping object.
///
/// Extent metadata object
/// The EntityContainer mapping that contains this extent mapping
internal StorageSetMapping(EntitySetBase extent, StorageEntityContainerMapping entityContainerMapping) {
this.m_entityContainerMapping = entityContainerMapping;
this.m_extent = extent;
this.m_typeMappings = new List();
}
#endregion
#region Fields
private StorageEntityContainerMapping m_entityContainerMapping; //The EntityContainer mapping that contains this extent mapping
private EntitySetBase m_extent; //The extent for which this mapping represents.
private List m_typeMappings; //Set of type mappings that make up the Set Mapping
//Unless this is a EntitySetMapping with inheritance,
//you would have a single type mapping per set
private string m_queryView; //User defined Query View for the EntitySet
private int m_startLineNumber; //Line Number for Set Mapping element start tag
private int m_startLinePosition; //Line position for Set Mapping element start tag
private bool m_hasModificationFunctionMapping; // has modificationfunctionmapping for set mapping
//Stores type-Specific user-defined QueryViews
private Dictionary m_typeSpecificQueryViews =
new Dictionary(Triple.PairComparer.Instance);
#endregion
#region Properties
///
/// The set for which this mapping is for
///
internal EntitySetBase Set
{
get {
return this.m_extent;
}
}
/////
///// TypeMappings that make up this set type.
///// For AssociationSet and CompositionSet there will be one type( atleast thats what
///// we expect as of now). EntitySet could have mappings for multiple Entity types.
/////
internal ReadOnlyCollection TypeMappings
{
get
{
return this.m_typeMappings.AsReadOnly();
}
}
internal StorageEntityContainerMapping EntityContainerMapping
{
get
{
return m_entityContainerMapping;
}
}
///
/// Whether the SetMapping has empty content
/// Returns true if there no table Mapping fragments
///
internal virtual bool HasNoContent
{
get
{
if (QueryView != null)
{
return false;
}
foreach (StorageTypeMapping typeMap in TypeMappings)
{
foreach (StorageMappingFragment mapFragment in typeMap.MappingFragments)
{
foreach (StoragePropertyMapping propertyMap in mapFragment.AllProperties)
{
return false;
}
}
}
return true;
}
}
internal string QueryView
{
get { return m_queryView; }
set { m_queryView = value; }
}
///
/// Line Number in MSL file where the Set Mapping Element's Start Tag is present.
///
internal int StartLineNumber
{
get
{
return m_startLineNumber;
}
set
{
m_startLineNumber = value;
}
}
///
/// Line Position in MSL file where the Set Mapping Element's Start Tag is present.
///
internal int StartLinePosition
{
get
{
return m_startLinePosition;
}
set
{
m_startLinePosition = value;
}
}
internal bool HasModificationFunctionMapping
{
get
{
return m_hasModificationFunctionMapping;
}
set
{
m_hasModificationFunctionMapping = value;
}
}
#endregion
#region Methods
///
/// Add type mapping as a child under this SetMapping
///
///
internal void AddTypeMapping(StorageTypeMapping typeMapping)
{
this.m_typeMappings.Add(typeMapping);
}
///
/// This method is primarily for debugging purposes.
/// Will be removed shortly.
///
internal abstract void Print(int index);
internal bool ContainsTypeSpecificQueryView(Triple key)
{
return m_typeSpecificQueryViews.ContainsKey(key);
}
///
/// Stores a type-specific user-defiend QueryView so that it can be loaded
/// into StorageMappingItemCollection's view cache.
///
internal void AddTypeSpecificQueryView(Triple key, string viewString)
{
Debug.Assert(!m_typeSpecificQueryViews.ContainsKey(key), "Query View already present for the given Key");
m_typeSpecificQueryViews.Add(key, viewString);
}
internal ReadOnlyCollection GetTypeSpecificQVKeys()
{
return new ReadOnlyCollection(m_typeSpecificQueryViews.Keys.ToList());
}
internal string GetTypeSpecificQueryView(Triple key)
{
Debug.Assert(m_typeSpecificQueryViews.ContainsKey(key));
return m_typeSpecificQueryViews[key];
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Data.Metadata.Edm;
using System.Data.Common.Utils;
using System.Diagnostics;
using System.Linq;
namespace System.Data.Mapping {
using Triple = Pair>;
///
/// Represents the Mapping metadata for an Extent in ES space.
///
///
/// For Example if conceptually you could represent the ES MSL file as following
/// --Mapping
/// --EntityContainerMapping ( CNorthwind-->SNorthwind )
/// --EntitySetMapping
/// --EntityTypeMapping
/// --TableMappingFragment
/// --EntityTypeMapping
/// --TableMappingFragment
/// --AssociationSetMapping
/// --AssociationTypeMapping
/// --TableMappingFragment
/// --EntityContainerMapping ( CMyDatabase-->SMyDatabase )
/// --CompositionSetMapping
/// --CompositionTypeMapping
/// This class represents the metadata for all the extent map elements in the
/// above example namely EntitySetMapping, AssociationSetMapping and CompositionSetMapping.
/// The SetMapping elements that are children of the EntityContainerMapping element
/// can be accessed through the properties on this type.
///
internal abstract class StorageSetMapping
{
#region Constructors
///
/// Construct the new ExtentMapping object.
///
/// Extent metadata object
/// The EntityContainer mapping that contains this extent mapping
internal StorageSetMapping(EntitySetBase extent, StorageEntityContainerMapping entityContainerMapping) {
this.m_entityContainerMapping = entityContainerMapping;
this.m_extent = extent;
this.m_typeMappings = new List();
}
#endregion
#region Fields
private StorageEntityContainerMapping m_entityContainerMapping; //The EntityContainer mapping that contains this extent mapping
private EntitySetBase m_extent; //The extent for which this mapping represents.
private List m_typeMappings; //Set of type mappings that make up the Set Mapping
//Unless this is a EntitySetMapping with inheritance,
//you would have a single type mapping per set
private string m_queryView; //User defined Query View for the EntitySet
private int m_startLineNumber; //Line Number for Set Mapping element start tag
private int m_startLinePosition; //Line position for Set Mapping element start tag
private bool m_hasModificationFunctionMapping; // has modificationfunctionmapping for set mapping
//Stores type-Specific user-defined QueryViews
private Dictionary m_typeSpecificQueryViews =
new Dictionary(Triple.PairComparer.Instance);
#endregion
#region Properties
///
/// The set for which this mapping is for
///
internal EntitySetBase Set
{
get {
return this.m_extent;
}
}
/////
///// TypeMappings that make up this set type.
///// For AssociationSet and CompositionSet there will be one type( atleast thats what
///// we expect as of now). EntitySet could have mappings for multiple Entity types.
/////
internal ReadOnlyCollection TypeMappings
{
get
{
return this.m_typeMappings.AsReadOnly();
}
}
internal StorageEntityContainerMapping EntityContainerMapping
{
get
{
return m_entityContainerMapping;
}
}
///
/// Whether the SetMapping has empty content
/// Returns true if there no table Mapping fragments
///
internal virtual bool HasNoContent
{
get
{
if (QueryView != null)
{
return false;
}
foreach (StorageTypeMapping typeMap in TypeMappings)
{
foreach (StorageMappingFragment mapFragment in typeMap.MappingFragments)
{
foreach (StoragePropertyMapping propertyMap in mapFragment.AllProperties)
{
return false;
}
}
}
return true;
}
}
internal string QueryView
{
get { return m_queryView; }
set { m_queryView = value; }
}
///
/// Line Number in MSL file where the Set Mapping Element's Start Tag is present.
///
internal int StartLineNumber
{
get
{
return m_startLineNumber;
}
set
{
m_startLineNumber = value;
}
}
///
/// Line Position in MSL file where the Set Mapping Element's Start Tag is present.
///
internal int StartLinePosition
{
get
{
return m_startLinePosition;
}
set
{
m_startLinePosition = value;
}
}
internal bool HasModificationFunctionMapping
{
get
{
return m_hasModificationFunctionMapping;
}
set
{
m_hasModificationFunctionMapping = value;
}
}
#endregion
#region Methods
///
/// Add type mapping as a child under this SetMapping
///
///
internal void AddTypeMapping(StorageTypeMapping typeMapping)
{
this.m_typeMappings.Add(typeMapping);
}
///
/// This method is primarily for debugging purposes.
/// Will be removed shortly.
///
internal abstract void Print(int index);
internal bool ContainsTypeSpecificQueryView(Triple key)
{
return m_typeSpecificQueryViews.ContainsKey(key);
}
///
/// Stores a type-specific user-defiend QueryView so that it can be loaded
/// into StorageMappingItemCollection's view cache.
///
internal void AddTypeSpecificQueryView(Triple key, string viewString)
{
Debug.Assert(!m_typeSpecificQueryViews.ContainsKey(key), "Query View already present for the given Key");
m_typeSpecificQueryViews.Add(key, viewString);
}
internal ReadOnlyCollection GetTypeSpecificQVKeys()
{
return new ReadOnlyCollection(m_typeSpecificQueryViews.Keys.ToList());
}
internal string GetTypeSpecificQueryView(Triple key)
{
Debug.Assert(m_typeSpecificQueryViews.ContainsKey(key));
return m_typeSpecificQueryViews[key];
}
#endregion
}
}
// 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
- MemoryFailPoint.cs
- SafeSerializationManager.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ExeContext.cs
- SortDescription.cs
- LightweightEntityWrapper.cs
- RectAnimation.cs
- ColorIndependentAnimationStorage.cs
- _SSPISessionCache.cs
- CodeArrayCreateExpression.cs
- XmlSchemaObjectTable.cs
- TimeSpanConverter.cs
- Propagator.ExtentPlaceholderCreator.cs
- ResponseBodyWriter.cs
- counter.cs
- SqlCommandBuilder.cs
- MarkerProperties.cs
- FilteredDataSetHelper.cs
- XamlPointCollectionSerializer.cs
- UpDownEvent.cs
- FixedNode.cs
- HeaderUtility.cs
- XmlSchemaProviderAttribute.cs
- TimeSpanOrInfiniteConverter.cs
- DefaultTextStoreTextComposition.cs
- ToolStripItemCollection.cs
- SmtpNtlmAuthenticationModule.cs
- ApplicationDirectory.cs
- Sequence.cs
- DesignerActionService.cs
- KernelTypeValidation.cs
- OdbcConnectionString.cs
- OAVariantLib.cs
- SqlGenerator.cs
- DeadCharTextComposition.cs
- InvalidPrinterException.cs
- Rfc2898DeriveBytes.cs
- Zone.cs
- ChildTable.cs
- SqlSupersetValidator.cs
- _CacheStreams.cs
- SimpleType.cs
- SmtpMail.cs
- FtpRequestCacheValidator.cs
- Property.cs
- DBAsyncResult.cs
- NavigationWindow.cs
- UrlMapping.cs
- BooleanStorage.cs
- NavigationWindow.cs
- DataGridItemEventArgs.cs
- TableLayout.cs
- TableItemStyle.cs
- EntityDataSourceWrapperCollection.cs
- WebHttpBindingCollectionElement.cs
- PEFileReader.cs
- XmlDataSourceView.cs
- ServicePointManagerElement.cs
- GradientStop.cs
- Mutex.cs
- Path.cs
- SystemIcmpV4Statistics.cs
- OletxEnlistment.cs
- DynamicPropertyReader.cs
- BaseTreeIterator.cs
- MultiTrigger.cs
- SharedPersonalizationStateInfo.cs
- PersonalizableTypeEntry.cs
- TypeConverterHelper.cs
- SafeLibraryHandle.cs
- NamedObject.cs
- UIntPtr.cs
- DataGridClipboardCellContent.cs
- connectionpool.cs
- UserUseLicenseDictionaryLoader.cs
- WorkflowExecutor.cs
- SystemNetHelpers.cs
- NativeMethods.cs
- ListViewSelectEventArgs.cs
- Html32TextWriter.cs
- ControlPropertyNameConverter.cs
- Base64Encoder.cs
- Size3DValueSerializer.cs
- DataGridCellsPresenter.cs
- AppSettings.cs
- ShapingWorkspace.cs
- Pens.cs
- RuleInfoComparer.cs
- OpCopier.cs
- EntityContainerEmitter.cs
- DynamicDiscoveryDocument.cs
- LayoutSettings.cs
- nulltextcontainer.cs
- BitConverter.cs
- DataGridHeaderBorder.cs
- Schema.cs
- XmlLanguage.cs
- ByteAnimationUsingKeyFrames.cs
- RowToParametersTransformer.cs
- ResourceDictionary.cs