Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / EdmMember.cs / 3 / 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
- SecureConversationSecurityTokenParameters.cs
- StateWorkerRequest.cs
- EntityDataSourceContainerNameConverter.cs
- ManifestResourceInfo.cs
- HeaderUtility.cs
- SpanIndex.cs
- FormClosedEvent.cs
- SmtpFailedRecipientException.cs
- TransformPatternIdentifiers.cs
- SafeHandles.cs
- GeneralTransform3DTo2D.cs
- MailHeaderInfo.cs
- WeakReferenceEnumerator.cs
- TypeSystemHelpers.cs
- ShortcutKeysEditor.cs
- TypeResolvingOptionsAttribute.cs
- Mouse.cs
- MultilineStringConverter.cs
- TemplateXamlTreeBuilder.cs
- AssociationSet.cs
- HtmlTextArea.cs
- ExpandSegment.cs
- DBSqlParserTableCollection.cs
- figurelengthconverter.cs
- FixedBufferAttribute.cs
- DataGridViewEditingControlShowingEventArgs.cs
- XmlArrayItemAttributes.cs
- DataKey.cs
- SqlUnionizer.cs
- WSSecureConversationDec2005.cs
- ToolStripDropDownMenu.cs
- _emptywebproxy.cs
- SymbolType.cs
- oledbmetadatacollectionnames.cs
- PropertyItemInternal.cs
- IISUnsafeMethods.cs
- UriScheme.cs
- HttpListenerResponse.cs
- PackageDigitalSignatureManager.cs
- Queue.cs
- DataGridAddNewRow.cs
- RSAPKCS1KeyExchangeFormatter.cs
- WinEventQueueItem.cs
- DynamicEndpoint.cs
- IFormattable.cs
- SafeMemoryMappedFileHandle.cs
- Rect3DConverter.cs
- InteropBitmapSource.cs
- TreeView.cs
- DataControlField.cs
- MonitorWrapper.cs
- DiscoveryRequestHandler.cs
- AliasedSlot.cs
- DataContractSerializer.cs
- TextElementEnumerator.cs
- EntitySetDataBindingList.cs
- Avt.cs
- ProviderCommandInfoUtils.cs
- SapiRecoContext.cs
- WeakReferenceKey.cs
- DynamicScriptObject.cs
- TextPenaltyModule.cs
- RoleManagerEventArgs.cs
- MouseButton.cs
- Int64Storage.cs
- SqlBooleanMismatchVisitor.cs
- SQLDecimal.cs
- DnsPermission.cs
- FocusManager.cs
- XAMLParseException.cs
- cache.cs
- UITypeEditors.cs
- X500Name.cs
- CapabilitiesUse.cs
- NonParentingControl.cs
- ServiceDescriptions.cs
- EventArgs.cs
- WinInet.cs
- TextEvent.cs
- TextSchema.cs
- RectangleConverter.cs
- ForeignKeyConstraint.cs
- ProtocolsSection.cs
- InkCanvas.cs
- SectionVisual.cs
- MsmqHostedTransportConfiguration.cs
- OptimizerPatterns.cs
- OracleColumn.cs
- SecurityElement.cs
- ObfuscateAssemblyAttribute.cs
- ImmutablePropertyDescriptorGridEntry.cs
- Helper.cs
- SerialErrors.cs
- AudioLevelUpdatedEventArgs.cs
- wgx_exports.cs
- FixedLineResult.cs
- ViewDesigner.cs
- ScrollChrome.cs
- UpdateTranslator.cs
- GestureRecognizer.cs