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 / StructuralType.cs / 1 / StructuralType.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Data.Common; using System.Text; namespace System.Data.Metadata.Edm { ////// Represents the Structural Type /// public abstract class StructuralType : EdmType { #region Constructors ////// Internal parameterless constructor for bootstrapping edmtypes /// internal StructuralType() { _members = new MemberCollection(this); _readOnlyMembers = _members.AsReadOnlyMetadataCollection(); } ////// Initializes a new instance of Structural Type with the given members /// /// name of the structural type /// namespace of the structural type /// version of the structural type /// dataSpace in which this edmtype belongs to ///Thrown if either name, namespace or version arguments are null internal StructuralType(string name, string namespaceName, DataSpace dataSpace) : base(name, namespaceName, dataSpace) { _members = new MemberCollection(this); _readOnlyMembers = _members.AsReadOnlyMetadataCollection(); } #endregion #region Fields private readonly MemberCollection _members; private readonly ReadOnlyMetadataCollection_readOnlyMembers; #endregion #region Properties /// /// Returns the collection of members. /// [MetadataProperty(BuiltInTypeKind.EdmMember, true)] public ReadOnlyMetadataCollectionMembers { get { return _readOnlyMembers; } } #endregion #region Methods /// /// Get the declared only members of a particular type /// internal ReadOnlyMetadataCollectionGetDeclaredOnlyMembers () where T : EdmMember { return _members.GetDeclaredOnlyMembers (); } /// /// Validates the types and sets the readOnly property to true. Once the type is set to readOnly, /// it can never be changed. /// internal override void SetReadOnly() { if (!IsReadOnly) { base.SetReadOnly(); this.Members.Source.SetReadOnly(); } } ////// Validates a EdmMember object to determine if it can be added to this type's /// Members collection. If this method returns without throwing, it is assumed /// the member is valid. /// /// The member to validate internal abstract void ValidateMemberForAdd(EdmMember member); ////// Adds a member to this type /// /// The member to add internal void AddMember(EdmMember member) { EntityUtil.GenericCheckArgumentNull(member, "member"); Util.ThrowIfReadOnly(this); Debug.Assert(this.DataSpace == member.TypeUsage.EdmType.DataSpace || this.BuiltInTypeKind == BuiltInTypeKind.RowType, "Wrong member type getting added in structural type"); //Since we set the DataSpace of the RowType to be -1 in the constructor, we need to initialize it //as and when we add members to it if (BuiltInTypeKind.RowType == this.BuiltInTypeKind) { // Do this only when you are adding the first member if (_members.Count == 0) { this.DataSpace = member.TypeUsage.EdmType.DataSpace; } // We need to build types that span across more than one space. For such row types, we set the // DataSpace to -1 else if (this.DataSpace != (DataSpace)(-1) && member.TypeUsage.EdmType.DataSpace != this.DataSpace) { this.DataSpace = (DataSpace)(-1); } } this._members.Add(member); } #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.Diagnostics; using System.Data.Common; using System.Text; namespace System.Data.Metadata.Edm { ////// Represents the Structural Type /// public abstract class StructuralType : EdmType { #region Constructors ////// Internal parameterless constructor for bootstrapping edmtypes /// internal StructuralType() { _members = new MemberCollection(this); _readOnlyMembers = _members.AsReadOnlyMetadataCollection(); } ////// Initializes a new instance of Structural Type with the given members /// /// name of the structural type /// namespace of the structural type /// version of the structural type /// dataSpace in which this edmtype belongs to ///Thrown if either name, namespace or version arguments are null internal StructuralType(string name, string namespaceName, DataSpace dataSpace) : base(name, namespaceName, dataSpace) { _members = new MemberCollection(this); _readOnlyMembers = _members.AsReadOnlyMetadataCollection(); } #endregion #region Fields private readonly MemberCollection _members; private readonly ReadOnlyMetadataCollection_readOnlyMembers; #endregion #region Properties /// /// Returns the collection of members. /// [MetadataProperty(BuiltInTypeKind.EdmMember, true)] public ReadOnlyMetadataCollectionMembers { get { return _readOnlyMembers; } } #endregion #region Methods /// /// Get the declared only members of a particular type /// internal ReadOnlyMetadataCollectionGetDeclaredOnlyMembers () where T : EdmMember { return _members.GetDeclaredOnlyMembers (); } /// /// Validates the types and sets the readOnly property to true. Once the type is set to readOnly, /// it can never be changed. /// internal override void SetReadOnly() { if (!IsReadOnly) { base.SetReadOnly(); this.Members.Source.SetReadOnly(); } } ////// Validates a EdmMember object to determine if it can be added to this type's /// Members collection. If this method returns without throwing, it is assumed /// the member is valid. /// /// The member to validate internal abstract void ValidateMemberForAdd(EdmMember member); ////// Adds a member to this type /// /// The member to add internal void AddMember(EdmMember member) { EntityUtil.GenericCheckArgumentNull(member, "member"); Util.ThrowIfReadOnly(this); Debug.Assert(this.DataSpace == member.TypeUsage.EdmType.DataSpace || this.BuiltInTypeKind == BuiltInTypeKind.RowType, "Wrong member type getting added in structural type"); //Since we set the DataSpace of the RowType to be -1 in the constructor, we need to initialize it //as and when we add members to it if (BuiltInTypeKind.RowType == this.BuiltInTypeKind) { // Do this only when you are adding the first member if (_members.Count == 0) { this.DataSpace = member.TypeUsage.EdmType.DataSpace; } // We need to build types that span across more than one space. For such row types, we set the // DataSpace to -1 else if (this.DataSpace != (DataSpace)(-1) && member.TypeUsage.EdmType.DataSpace != this.DataSpace) { this.DataSpace = (DataSpace)(-1); } } this._members.Add(member); } #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
- MenuItemStyleCollection.cs
- ExpressionNode.cs
- SeparatorAutomationPeer.cs
- WindowsStatusBar.cs
- InputMethod.cs
- HandlerFactoryCache.cs
- ContourSegment.cs
- BoolExpressionVisitors.cs
- GAC.cs
- __Filters.cs
- ComboBoxDesigner.cs
- Viewport2DVisual3D.cs
- EdmSchemaAttribute.cs
- SignatureConfirmations.cs
- IdentityNotMappedException.cs
- AsymmetricSignatureDeformatter.cs
- Floater.cs
- CheckBox.cs
- TablePatternIdentifiers.cs
- XPathCompileException.cs
- XamlParser.cs
- ToolStripContextMenu.cs
- ValidateNames.cs
- DataGridPagingPage.cs
- RtfControlWordInfo.cs
- ObjectDataSourceDesigner.cs
- LinqDataView.cs
- Vector3D.cs
- _NegoState.cs
- CodeAccessSecurityEngine.cs
- comcontractssection.cs
- ScrollPatternIdentifiers.cs
- CodeExpressionStatement.cs
- BitmapEffectInput.cs
- TypedRowHandler.cs
- Encoder.cs
- XmlWrappingReader.cs
- HwndHostAutomationPeer.cs
- EventRoute.cs
- EventBuilder.cs
- EmulateRecognizeCompletedEventArgs.cs
- BinaryWriter.cs
- DataGridViewCellFormattingEventArgs.cs
- RSAPKCS1SignatureDeformatter.cs
- WebServiceHost.cs
- BitmapCodecInfo.cs
- BindingList.cs
- BufferedWebEventProvider.cs
- SecuritySessionClientSettings.cs
- PeerCollaboration.cs
- ArrayTypeMismatchException.cs
- HttpCachePolicy.cs
- Monitor.cs
- ConfigurationUtility.cs
- TextLine.cs
- ListenerServiceInstallComponent.cs
- NavigationProperty.cs
- DelegatingTypeDescriptionProvider.cs
- DataGridRelationshipRow.cs
- WindowsRebar.cs
- SymmetricKeyWrap.cs
- PropertyMap.cs
- VisualStyleElement.cs
- WhitespaceRuleLookup.cs
- XamlDesignerSerializationManager.cs
- EntityDataSourceViewSchema.cs
- storepermission.cs
- ChildDocumentBlock.cs
- HttpCacheParams.cs
- PaintValueEventArgs.cs
- ObjectDataSourceEventArgs.cs
- CurrentChangingEventManager.cs
- WebPartsPersonalization.cs
- ObjectDataSourceDisposingEventArgs.cs
- ApplicationServiceHelper.cs
- XmlSchemaAnyAttribute.cs
- ProcessModule.cs
- Binding.cs
- ExpressionEditorSheet.cs
- OdbcCommandBuilder.cs
- PointKeyFrameCollection.cs
- CharEntityEncoderFallback.cs
- GridViewCommandEventArgs.cs
- AsmxEndpointPickerExtension.cs
- UsernameTokenFactoryCredential.cs
- HelpOperationInvoker.cs
- WindowsBrush.cs
- QueryReaderSettings.cs
- UnknownBitmapDecoder.cs
- BulletChrome.cs
- XmlResolver.cs
- KeyGesture.cs
- ContainerFilterService.cs
- CalendarAutoFormatDialog.cs
- PageAsyncTaskManager.cs
- MetafileHeaderEmf.cs
- InstalledVoice.cs
- ThreadStaticAttribute.cs
- SafeBitVector32.cs
- OpenTypeCommon.cs