Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / RowTypeElement.cs / 1305376 / RowTypeElement.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using Som = System.Data.EntityModel.SchemaObjectModel; using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.Xml; using System.Xml.Schema; using System.Data; using System.IO; using System.Data.Metadata.Edm; using System.Data.Entity; using System.Text; namespace System.Data.EntityModel.SchemaObjectModel { class RowTypeElement : ModelFunctionTypeElement { private SchemaElementLookUpTable_properties = new SchemaElementLookUpTable (); #region constructor /// /// /// /// internal RowTypeElement(SchemaElement parentElement) : base(parentElement) { } protected override bool HandleElement(XmlReader reader) { if (CanHandleElement(reader, XmlConstants.Property)) { HandlePropertyElement(reader); return true; } return false; } protected void HandlePropertyElement(XmlReader reader) { Debug.Assert(reader != null); var property = new RowTypePropertyElement(this); property.Parse(reader); _properties.Add(property, true, Strings.DuplicateEntityContainerMemberName /**/); } #endregion internal override void ResolveTopLevelNames() { foreach (var property in _properties) { property.ResolveTopLevelNames(); } } internal override void WriteIdentity(StringBuilder builder) { builder.Append("Row["); bool first = true; foreach (RowTypePropertyElement property in _properties) { if (first) { first = !first; } else { builder.Append(", "); } property.WriteIdentity(builder); } builder.Append("]"); } internal override TypeUsage GetTypeUsage() { if (_typeUsage == null) { var listOfProperties = new List(); foreach (var property in _properties) { var edmProperty = new EdmProperty(property.FQName, property.GetTypeUsage()); edmProperty.AddMetadataProperties(property.OtherContent); //edmProperty.DeclaringType listOfProperties.Add(edmProperty); } RowType rowType = new RowType(listOfProperties); rowType.DataSpace = DataSpace.CSpace; rowType.AddMetadataProperties(this.OtherContent); _typeUsage = TypeUsage.Create(rowType); } return _typeUsage; } internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, Dictionary newGlobalItems) { bool result = true; if (_typeUsage == null) { foreach (var property in _properties) { if (!property.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems)) { result = false; } } } return result; } internal override void Validate() { foreach (var property in _properties) { property.Validate(); } if (_properties.Count == 0) { AddError(ErrorCode.RowTypeWithoutProperty, EdmSchemaErrorSeverity.Error, Strings.RowTypeWithoutProperty); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using Som = System.Data.EntityModel.SchemaObjectModel; using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.Xml; using System.Xml.Schema; using System.Data; using System.IO; using System.Data.Metadata.Edm; using System.Data.Entity; using System.Text; namespace System.Data.EntityModel.SchemaObjectModel { class RowTypeElement : ModelFunctionTypeElement { private SchemaElementLookUpTable_properties = new SchemaElementLookUpTable (); #region constructor /// /// /// /// internal RowTypeElement(SchemaElement parentElement) : base(parentElement) { } protected override bool HandleElement(XmlReader reader) { if (CanHandleElement(reader, XmlConstants.Property)) { HandlePropertyElement(reader); return true; } return false; } protected void HandlePropertyElement(XmlReader reader) { Debug.Assert(reader != null); var property = new RowTypePropertyElement(this); property.Parse(reader); _properties.Add(property, true, Strings.DuplicateEntityContainerMemberName /**/); } #endregion internal override void ResolveTopLevelNames() { foreach (var property in _properties) { property.ResolveTopLevelNames(); } } internal override void WriteIdentity(StringBuilder builder) { builder.Append("Row["); bool first = true; foreach (RowTypePropertyElement property in _properties) { if (first) { first = !first; } else { builder.Append(", "); } property.WriteIdentity(builder); } builder.Append("]"); } internal override TypeUsage GetTypeUsage() { if (_typeUsage == null) { var listOfProperties = new List(); foreach (var property in _properties) { var edmProperty = new EdmProperty(property.FQName, property.GetTypeUsage()); edmProperty.AddMetadataProperties(property.OtherContent); //edmProperty.DeclaringType listOfProperties.Add(edmProperty); } RowType rowType = new RowType(listOfProperties); rowType.DataSpace = DataSpace.CSpace; rowType.AddMetadataProperties(this.OtherContent); _typeUsage = TypeUsage.Create(rowType); } return _typeUsage; } internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, Dictionary newGlobalItems) { bool result = true; if (_typeUsage == null) { foreach (var property in _properties) { if (!property.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems)) { result = false; } } } return result; } internal override void Validate() { foreach (var property in _properties) { property.Validate(); } if (_properties.Count == 0) { AddError(ErrorCode.RowTypeWithoutProperty, EdmSchemaErrorSeverity.Error, Strings.RowTypeWithoutProperty); } } } } // 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
- DesignerForm.cs
- PenLineJoinValidation.cs
- ErrorWebPart.cs
- IOException.cs
- PaperSource.cs
- EffectiveValueEntry.cs
- CodeDefaultValueExpression.cs
- PictureBox.cs
- ObjectPropertyMapping.cs
- TypeUtil.cs
- InteropAutomationProvider.cs
- MailFileEditor.cs
- ValidationHelper.cs
- RoutedEventValueSerializer.cs
- AuthenticationService.cs
- XmlSchemaComplexContentExtension.cs
- SizeAnimationUsingKeyFrames.cs
- StructuredType.cs
- StylusDownEventArgs.cs
- ConfigurationLocationCollection.cs
- GenericTypeParameterBuilder.cs
- WebPartEditorOkVerb.cs
- Margins.cs
- UnconditionalPolicy.cs
- TypeUtil.cs
- WebServiceTypeData.cs
- Int32Collection.cs
- IsolatedStorageFilePermission.cs
- FormsIdentity.cs
- CollectionViewGroup.cs
- Pen.cs
- CompositeFontParser.cs
- ValidationSummaryDesigner.cs
- WmlMobileTextWriter.cs
- PersonalizableAttribute.cs
- DataPagerCommandEventArgs.cs
- TableLayout.cs
- SafeBitVector32.cs
- AssemblyAssociatedContentFileAttribute.cs
- RtfToXamlReader.cs
- DrawingDrawingContext.cs
- SamlAuthenticationStatement.cs
- DateTimeConverter.cs
- StateDesigner.TransitionInfo.cs
- ExpressionBuilder.cs
- WindowsIPAddress.cs
- StylusDownEventArgs.cs
- ButtonBaseDesigner.cs
- Menu.cs
- RayMeshGeometry3DHitTestResult.cs
- AssemblyHash.cs
- EncodingTable.cs
- InkCanvasSelectionAdorner.cs
- HtmlMeta.cs
- DesignerCategoryAttribute.cs
- WindowsSlider.cs
- DesignerUtility.cs
- GridViewRowCollection.cs
- TemplatePagerField.cs
- ProcessHostServerConfig.cs
- Boolean.cs
- TogglePatternIdentifiers.cs
- DataSourceCacheDurationConverter.cs
- Vector3DAnimationUsingKeyFrames.cs
- DefaultBinder.cs
- TextChange.cs
- WrapPanel.cs
- MD5Cng.cs
- ObjectDataSourceFilteringEventArgs.cs
- AffineTransform3D.cs
- IPGlobalProperties.cs
- Span.cs
- X500Name.cs
- DataViewManager.cs
- DoubleAnimationUsingKeyFrames.cs
- X509Certificate2Collection.cs
- Pkcs7Recipient.cs
- OpenTypeLayoutCache.cs
- WindowsFormsLinkLabel.cs
- sqlstateclientmanager.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- WebPartDisplayModeCollection.cs
- HttpApplicationFactory.cs
- Line.cs
- TransformerInfo.cs
- FileCodeGroup.cs
- XmlSignatureProperties.cs
- TextDocumentView.cs
- SiteMapNodeItemEventArgs.cs
- DesignerHost.cs
- WsatEtwTraceListener.cs
- BufferModesCollection.cs
- XPathException.cs
- ExclusiveCanonicalizationTransform.cs
- SqlUserDefinedAggregateAttribute.cs
- DNS.cs
- _SecureChannel.cs
- EventManager.cs
- TextSpan.cs
- CategoryAttribute.cs