Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / ReturnType.cs / 1 / 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
- MeasureData.cs
- ReaderWriterLock.cs
- HttpGetProtocolReflector.cs
- WaitForChangedResult.cs
- HashCodeCombiner.cs
- Symbol.cs
- Storyboard.cs
- securitycriticaldata.cs
- RenderContext.cs
- DiscriminatorMap.cs
- DataGridViewCheckBoxCell.cs
- ParagraphVisual.cs
- PerfService.cs
- TextDocumentView.cs
- UnknownWrapper.cs
- IIS7WorkerRequest.cs
- SegmentTree.cs
- SafeBitVector32.cs
- ProviderConnectionPoint.cs
- SafePEFileHandle.cs
- DayRenderEvent.cs
- HtmlElementEventArgs.cs
- New.cs
- RunInstallerAttribute.cs
- AppSettingsReader.cs
- XmlFormatReaderGenerator.cs
- PhonemeConverter.cs
- DrawingContext.cs
- FormViewUpdateEventArgs.cs
- DataGridViewComboBoxCell.cs
- EntityViewContainer.cs
- XmlDataLoader.cs
- SqlConnectionStringBuilder.cs
- DateTimeOffsetConverter.cs
- LoginViewDesigner.cs
- ObjectStorage.cs
- SerializationInfo.cs
- DataGridViewButtonCell.cs
- RtfFormatStack.cs
- VirtualPathProvider.cs
- StructuralCache.cs
- Item.cs
- MarkedHighlightComponent.cs
- HwndStylusInputProvider.cs
- Peer.cs
- Rule.cs
- VBCodeProvider.cs
- ParseChildrenAsPropertiesAttribute.cs
- WebPartHeaderCloseVerb.cs
- CommonObjectSecurity.cs
- EntityViewContainer.cs
- LinkLabel.cs
- SchemaAttDef.cs
- AxHostDesigner.cs
- DataServiceProviderMethods.cs
- TextTrailingCharacterEllipsis.cs
- RootAction.cs
- BindingNavigator.cs
- SqlRemoveConstantOrderBy.cs
- DataTable.cs
- CompModSwitches.cs
- RelationshipConverter.cs
- DataKeyCollection.cs
- HitTestWithPointDrawingContextWalker.cs
- PathFigure.cs
- RSAOAEPKeyExchangeDeformatter.cs
- SQlBooleanStorage.cs
- ListItemCollection.cs
- WmiEventSink.cs
- TimeEnumHelper.cs
- LoadGrammarCompletedEventArgs.cs
- documentsequencetextpointer.cs
- CompositeDataBoundControl.cs
- IFlowDocumentViewer.cs
- RequiredAttributeAttribute.cs
- ContentPresenter.cs
- ModuleBuilderData.cs
- ConstraintStruct.cs
- PlatformNotSupportedException.cs
- ListViewEditEventArgs.cs
- Converter.cs
- RtType.cs
- HtmlTableRow.cs
- FixUpCollection.cs
- TimeoutHelper.cs
- CheckableControlBaseAdapter.cs
- StateFinalizationActivity.cs
- PackageStore.cs
- AssemblyAssociatedContentFileAttribute.cs
- XmlException.cs
- TextFormatterHost.cs
- InvalidateEvent.cs
- TextBounds.cs
- SerialErrors.cs
- BinaryObjectWriter.cs
- AssociationEndMember.cs
- AutoCompleteStringCollection.cs
- RadioButtonRenderer.cs
- Listbox.cs
- CommonProperties.cs