Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / ReferenceTypeElement.cs / 1305376 / ReferenceTypeElement.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 ReferenceTypeElement : ModelFunctionTypeElement { #region constructor ////// /// /// internal ReferenceTypeElement(SchemaElement parentElement) : base(parentElement) { } #endregion protected override bool HandleAttribute(XmlReader reader) { if (base.HandleAttribute(reader)) { return true; } else if (CanHandleAttribute(reader, XmlConstants.TypeElement)) { HandleTypeElementAttribute(reader); return true; } return false; } protected void HandleTypeElementAttribute(XmlReader reader) { Debug.Assert(reader != null); string type; if (!Utils.GetString(Schema, reader, out type)) return; _unresolvedType = type; } internal override void WriteIdentity(StringBuilder builder) { Debug.Assert(UnresolvedType != null && !UnresolvedType.Trim().Equals(String.Empty)); builder.Append("Ref(" + UnresolvedType + ")"); } internal override TypeUsage GetTypeUsage() { return _typeUsage; } internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, DictionarynewGlobalItems) { if (_typeUsage == null) { Debug.Assert(!(_type is ScalarType)); EdmType edmType = (EdmType)Converter.LoadSchemaElement(_type, _type.Schema.ProviderManifest, convertedItemCache, newGlobalItems); EntityType entityType = edmType as EntityType; Debug.Assert(entityType != null); RefType refType = new RefType(entityType); refType.AddMetadataProperties(this.OtherContent); _typeUsage = TypeUsage.Create(refType); } return true; } internal override void Validate() { base.Validate(); if (_type != null && !(_type is SchemaEntityType)) { //Ref type refers to non entity type AddError(ErrorCode.ReferenceToNonEntityType, EdmSchemaErrorSeverity.Error, Strings.ReferenceToNonEntityType(_type.FQName)); } } } } // 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 ReferenceTypeElement : ModelFunctionTypeElement { #region constructor ////// /// /// internal ReferenceTypeElement(SchemaElement parentElement) : base(parentElement) { } #endregion protected override bool HandleAttribute(XmlReader reader) { if (base.HandleAttribute(reader)) { return true; } else if (CanHandleAttribute(reader, XmlConstants.TypeElement)) { HandleTypeElementAttribute(reader); return true; } return false; } protected void HandleTypeElementAttribute(XmlReader reader) { Debug.Assert(reader != null); string type; if (!Utils.GetString(Schema, reader, out type)) return; _unresolvedType = type; } internal override void WriteIdentity(StringBuilder builder) { Debug.Assert(UnresolvedType != null && !UnresolvedType.Trim().Equals(String.Empty)); builder.Append("Ref(" + UnresolvedType + ")"); } internal override TypeUsage GetTypeUsage() { return _typeUsage; } internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, DictionarynewGlobalItems) { if (_typeUsage == null) { Debug.Assert(!(_type is ScalarType)); EdmType edmType = (EdmType)Converter.LoadSchemaElement(_type, _type.Schema.ProviderManifest, convertedItemCache, newGlobalItems); EntityType entityType = edmType as EntityType; Debug.Assert(entityType != null); RefType refType = new RefType(entityType); refType.AddMetadataProperties(this.OtherContent); _typeUsage = TypeUsage.Create(refType); } return true; } internal override void Validate() { base.Validate(); if (_type != null && !(_type is SchemaEntityType)) { //Ref type refers to non entity type AddError(ErrorCode.ReferenceToNonEntityType, EdmSchemaErrorSeverity.Error, Strings.ReferenceToNonEntityType(_type.FQName)); } } } } // 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
- DynamicDataRouteHandler.cs
- GestureRecognitionResult.cs
- LocalFileSettingsProvider.cs
- MonthCalendar.cs
- Ticks.cs
- sqlstateclientmanager.cs
- PolicyUnit.cs
- PathHelper.cs
- LogicalExpr.cs
- DefaultPrintController.cs
- HyperLinkStyle.cs
- RequiredFieldValidator.cs
- KnownBoxes.cs
- ConnectionPointCookie.cs
- TextSegment.cs
- AttributeConverter.cs
- InputLangChangeRequestEvent.cs
- MatrixKeyFrameCollection.cs
- PartManifestEntry.cs
- SpAudioStreamWrapper.cs
- AssociationTypeEmitter.cs
- UniqueIdentifierService.cs
- StreamInfo.cs
- XmlSchemaValidator.cs
- DocobjHost.cs
- SchemaCollectionCompiler.cs
- DataViewManager.cs
- BaseServiceProvider.cs
- ConfigurationManagerInternalFactory.cs
- GroupPartitionExpr.cs
- DocumentApplicationJournalEntry.cs
- AbsoluteQuery.cs
- ExpressionLexer.cs
- OdbcConnectionHandle.cs
- ServiceContractViewControl.Designer.cs
- Emitter.cs
- MemberJoinTreeNode.cs
- TileBrush.cs
- ToolStripPanelCell.cs
- TriState.cs
- ComPlusAuthorization.cs
- BindUriHelper.cs
- Common.cs
- ReachNamespaceInfo.cs
- ImageKeyConverter.cs
- ExceptionUtility.cs
- InputLangChangeEvent.cs
- PasswordTextNavigator.cs
- StringPropertyBuilder.cs
- SystemThemeKey.cs
- DecoderNLS.cs
- CannotUnloadAppDomainException.cs
- SendSecurityHeader.cs
- TreeViewHitTestInfo.cs
- NullReferenceException.cs
- HtmlUtf8RawTextWriter.cs
- TemplateControlCodeDomTreeGenerator.cs
- HttpModulesSection.cs
- FrameDimension.cs
- LassoSelectionBehavior.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- Repeater.cs
- DataPagerFieldCollection.cs
- OracleInfoMessageEventArgs.cs
- SafeCryptoHandles.cs
- _BaseOverlappedAsyncResult.cs
- FixedDocumentSequencePaginator.cs
- ClientConfigPaths.cs
- CompiledIdentityConstraint.cs
- ParsedAttributeCollection.cs
- SqlXml.cs
- ServerIdentity.cs
- PageOutputQuality.cs
- ACL.cs
- TextOutput.cs
- ImageCodecInfoPrivate.cs
- TypeSchema.cs
- Point4D.cs
- MultiAsyncResult.cs
- Converter.cs
- XmlSubtreeReader.cs
- XmlSchemaElement.cs
- UIElementPropertyUndoUnit.cs
- ByeMessageCD1.cs
- ContextMenuStripGroupCollection.cs
- ConfigurationManagerInternalFactory.cs
- UrlMapping.cs
- AccessDataSourceView.cs
- TableCellCollection.cs
- PrintEvent.cs
- EmptyEnumerator.cs
- DesignerCategoryAttribute.cs
- XhtmlBasicLabelAdapter.cs
- filewebresponse.cs
- IconBitmapDecoder.cs
- ReaderContextStackData.cs
- WebPartHelpVerb.cs
- SchemaTypeEmitter.cs
- XmlCollation.cs
- ExternalException.cs