Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / ReturnType.cs / 2 / ReturnType.cs
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; namespace System.Data.EntityModel.SchemaObjectModel { class ReturnType : FacetEnabledSchemaElement { #region constructor ////// /// /// internal ReturnType(Function parentElement) : base(parentElement) { _typeUsageBuilder = new TypeUsageBuilder(this); } #endregion internal override SchemaElement Clone(SchemaElement parentElement) { ReturnType parameter = new ReturnType((Function)parentElement); parameter._type = _type; parameter.Name = this.Name; parameter._typeUsageBuilder = this._typeUsageBuilder; parameter._unresolvedType = this._unresolvedType; return parameter; } protected override bool HandleAttribute(XmlReader reader) { if (base.HandleAttribute(reader)) { return true; } else if (CanHandleAttribute(reader, XmlConstants.TypeElement)) { HandleTypeAttribute(reader); return true; } return false; } #region Private Methods ////// /// /// private void HandleTypeAttribute(XmlReader reader) { Debug.Assert(reader != null); Debug.Assert(this._unresolvedType == null); string type; if (!Utils.GetString(Schema, reader, out type)) return; if (!Utils.ValidateDottedName(Schema, reader, type)) return; this.UnresolvedType = type; } #endregion internal override void ResolveTopLevelNames() { Debug.Assert(!this.ParentElement.IsFunctionImport, "FunctionImports have return type as an attribute, so we should NEVER see them here"); base.ResolveTopLevelNames(); if (Schema.ResolveTypeName(this, UnresolvedType, out _type)) { if (!(_type is ScalarType)) { if (Schema.DataModel != SchemaDataModelOption.ProviderManifestModel) { AddError(ErrorCode.FunctionWithNonScalarTypeNotSupported, EdmSchemaErrorSeverity.Error, this, System.Data.Entity.Strings.FunctionWithNonScalarTypeNotSupported(_type.FQName, this.FQName)); } else { AddError(ErrorCode.FunctionWithNonScalarTypeNotSupported, EdmSchemaErrorSeverity.Error, this, System.Data.Entity.Strings.FunctionWithNonEdmTypeNotSupported(_type.FQName, this.FQName)); } } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. 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; namespace System.Data.EntityModel.SchemaObjectModel { class ReturnType : FacetEnabledSchemaElement { #region constructor ////// /// /// internal ReturnType(Function parentElement) : base(parentElement) { _typeUsageBuilder = new TypeUsageBuilder(this); } #endregion internal override SchemaElement Clone(SchemaElement parentElement) { ReturnType parameter = new ReturnType((Function)parentElement); parameter._type = _type; parameter.Name = this.Name; parameter._typeUsageBuilder = this._typeUsageBuilder; parameter._unresolvedType = this._unresolvedType; return parameter; } protected override bool HandleAttribute(XmlReader reader) { if (base.HandleAttribute(reader)) { return true; } else if (CanHandleAttribute(reader, XmlConstants.TypeElement)) { HandleTypeAttribute(reader); return true; } return false; } #region Private Methods ////// /// /// private void HandleTypeAttribute(XmlReader reader) { Debug.Assert(reader != null); Debug.Assert(this._unresolvedType == null); string type; if (!Utils.GetString(Schema, reader, out type)) return; if (!Utils.ValidateDottedName(Schema, reader, type)) return; this.UnresolvedType = type; } #endregion internal override void ResolveTopLevelNames() { Debug.Assert(!this.ParentElement.IsFunctionImport, "FunctionImports have return type as an attribute, so we should NEVER see them here"); base.ResolveTopLevelNames(); if (Schema.ResolveTypeName(this, UnresolvedType, out _type)) { if (!(_type is ScalarType)) { if (Schema.DataModel != SchemaDataModelOption.ProviderManifestModel) { AddError(ErrorCode.FunctionWithNonScalarTypeNotSupported, EdmSchemaErrorSeverity.Error, this, System.Data.Entity.Strings.FunctionWithNonScalarTypeNotSupported(_type.FQName, this.FQName)); } else { AddError(ErrorCode.FunctionWithNonScalarTypeNotSupported, EdmSchemaErrorSeverity.Error, this, System.Data.Entity.Strings.FunctionWithNonEdmTypeNotSupported(_type.FQName, this.FQName)); } } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HtmlElement.cs
- SHA384.cs
- CombinedGeometry.cs
- ProxyWebPartConnectionCollection.cs
- ContentType.cs
- MouseEventArgs.cs
- ContactManager.cs
- TextPointer.cs
- CheckBoxField.cs
- AccessibilityHelperForVista.cs
- XamlSerializerUtil.cs
- XmlNullResolver.cs
- PageAsyncTaskManager.cs
- BuildProvider.cs
- dtdvalidator.cs
- RegularExpressionValidator.cs
- RouteParser.cs
- PrePrepareMethodAttribute.cs
- NameValueConfigurationElement.cs
- TailPinnedEventArgs.cs
- RegexCapture.cs
- XmlBinaryReader.cs
- HashLookup.cs
- TextTrailingWordEllipsis.cs
- GlobalizationSection.cs
- ApplicationContext.cs
- ParameterModifier.cs
- DSACryptoServiceProvider.cs
- ConnectionStringSettings.cs
- ButtonChrome.cs
- UserControlParser.cs
- SchemaCollectionCompiler.cs
- WebPartHeaderCloseVerb.cs
- ContextMenu.cs
- CrossContextChannel.cs
- HostingEnvironmentException.cs
- PrintControllerWithStatusDialog.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- LineSegment.cs
- ModelTreeEnumerator.cs
- FixedSOMTable.cs
- DictionarySectionHandler.cs
- MethodCallConverter.cs
- ConfigurationValues.cs
- ServiceOperationWrapper.cs
- MaskPropertyEditor.cs
- XmlCDATASection.cs
- LoginUtil.cs
- _Connection.cs
- FileNameEditor.cs
- TableLayoutStyleCollection.cs
- XmlDomTextWriter.cs
- Font.cs
- TransactionContextValidator.cs
- AmbientValueAttribute.cs
- ModulesEntry.cs
- RedBlackList.cs
- RoleGroup.cs
- TripleDES.cs
- precedingquery.cs
- _SSPISessionCache.cs
- ComponentEvent.cs
- AttachedAnnotation.cs
- ColorAnimationUsingKeyFrames.cs
- StringExpressionSet.cs
- StringReader.cs
- SQLRoleProvider.cs
- TransactionManager.cs
- SafeCertificateContext.cs
- ServiceOperation.cs
- AuthenticationSection.cs
- ReliableSession.cs
- SchemaAttDef.cs
- TrackingStringDictionary.cs
- AssemblyCache.cs
- TableItemPattern.cs
- SQLInt16.cs
- AdornedElementPlaceholder.cs
- XmlSchemaSimpleType.cs
- BooleanConverter.cs
- ForceCopyBuildProvider.cs
- Hash.cs
- FileLogRecordStream.cs
- XPathBinder.cs
- DataRelationPropertyDescriptor.cs
- ContractReference.cs
- CompatibleComparer.cs
- AmbientValueAttribute.cs
- WindowsStreamSecurityElement.cs
- Model3DGroup.cs
- CSharpCodeProvider.cs
- DomNameTable.cs
- DocumentGrid.cs
- RtfToken.cs
- AjaxFrameworkAssemblyAttribute.cs
- ViewManager.cs
- TemplateBindingExtension.cs
- MailDefinitionBodyFileNameEditor.cs
- EnumDataContract.cs
- OracleDataAdapter.cs