Code:
/ 4.0 / 4.0 / 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. //---------------------------------------------------------------------- //// 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
- SafeLocalMemHandle.cs
- MetafileHeaderEmf.cs
- ByteAnimationBase.cs
- IIS7UserPrincipal.cs
- MatrixTransform.cs
- ValueUtilsSmi.cs
- TemplateContent.cs
- CaseInsensitiveOrdinalStringComparer.cs
- FilterableAttribute.cs
- SoapObjectWriter.cs
- AutomationPatternInfo.cs
- ControlBuilderAttribute.cs
- TextTabProperties.cs
- ThemeInfoAttribute.cs
- CTreeGenerator.cs
- SearchForVirtualItemEventArgs.cs
- SqlTypeSystemProvider.cs
- UserPersonalizationStateInfo.cs
- PersonalizableTypeEntry.cs
- RegisteredExpandoAttribute.cs
- TextElementEnumerator.cs
- SortQueryOperator.cs
- BrowserCapabilitiesCodeGenerator.cs
- SqlBuilder.cs
- _ServiceNameStore.cs
- SystemWebSectionGroup.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- MessagingDescriptionAttribute.cs
- SwitchElementsCollection.cs
- PermissionSetTriple.cs
- CodeValidator.cs
- VSWCFServiceContractGenerator.cs
- UnmanagedMarshal.cs
- DayRenderEvent.cs
- HierarchicalDataSourceDesigner.cs
- XmlQuerySequence.cs
- StrongNameMembershipCondition.cs
- UrlMappingsModule.cs
- LogReservationCollection.cs
- DefaultValueTypeConverter.cs
- DataServiceConfiguration.cs
- SystemIPv4InterfaceProperties.cs
- SQLMoney.cs
- BaseTemplateCodeDomTreeGenerator.cs
- WorkflowApplicationAbortedEventArgs.cs
- ContractSearchPattern.cs
- TemplateModeChangedEventArgs.cs
- BitmapEffectGroup.cs
- EmissiveMaterial.cs
- PackWebRequest.cs
- XDeferredAxisSource.cs
- ButtonBase.cs
- TableRowCollection.cs
- BindingSource.cs
- FixedFlowMap.cs
- UICuesEvent.cs
- SqlFlattener.cs
- TransactionProtocolConverter.cs
- CustomGrammar.cs
- PackagePart.cs
- DriveNotFoundException.cs
- SequenceQuery.cs
- DynamicPropertyHolder.cs
- XmlCharType.cs
- OpenFileDialog.cs
- Request.cs
- DisableDpiAwarenessAttribute.cs
- Vector3dCollection.cs
- DataViewListener.cs
- __Filters.cs
- HtmlEmptyTagControlBuilder.cs
- SqlCacheDependencySection.cs
- ControlBuilder.cs
- TranslateTransform.cs
- ResourceProperty.cs
- WindowsGraphics.cs
- TextEditorCharacters.cs
- UriTemplateClientFormatter.cs
- ScrollBar.cs
- SqlDataSourceCommandEventArgs.cs
- TypeGenericEnumerableViewSchema.cs
- RichTextBoxAutomationPeer.cs
- DynamicDiscoSearcher.cs
- Int16.cs
- SmiMetaDataProperty.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- GridViewItemAutomationPeer.cs
- NavigationProperty.cs
- HttpResponseHeader.cs
- WizardPanel.cs
- ScopeCompiler.cs
- AdornerDecorator.cs
- SimpleWorkerRequest.cs
- CollectionConverter.cs
- FuncTypeConverter.cs
- ServiceBehaviorElementCollection.cs
- DataGridViewButtonCell.cs
- XmlSerializationWriter.cs
- CompoundFileReference.cs
- JsonQueryStringConverter.cs