Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / ReferentialConstraint.cs / 1305376 / ReferentialConstraint.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Collections.ObjectModel; using System.Data.Common; namespace System.Data.Metadata.Edm { ////// This class describes referential constraint on the relationships /// public sealed class ReferentialConstraint : MetadataItem { #region Constructors ////// Constructs a new constraint on the relationship /// /// role from which the relationship originates /// role to which the relationship is linked/targeted to /// properties on entity type of from role which take part in the constraint /// properties on entity type of to role which take part in the constraint ///Argument Null exception if any of the arguments is null internal ReferentialConstraint(RelationshipEndMember fromRole, RelationshipEndMember toRole, IEnumerablefromProperties, IEnumerable toProperties) { _fromRole = EntityUtil.GenericCheckArgumentNull(fromRole, "fromRole"); _toRole = EntityUtil.GenericCheckArgumentNull(toRole, "toRole"); _fromProperties = new ReadOnlyMetadataCollection (new MetadataCollection ( EntityUtil.GenericCheckArgumentNull(fromProperties, "fromProperties"))); _toProperties = new ReadOnlyMetadataCollection (new MetadataCollection ( EntityUtil.GenericCheckArgumentNull(toProperties, "toProperties"))); } #endregion #region Fields private RelationshipEndMember _fromRole; private RelationshipEndMember _toRole; private readonly ReadOnlyMetadataCollection _fromProperties; private readonly ReadOnlyMetadataCollection _toProperties; #endregion #region Properties /// /// Returns the kind of the type /// public override BuiltInTypeKind BuiltInTypeKind { get { return BuiltInTypeKind.ReferentialConstraint; } } ////// Returns the identity for this constraint /// internal override string Identity { get { return this.FromRole.Name + "_" + this.ToRole.Name; } } ////// Returns the FromRole which takes part in this referential constraint /// ///Thrown if value passed into setter is null ///Thrown if the ReferentialConstraint instance is in ReadOnly state [MetadataProperty(BuiltInTypeKind.RelationshipEndMember, false)] public RelationshipEndMember FromRole { get { return _fromRole; } } ////// Returns the ToRole which takes part in this referential constraint /// ///Thrown if value passed into setter is null ///Thrown if the ReferentialConstraint instance is in ReadOnly state [MetadataProperty(BuiltInTypeKind.RelationshipEndMember, false)] public RelationshipEndMember ToRole { get { return _toRole; } } ////// Returns the collection of properties on the from role on which the constraint is defined on /// [MetadataProperty(BuiltInTypeKind.EdmProperty, true)] public ReadOnlyMetadataCollectionFromProperties { get { return _fromProperties; } } /// /// Returns the collection of properties on the ToRole on whose value the constraint is defined on /// [MetadataProperty(BuiltInTypeKind.EdmProperty, true)] public ReadOnlyMetadataCollectionToProperties { get { return _toProperties; } } #endregion #region Methods /// /// Overriding System.Object.ToString to provide better String representation /// ofr this type. /// public override string ToString() { return this.FromRole.Name + "_" + this.ToRole.Name; } ////// Sets this item to be readonly, once this is set, the item will never be writable again. /// internal override void SetReadOnly() { if (!IsReadOnly) { base.SetReadOnly(); RelationshipEndMember fromRole = FromRole; if (fromRole != null) { fromRole.SetReadOnly(); } RelationshipEndMember toRole = ToRole; if (toRole != null) { toRole.SetReadOnly(); } this.FromProperties.Source.SetReadOnly(); this.ToProperties.Source.SetReadOnly(); } } #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
- MappingSource.cs
- DefaultSection.cs
- ClonableStack.cs
- XmlSchemaElement.cs
- ApplicationServiceHelper.cs
- PixelFormatConverter.cs
- ZeroOpNode.cs
- ParserContext.cs
- StrongName.cs
- ParserContext.cs
- SynthesizerStateChangedEventArgs.cs
- SrgsRulesCollection.cs
- ImageListImageEditor.cs
- EntityDataSourceWrapperCollection.cs
- ConnectionPoolManager.cs
- MasterPageParser.cs
- Utils.cs
- InternalPermissions.cs
- DescriptionAttribute.cs
- SmiRequestExecutor.cs
- Visual3D.cs
- BufferedStream.cs
- WebConfigManager.cs
- InternalTransaction.cs
- DetailsViewDeleteEventArgs.cs
- MultiView.cs
- System.Data_BID.cs
- DelegateHelpers.cs
- ProxyManager.cs
- HttpHandlerActionCollection.cs
- Point3DCollectionConverter.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- SharedPerformanceCounter.cs
- SqlException.cs
- VectorConverter.cs
- QuaternionRotation3D.cs
- TransformerTypeCollection.cs
- OuterGlowBitmapEffect.cs
- InstanceCreationEditor.cs
- BinHexDecoder.cs
- Symbol.cs
- MessageAction.cs
- FragmentQuery.cs
- PointCollection.cs
- Int64AnimationUsingKeyFrames.cs
- AnnotationDocumentPaginator.cs
- HScrollProperties.cs
- DefaultAutoFieldGenerator.cs
- MimeParameters.cs
- SqlDataSourceFilteringEventArgs.cs
- ProfilePropertyNameValidator.cs
- DecimalAnimationBase.cs
- UpDownEvent.cs
- PiiTraceSource.cs
- HideDisabledControlAdapter.cs
- InputDevice.cs
- CalendarTable.cs
- ResourceExpressionBuilder.cs
- TemplateKey.cs
- PackageRelationshipSelector.cs
- DetailsViewDeletedEventArgs.cs
- SqlIdentifier.cs
- DataGridLinkButton.cs
- TransformGroup.cs
- XmlSerializerAssemblyAttribute.cs
- TextViewBase.cs
- ColorConvertedBitmap.cs
- ControlBuilder.cs
- _SSPISessionCache.cs
- OleDbException.cs
- IndependentAnimationStorage.cs
- DbConnectionPoolIdentity.cs
- DataGridViewBand.cs
- Application.cs
- FilterEventArgs.cs
- XamlReader.cs
- CommonDialog.cs
- TablePatternIdentifiers.cs
- NotConverter.cs
- GeometryHitTestParameters.cs
- CodePropertyReferenceExpression.cs
- UITypeEditor.cs
- PerformanceCountersElement.cs
- ResponseBodyWriter.cs
- BitmapEffectDrawing.cs
- FileRecordSequence.cs
- CroppedBitmap.cs
- ContextBase.cs
- SqlUserDefinedTypeAttribute.cs
- FormViewDeletedEventArgs.cs
- HyperLinkField.cs
- ContextQuery.cs
- XmlSchemaSimpleType.cs
- PersianCalendar.cs
- CodeVariableDeclarationStatement.cs
- NetCodeGroup.cs
- VectorConverter.cs
- ObjectSet.cs
- MetaColumn.cs
- SpecularMaterial.cs