Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / ReferentialConstraint.cs / 1 / ReferentialConstraint.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- 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. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- 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
- SerializationInfo.cs
- ChangeNode.cs
- UserControlAutomationPeer.cs
- ListViewSelectEventArgs.cs
- Stack.cs
- OutputWindow.cs
- WebMessageEncodingBindingElement.cs
- ColumnMapTranslator.cs
- ItemType.cs
- ValidatedControlConverter.cs
- WebPartExportVerb.cs
- MetadataArtifactLoaderComposite.cs
- CodeComment.cs
- TreeNodeBinding.cs
- InvalidateEvent.cs
- RuntimeHandles.cs
- GraphicsContext.cs
- VBIdentifierName.cs
- CompressStream.cs
- PolyBezierSegment.cs
- XamlReader.cs
- FocusChangedEventArgs.cs
- TreeViewItem.cs
- ImplicitInputBrush.cs
- _ProxyRegBlob.cs
- DocumentAutomationPeer.cs
- MenuItemCollection.cs
- Helpers.cs
- SafeFileMappingHandle.cs
- BaseValidatorDesigner.cs
- LoginDesignerUtil.cs
- XmlSchemaAnyAttribute.cs
- UserNameServiceElement.cs
- PersonalizationAdministration.cs
- SatelliteContractVersionAttribute.cs
- _ListenerResponseStream.cs
- MenuItem.cs
- StorageScalarPropertyMapping.cs
- DrawingContextWalker.cs
- SafeNativeMethods.cs
- ZipIOExtraFieldElement.cs
- WindowsButton.cs
- UrlAuthorizationModule.cs
- XmlExpressionDumper.cs
- TemplateControl.cs
- ManualResetEvent.cs
- DependencyPropertyAttribute.cs
- ProviderIncompatibleException.cs
- ContentElement.cs
- CodeNamespace.cs
- ServiceTimeoutsElement.cs
- ControlEvent.cs
- QilInvokeLateBound.cs
- ListViewTableRow.cs
- TextUtf8RawTextWriter.cs
- SystemDiagnosticsSection.cs
- DbBuffer.cs
- SmiEventSink_DeferedProcessing.cs
- GridToolTip.cs
- DataGridSortCommandEventArgs.cs
- AssemblyNameUtility.cs
- ListControl.cs
- SelectedGridItemChangedEvent.cs
- OpacityConverter.cs
- UriSection.cs
- TextDecoration.cs
- Configuration.cs
- ApplicationSecurityInfo.cs
- AsyncResult.cs
- DocumentPage.cs
- SchemaCollectionCompiler.cs
- TextEditorDragDrop.cs
- Base64Decoder.cs
- AlphabeticalEnumConverter.cs
- XmlILOptimizerVisitor.cs
- GridViewDeleteEventArgs.cs
- MatrixTransform3D.cs
- StatusBarItem.cs
- GenericWebPart.cs
- IssuedSecurityTokenProvider.cs
- UInt32.cs
- UserMapPath.cs
- TraceListeners.cs
- PointLightBase.cs
- IBuiltInEvidence.cs
- ProfileProvider.cs
- FusionWrap.cs
- AudioBase.cs
- TransformProviderWrapper.cs
- Funcletizer.cs
- RequestSecurityTokenResponse.cs
- ConfigurationElement.cs
- FrameworkRichTextComposition.cs
- Pkcs9Attribute.cs
- fixedPageContentExtractor.cs
- TreeViewItemAutomationPeer.cs
- ListBindableAttribute.cs
- WinInet.cs
- DetailsViewRow.cs
- SQLChars.cs