Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / ReferentialConstraintRoleElement.cs / 1305376 / ReferentialConstraintRoleElement.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Xml; using System.Data; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.SchemaObjectModel { ////// Represents an role element in referential constraint element. /// internal sealed class ReferentialConstraintRoleElement : SchemaElement { private List_roleProperties; private IRelationshipEnd _end; /// /// Constructs an EntityContainerAssociationSetEnd /// /// Reference to the schema element. public ReferentialConstraintRoleElement(ReferentialConstraint parentElement) : base( parentElement ) { } public IListRoleProperties { get { if (_roleProperties == null) { _roleProperties = new List (); } return _roleProperties; } } public IRelationshipEnd End { get { return _end; } } protected override bool HandleElement(XmlReader reader) { if (base.HandleElement(reader)) { return true; } else if (CanHandleElement(reader, XmlConstants.PropertyRef)) { HandlePropertyRefElement(reader); return true; } return false; } protected override bool HandleAttribute(XmlReader reader) { if (CanHandleAttribute(reader, XmlConstants.Role)) { HandleRoleAttribute(reader); return true; } return false; } /// /// /// /// private void HandlePropertyRefElement(XmlReader reader) { PropertyRefElement property = new PropertyRefElement(ParentElement); property.Parse(reader); this.RoleProperties.Add(property); } private void HandleRoleAttribute(XmlReader reader) { string roleName; Utils.GetString(Schema, reader, out roleName); this.Name = roleName; } ////// Used during the resolve phase to resolve the type name to the object that represents that type /// internal override void ResolveTopLevelNames() { Debug.Assert(!String.IsNullOrEmpty(this.Name), "RoleName should never be empty"); IRelationship relationship = (IRelationship)this.ParentElement.ParentElement; if (!relationship.TryGetEnd(this.Name, out _end)) { AddError(ErrorCode.InvalidRoleInRelationshipConstraint, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.InvalidEndRoleInRelationshipConstraint(this.Name, relationship.Name)); return; } // we are gauranteed that the _end has gone through ResolveNames, but // we are not gauranteed that it was successful if (_end.Type == null) { // an error has already been added for this return; } } internal override void Validate() { base.Validate(); // we can't resolve these names until validate because they will reference properties and types // that may not be resolved when this objects ResolveNames gets called Debug.Assert(_roleProperties != null, "xsd should have verified that there should be atleast one property ref element in referential role element"); foreach (PropertyRefElement property in _roleProperties) { if (!property.ResolveNames((SchemaEntityType)_end.Type)) { AddError(ErrorCode.InvalidPropertyInRelationshipConstraint, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.InvalidPropertyInRelationshipConstraint( property.Name, this.Name)); } } } } } // 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
- ParserHooks.cs
- EditorPartCollection.cs
- ResolvedKeyFrameEntry.cs
- BaseDataBoundControl.cs
- MatrixAnimationUsingPath.cs
- DataGridViewCellCancelEventArgs.cs
- Control.cs
- SqlDataSourceCache.cs
- MbpInfo.cs
- ProxyElement.cs
- WebPartDeleteVerb.cs
- X509PeerCertificateAuthentication.cs
- PerformanceCounterNameAttribute.cs
- SymbolType.cs
- OdbcConnectionPoolProviderInfo.cs
- BehaviorEditorPart.cs
- WebPartMenu.cs
- ProvidersHelper.cs
- CompiledIdentityConstraint.cs
- Baml2006ReaderSettings.cs
- ClientSettings.cs
- TextSelectionHelper.cs
- WarningException.cs
- RowsCopiedEventArgs.cs
- HtmlImageAdapter.cs
- PostBackOptions.cs
- BindUriHelper.cs
- IsolatedStorageFileStream.cs
- TableAdapterManagerNameHandler.cs
- RepeatBehaviorConverter.cs
- BulletedListEventArgs.cs
- StringPropertyBuilder.cs
- WindowsIdentity.cs
- XmlDocumentSerializer.cs
- ToolbarAUtomationPeer.cs
- SystemMulticastIPAddressInformation.cs
- BehaviorEditorPart.cs
- RowUpdatingEventArgs.cs
- ProfileSettings.cs
- Win32Native.cs
- Mapping.cs
- Interfaces.cs
- ComponentEditorPage.cs
- JournalEntryStack.cs
- BitmapFrameEncode.cs
- SqlInternalConnection.cs
- ItemContainerGenerator.cs
- X509CertificateCollection.cs
- DbConnectionPoolIdentity.cs
- GenericIdentity.cs
- RouteParameter.cs
- LinqDataSourceEditData.cs
- MatrixTransform.cs
- BeginEvent.cs
- TextViewDesigner.cs
- ExclusiveTcpTransportManager.cs
- TTSEvent.cs
- CodeCommentStatementCollection.cs
- MemberHolder.cs
- GPRECT.cs
- RuntimeCompatibilityAttribute.cs
- followingsibling.cs
- VisualBasicSettingsHandler.cs
- ScriptResourceHandler.cs
- GridItemCollection.cs
- BrowsableAttribute.cs
- AccessDataSource.cs
- HtmlInputPassword.cs
- StandardCommands.cs
- DataKey.cs
- DashStyle.cs
- KeyboardDevice.cs
- JsonByteArrayDataContract.cs
- DataGridViewImageColumn.cs
- FacetEnabledSchemaElement.cs
- ResourceCodeDomSerializer.cs
- DataListDesigner.cs
- QilGeneratorEnv.cs
- TextPointerBase.cs
- SqlCacheDependencySection.cs
- MobileTextWriter.cs
- SessionEndedEventArgs.cs
- XmlSchemaFacet.cs
- CertificateReferenceElement.cs
- TextTreeFixupNode.cs
- FreezableOperations.cs
- XmlKeywords.cs
- DynamicResourceExtensionConverter.cs
- SqlDataAdapter.cs
- EmbossBitmapEffect.cs
- Parsers.cs
- EntityCommandCompilationException.cs
- DataListItem.cs
- GridViewRow.cs
- IndependentAnimationStorage.cs
- AutoResetEvent.cs
- ArrayHelper.cs
- VirtualDirectoryMapping.cs
- Encoder.cs
- OdbcEnvironment.cs