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 / Mapping / StorageEntityTypeMapping.cs / 1 / StorageEntityTypeMapping.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....],[....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Data.Metadata.Edm;
namespace System.Data.Mapping {
///
/// Mapping metadata for Entity type.
/// If an EntitySet represents entities of more than one type, than we will have
/// more than one EntityTypeMapping for an EntitySet( For ex : if
/// PersonSet Entity extent represents entities of types Person and Customer,
/// than we will have two EntityType Mappings under mapping for PersonSet).
///
///
/// For Example if conceptually you could represent the CS MSL file as following
/// --Mapping
/// --EntityContainerMapping ( CNorthwind-->SNorthwind )
/// --EntitySetMapping
/// --EntityTypeMapping
/// --TableMappingFragment
/// --EntityKey
/// --ScalarPropertyMap
/// --ScalarPropertyMap
/// --EntityTypeMapping
/// --TableMappingFragment
/// --EntityKey
/// --ScalarPropertyMap
/// --ComplexPropertyMap
/// --ScalarPropertyMap
/// --ScalarProperyMap
/// --ScalarPropertyMap
/// --AssociationSetMapping
/// --AssociationTypeMapping
/// --TableMappingFragment
/// --EndPropertyMap
/// --ScalarPropertyMap
/// --ScalarProperyMap
/// --EndPropertyMap
/// --ScalarPropertyMap
/// --EntityContainerMapping ( CMyDatabase-->SMyDatabase )
/// --CompositionSetMapping
/// --CompositionTypeMapping
/// --TableMappingFragment
/// --ParentEntityKey
/// --ScalarPropertyMap
/// --ScalarPropertyMap
/// --EntityKey
/// --ScalarPropertyMap
/// --ScalarPropertyMap
/// --ComplexPropertyMap
/// --ScalarPropertyMap
/// --ScalarProperyMap
/// --ScalarPropertyMap
/// This class represents the metadata for all entity Type map elements in the
/// above example. Users can access the table mapping fragments under the
/// entity type mapping through this class.
///
internal class StorageEntityTypeMapping : StorageTypeMapping {
#region Constructors
///
/// Construct the new EntityTypeMapping object.
///
/// Set Mapping that contains this Type mapping
internal StorageEntityTypeMapping(StorageSetMapping setMapping)
: base(setMapping) {
}
#endregion
#region Fields
private Dictionary m_entityTypes = new Dictionary(StringComparer.Ordinal); //Types for which the mapping holds true for.
private Dictionary m_isOfEntityTypes = new Dictionary(StringComparer.Ordinal); //Types for which the mapping holds true for
// not only the type specified but the sub-types of that type as well.
#endregion
#region Properties
///
/// a list of TypeMetadata that this mapping holds true for.
///
internal override ReadOnlyCollection Types {
get {
return new List(m_entityTypes.Values).AsReadOnly();
}
}
///
/// a list of TypeMetadatas for which the mapping holds true for
/// not only the type specified but the sub-types of that type as well.
///
internal override ReadOnlyCollection IsOfTypes {
get {
return new List(m_isOfEntityTypes.Values).AsReadOnly();
}
}
#endregion
#region Methods
///
/// Add a Type to the list of types that this mapping is valid for
///
internal void AddType(EdmType type) {
this.m_entityTypes.Add(type.FullName, type);
}
///
/// Add a Type to the list of Is-Of types that this mapping is valid for
///
internal void AddIsOfType(EdmType type) {
this.m_isOfEntityTypes.Add(type.FullName, type);
}
internal EntityType GetContainerType(string memberName) {
foreach (EntityType type in m_entityTypes.Values) {
if (type.Properties.Contains(memberName))
{
return type;
}
}
foreach (EntityType type in m_isOfEntityTypes.Values)
{
if (type.Properties.Contains(memberName))
{
return type;
}
}
return null;
}
///
/// This method is primarily for debugging purposes.
/// Will be removed shortly.
///
///
internal override void Print(int index) {
StorageEntityContainerMapping.GetPrettyPrintString(ref index);
StringBuilder sb = new StringBuilder();
sb.Append("EntityTypeMapping");
sb.Append(" ");
foreach (EdmType type in m_entityTypes.Values) {
sb.Append("Types:");
sb.Append(type.FullName);
sb.Append(" ");
}
foreach (EdmType type in m_isOfEntityTypes.Values) {
sb.Append("Is-Of Types:");
sb.Append(type.FullName);
sb.Append(" ");
}
Console.WriteLine(sb.ToString());
foreach (StorageMappingFragment fragment in MappingFragments) {
fragment.Print(index + 5);
}
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....],[....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Data.Metadata.Edm;
namespace System.Data.Mapping {
///
/// Mapping metadata for Entity type.
/// If an EntitySet represents entities of more than one type, than we will have
/// more than one EntityTypeMapping for an EntitySet( For ex : if
/// PersonSet Entity extent represents entities of types Person and Customer,
/// than we will have two EntityType Mappings under mapping for PersonSet).
///
///
/// For Example if conceptually you could represent the CS MSL file as following
/// --Mapping
/// --EntityContainerMapping ( CNorthwind-->SNorthwind )
/// --EntitySetMapping
/// --EntityTypeMapping
/// --TableMappingFragment
/// --EntityKey
/// --ScalarPropertyMap
/// --ScalarPropertyMap
/// --EntityTypeMapping
/// --TableMappingFragment
/// --EntityKey
/// --ScalarPropertyMap
/// --ComplexPropertyMap
/// --ScalarPropertyMap
/// --ScalarProperyMap
/// --ScalarPropertyMap
/// --AssociationSetMapping
/// --AssociationTypeMapping
/// --TableMappingFragment
/// --EndPropertyMap
/// --ScalarPropertyMap
/// --ScalarProperyMap
/// --EndPropertyMap
/// --ScalarPropertyMap
/// --EntityContainerMapping ( CMyDatabase-->SMyDatabase )
/// --CompositionSetMapping
/// --CompositionTypeMapping
/// --TableMappingFragment
/// --ParentEntityKey
/// --ScalarPropertyMap
/// --ScalarPropertyMap
/// --EntityKey
/// --ScalarPropertyMap
/// --ScalarPropertyMap
/// --ComplexPropertyMap
/// --ScalarPropertyMap
/// --ScalarProperyMap
/// --ScalarPropertyMap
/// This class represents the metadata for all entity Type map elements in the
/// above example. Users can access the table mapping fragments under the
/// entity type mapping through this class.
///
internal class StorageEntityTypeMapping : StorageTypeMapping {
#region Constructors
///
/// Construct the new EntityTypeMapping object.
///
/// Set Mapping that contains this Type mapping
internal StorageEntityTypeMapping(StorageSetMapping setMapping)
: base(setMapping) {
}
#endregion
#region Fields
private Dictionary m_entityTypes = new Dictionary(StringComparer.Ordinal); //Types for which the mapping holds true for.
private Dictionary m_isOfEntityTypes = new Dictionary(StringComparer.Ordinal); //Types for which the mapping holds true for
// not only the type specified but the sub-types of that type as well.
#endregion
#region Properties
///
/// a list of TypeMetadata that this mapping holds true for.
///
internal override ReadOnlyCollection Types {
get {
return new List(m_entityTypes.Values).AsReadOnly();
}
}
///
/// a list of TypeMetadatas for which the mapping holds true for
/// not only the type specified but the sub-types of that type as well.
///
internal override ReadOnlyCollection IsOfTypes {
get {
return new List(m_isOfEntityTypes.Values).AsReadOnly();
}
}
#endregion
#region Methods
///
/// Add a Type to the list of types that this mapping is valid for
///
internal void AddType(EdmType type) {
this.m_entityTypes.Add(type.FullName, type);
}
///
/// Add a Type to the list of Is-Of types that this mapping is valid for
///
internal void AddIsOfType(EdmType type) {
this.m_isOfEntityTypes.Add(type.FullName, type);
}
internal EntityType GetContainerType(string memberName) {
foreach (EntityType type in m_entityTypes.Values) {
if (type.Properties.Contains(memberName))
{
return type;
}
}
foreach (EntityType type in m_isOfEntityTypes.Values)
{
if (type.Properties.Contains(memberName))
{
return type;
}
}
return null;
}
///
/// This method is primarily for debugging purposes.
/// Will be removed shortly.
///
///
internal override void Print(int index) {
StorageEntityContainerMapping.GetPrettyPrintString(ref index);
StringBuilder sb = new StringBuilder();
sb.Append("EntityTypeMapping");
sb.Append(" ");
foreach (EdmType type in m_entityTypes.Values) {
sb.Append("Types:");
sb.Append(type.FullName);
sb.Append(" ");
}
foreach (EdmType type in m_isOfEntityTypes.Values) {
sb.Append("Is-Of Types:");
sb.Append(type.FullName);
sb.Append(" ");
}
Console.WriteLine(sb.ToString());
foreach (StorageMappingFragment fragment in MappingFragments) {
fragment.Print(index + 5);
}
}
#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
- SoapIgnoreAttribute.cs
- loginstatus.cs
- ScaleTransform3D.cs
- ByteRangeDownloader.cs
- WindowProviderWrapper.cs
- CodeArgumentReferenceExpression.cs
- IdnElement.cs
- DeferredReference.cs
- UIElementIsland.cs
- MethodExecutor.cs
- _OverlappedAsyncResult.cs
- Attribute.cs
- RewritingSimplifier.cs
- TextEncodedRawTextWriter.cs
- SqlWriter.cs
- PropertyOrder.cs
- ReflectEventDescriptor.cs
- ButtonBase.cs
- ECDiffieHellman.cs
- ListSourceHelper.cs
- HttpRuntime.cs
- XmlWrappingWriter.cs
- HostExecutionContextManager.cs
- InstanceValue.cs
- DecodeHelper.cs
- MarkedHighlightComponent.cs
- IsolationInterop.cs
- ProfileServiceManager.cs
- ExpressionWriter.cs
- ClientSettingsProvider.cs
- BuildProvider.cs
- RoleManagerSection.cs
- ValidationException.cs
- DrawListViewItemEventArgs.cs
- PointUtil.cs
- UnsafeNativeMethods.cs
- UpWmlPageAdapter.cs
- DrawingGroup.cs
- BackEase.cs
- AmbiguousMatchException.cs
- WindowsGraphicsCacheManager.cs
- PathGradientBrush.cs
- ValidationHelper.cs
- Span.cs
- NumberSubstitution.cs
- SoapWriter.cs
- UpdatePanelTriggerCollection.cs
- Stroke2.cs
- DBCommandBuilder.cs
- PropertyDescriptors.cs
- RoleService.cs
- nulltextcontainer.cs
- UpdatePanelControlTrigger.cs
- ResourceBinder.cs
- path.cs
- HelpProvider.cs
- SqlVisitor.cs
- TryExpression.cs
- TextRangeEditLists.cs
- WebPartTransformerCollection.cs
- XmlMessageFormatter.cs
- QilBinary.cs
- counter.cs
- ControlCachePolicy.cs
- Font.cs
- BooleanFunctions.cs
- CharUnicodeInfo.cs
- EqualityArray.cs
- WindowsNonControl.cs
- ScopedKnownTypes.cs
- FormViewModeEventArgs.cs
- CheckoutException.cs
- UnsafeNativeMethodsCLR.cs
- SchemaManager.cs
- RectAnimation.cs
- ActivityExecutorDelegateInfo.cs
- ScriptControlManager.cs
- UshortList2.cs
- COAUTHINFO.cs
- ASCIIEncoding.cs
- FileUpload.cs
- ToolStripSettings.cs
- Panel.cs
- WindowsFont.cs
- BasicExpressionVisitor.cs
- StandardOleMarshalObject.cs
- SymLanguageVendor.cs
- ColorBlend.cs
- EpmHelper.cs
- LicenseProviderAttribute.cs
- WorkflowMarkupSerializationProvider.cs
- SendSecurityHeaderElementContainer.cs
- SharedPersonalizationStateInfo.cs
- DeferredTextReference.cs
- ClientRolePrincipal.cs
- GenerateScriptTypeAttribute.cs
- PermissionSetEnumerator.cs
- DecoratedNameAttribute.cs
- Int32Storage.cs
- ScopedKnownTypes.cs