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 / Metadata / Edm / EdmMember.cs / 1 / EdmMember.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics;
using System.Text;
namespace System.Data.Metadata.Edm
{
///
/// Represents the edm member class
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Edm")]
public abstract class EdmMember : MetadataItem
{
///
/// Initializes a new instance of EdmMember class
///
/// name of the member
/// type information containing info about member's type and its facet
internal EdmMember(string name, TypeUsage memberTypeUsage)
{
EntityUtil.CheckStringArgument(name, "name");
EntityUtil.GenericCheckArgumentNull(memberTypeUsage, "memberTypeUsage");
_name = name;
_typeUsage = memberTypeUsage;
}
private TypeUsage _typeUsage;
private string _name;
private StructuralType _declaringType;
///
/// Returns the identity of the member
///
internal override string Identity
{
get
{
return this.Name;
}
}
///
/// Returns the name of the member
///
[MetadataProperty(PrimitiveTypeKind.String, false)]
public String Name
{
get
{
return _name;
}
}
///
/// Returns the declaring type of the member
///
public StructuralType DeclaringType
{
get
{
return _declaringType;
}
}
///
/// Returns the TypeUsage object containing the type information and facets
/// about the type
///
[MetadataProperty(BuiltInTypeKind.TypeUsage, false)]
public TypeUsage TypeUsage
{
get
{
return _typeUsage;
}
}
///
/// Overriding System.Object.ToString to provide better String representation
/// for this type.
///
public override string ToString()
{
return Name;
}
///
/// Sets the member to read only mode. Once this is done, there are no changes
/// that can be done to this class
///
internal override void SetReadOnly()
{
if (!IsReadOnly)
{
base.SetReadOnly();
// TypeUsage is always readonly, no need to set it
}
}
///
/// Change the declaring type without doing fixup in the member collection
///
internal void ChangeDeclaringTypeWithoutCollectionFixup(StructuralType newDeclaringType)
{
_declaringType = newDeclaringType;
}
///
/// Tells whether this member is marked as a Computed member in the EDM definition
///
internal bool IsStoreGeneratedComputed
{
get
{
Facet item=null;
if (TypeUsage.Facets.TryGetValue(EdmProviderManifest.StoreGeneratedPatternFacetName, false, out item))
{
return ((StoreGeneratedPattern)item.Value) == StoreGeneratedPattern.Computed;
}
return false;
}
}
///
/// Tells whether this member's Store generated pattern is marked as Identity in the EDM definition
///
internal bool IsStoreGeneratedIdentity
{
get
{
Facet item = null;
if (TypeUsage.Facets.TryGetValue(EdmProviderManifest.StoreGeneratedPatternFacetName, false, out item))
{
return ((StoreGeneratedPattern)item.Value) == StoreGeneratedPattern.Identity;
}
return false;
}
}
}
}
// 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.Data.Common;
using System.Diagnostics;
using System.Text;
namespace System.Data.Metadata.Edm
{
///
/// Represents the edm member class
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Edm")]
public abstract class EdmMember : MetadataItem
{
///
/// Initializes a new instance of EdmMember class
///
/// name of the member
/// type information containing info about member's type and its facet
internal EdmMember(string name, TypeUsage memberTypeUsage)
{
EntityUtil.CheckStringArgument(name, "name");
EntityUtil.GenericCheckArgumentNull(memberTypeUsage, "memberTypeUsage");
_name = name;
_typeUsage = memberTypeUsage;
}
private TypeUsage _typeUsage;
private string _name;
private StructuralType _declaringType;
///
/// Returns the identity of the member
///
internal override string Identity
{
get
{
return this.Name;
}
}
///
/// Returns the name of the member
///
[MetadataProperty(PrimitiveTypeKind.String, false)]
public String Name
{
get
{
return _name;
}
}
///
/// Returns the declaring type of the member
///
public StructuralType DeclaringType
{
get
{
return _declaringType;
}
}
///
/// Returns the TypeUsage object containing the type information and facets
/// about the type
///
[MetadataProperty(BuiltInTypeKind.TypeUsage, false)]
public TypeUsage TypeUsage
{
get
{
return _typeUsage;
}
}
///
/// Overriding System.Object.ToString to provide better String representation
/// for this type.
///
public override string ToString()
{
return Name;
}
///
/// Sets the member to read only mode. Once this is done, there are no changes
/// that can be done to this class
///
internal override void SetReadOnly()
{
if (!IsReadOnly)
{
base.SetReadOnly();
// TypeUsage is always readonly, no need to set it
}
}
///
/// Change the declaring type without doing fixup in the member collection
///
internal void ChangeDeclaringTypeWithoutCollectionFixup(StructuralType newDeclaringType)
{
_declaringType = newDeclaringType;
}
///
/// Tells whether this member is marked as a Computed member in the EDM definition
///
internal bool IsStoreGeneratedComputed
{
get
{
Facet item=null;
if (TypeUsage.Facets.TryGetValue(EdmProviderManifest.StoreGeneratedPatternFacetName, false, out item))
{
return ((StoreGeneratedPattern)item.Value) == StoreGeneratedPattern.Computed;
}
return false;
}
}
///
/// Tells whether this member's Store generated pattern is marked as Identity in the EDM definition
///
internal bool IsStoreGeneratedIdentity
{
get
{
Facet item = null;
if (TypeUsage.Facets.TryGetValue(EdmProviderManifest.StoreGeneratedPatternFacetName, false, out item))
{
return ((StoreGeneratedPattern)item.Value) == StoreGeneratedPattern.Identity;
}
return false;
}
}
}
}
// 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
- Int64.cs
- MouseGesture.cs
- ListSortDescriptionCollection.cs
- WindowsAuthenticationModule.cs
- Privilege.cs
- OleDbDataReader.cs
- ColorTypeConverter.cs
- QueryInterceptorAttribute.cs
- InstanceNormalEvent.cs
- Missing.cs
- CompilerTypeWithParams.cs
- EncodingInfo.cs
- DateTimeOffsetConverter.cs
- PeerNameRegistration.cs
- TextOnlyOutput.cs
- ConfigurationConverterBase.cs
- ElementsClipboardData.cs
- MarkupExtensionParser.cs
- WCFServiceClientProxyGenerator.cs
- FormViewDeletedEventArgs.cs
- SecurityTokenResolver.cs
- MembershipPasswordException.cs
- WebPartEditorOkVerb.cs
- TimeStampChecker.cs
- QilValidationVisitor.cs
- SponsorHelper.cs
- GeneratedView.cs
- EntityConnectionStringBuilderItem.cs
- CodeSubDirectoriesCollection.cs
- HttpCapabilitiesSectionHandler.cs
- PropertyInformation.cs
- DescendantOverDescendantQuery.cs
- ItemList.cs
- TextContainerChangeEventArgs.cs
- AuthStoreRoleProvider.cs
- Roles.cs
- RijndaelManaged.cs
- XmlNodeChangedEventArgs.cs
- EventWaitHandle.cs
- WebPartVerbCollection.cs
- EntityDataSourceView.cs
- UniqueID.cs
- _HelperAsyncResults.cs
- TransactionBridgeSection.cs
- CapabilitiesState.cs
- TextBox.cs
- FrameworkElement.cs
- DesignBindingEditor.cs
- ListItemConverter.cs
- QuarticEase.cs
- AutoGeneratedField.cs
- COMException.cs
- AlternateView.cs
- OrderByBuilder.cs
- FontConverter.cs
- AttributeCollection.cs
- XmlSerializableServices.cs
- FrugalList.cs
- NavigatingCancelEventArgs.cs
- InvalidWorkflowException.cs
- StylusPlugin.cs
- AnnouncementClient.cs
- OleDbConnectionInternal.cs
- XPathNavigatorReader.cs
- BoundingRectTracker.cs
- PolicyChain.cs
- ServiceNameElementCollection.cs
- TextRunCacheImp.cs
- SchemaElementLookUpTableEnumerator.cs
- ThousandthOfEmRealPoints.cs
- DataControlImageButton.cs
- ObjectQuery_EntitySqlExtensions.cs
- Types.cs
- DataPagerFieldItem.cs
- SynchronizationHandlesCodeDomSerializer.cs
- TdsParserSafeHandles.cs
- DataTemplateKey.cs
- MaskInputRejectedEventArgs.cs
- HtmlInputControl.cs
- SR.Designer.cs
- ObjectListField.cs
- storepermission.cs
- Byte.cs
- HttpVersion.cs
- SqlDataSourceCache.cs
- StateMachineExecutionState.cs
- DataPagerFieldCommandEventArgs.cs
- UnsupportedPolicyOptionsException.cs
- RawKeyboardInputReport.cs
- LineVisual.cs
- ScriptingJsonSerializationSection.cs
- XmlSchemaSimpleTypeUnion.cs
- ExtenderHelpers.cs
- SinglePageViewer.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- DtcInterfaces.cs
- invalidudtexception.cs
- DataSourceSelectArguments.cs
- InertiaTranslationBehavior.cs
- XmlSchemaObjectCollection.cs