Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / Parameter.cs / 1 / Parameter.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;
using System.Reflection;
using System.IO;
using System.Globalization;
namespace System.Data.EntityModel.SchemaObjectModel
{
///
/// Summary description for StructuredProperty.
///
internal class Parameter : FacetEnabledSchemaElement
{
#region Instance Fields
private ParameterDirection _parameterDirection = ParameterDirection.Input;
private CollectionKind _collectionKind = CollectionKind.None;
#endregion
#region constructor
///
///
///
///
internal Parameter(Function parentElement)
: base(parentElement)
{
_typeUsageBuilder = new TypeUsageBuilder(this);
}
#endregion
#region Public Properties
public ParameterDirection ParameterDirection
{
get
{
return _parameterDirection;
}
}
public CollectionKind CollectionKind
{
get
{
return _collectionKind;
}
internal set
{
_collectionKind = value;
}
}
#endregion
internal override SchemaElement Clone(SchemaElement parentElement)
{
Parameter parameter = new Parameter((Function)parentElement);
parameter._collectionKind = _collectionKind;
parameter._parameterDirection = _parameterDirection;
parameter._type = _type;
parameter.Name = this.Name;
parameter._typeUsageBuilder = this._typeUsageBuilder;
return parameter;
}
protected override bool HandleAttribute(XmlReader reader)
{
if (base.HandleAttribute(reader))
{
return true;
}
else if (CanHandleAttribute(reader, XmlConstants.TypeElement))
{
HandleTypeAttribute(reader);
return true;
}
else if (CanHandleAttribute(reader, XmlConstants.Mode))
{
HandleModeAttribute(reader);
return true;
}
else if (_typeUsageBuilder.HandleAttribute(reader))
{
return true;
}
return false;
}
#region Private Methods
private void HandleTypeAttribute(XmlReader reader)
{
Debug.Assert(reader != null);
Debug.Assert(UnresolvedType == null);
string type;
if (!Utils.GetString(Schema, reader, out type))
return;
switch (Function.RemoveTypeModifier(ref type))
{
case TypeModifier.Array:
CollectionKind = CollectionKind.Bag;
break;
case TypeModifier.None:
break;
default:
AddError(ErrorCode.BadType, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.BadTypeModifier(FQName, reader.Value));
break;
}
if (!Utils.ValidateDottedName(Schema, reader, type))
return;
UnresolvedType = type;
}
private void HandleModeAttribute(XmlReader reader)
{
Debug.Assert(reader != null);
string value = reader.Value;
if (String.IsNullOrEmpty(value))
{
return;
}
value = value.Trim();
if (!String.IsNullOrEmpty(value))
{
switch (value)
{
case XmlConstants.In:
_parameterDirection = ParameterDirection.Input;
break;
case XmlConstants.Out:
_parameterDirection = ParameterDirection.Output;
break;
case XmlConstants.InOut:
_parameterDirection = ParameterDirection.InputOutput;
break;
default:
{
// don't try to identify the parameter by any of the attributes
// because we are still parsing attributes, and we don't know which ones
// have been parsed yet.
int index = ParentElement.Parameters.Count;
AddError(ErrorCode.BadParameterDirection, EdmSchemaErrorSeverity.Error, reader,
System.Data.Entity.Strings.BadParameterDirection(
value,
index,
this.ParentElement.Name,
this.ParentElement.ParentElement.FQName));
}
break;
}
}
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// 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;
using System.Reflection;
using System.IO;
using System.Globalization;
namespace System.Data.EntityModel.SchemaObjectModel
{
///
/// Summary description for StructuredProperty.
///
internal class Parameter : FacetEnabledSchemaElement
{
#region Instance Fields
private ParameterDirection _parameterDirection = ParameterDirection.Input;
private CollectionKind _collectionKind = CollectionKind.None;
#endregion
#region constructor
///
///
///
///
internal Parameter(Function parentElement)
: base(parentElement)
{
_typeUsageBuilder = new TypeUsageBuilder(this);
}
#endregion
#region Public Properties
public ParameterDirection ParameterDirection
{
get
{
return _parameterDirection;
}
}
public CollectionKind CollectionKind
{
get
{
return _collectionKind;
}
internal set
{
_collectionKind = value;
}
}
#endregion
internal override SchemaElement Clone(SchemaElement parentElement)
{
Parameter parameter = new Parameter((Function)parentElement);
parameter._collectionKind = _collectionKind;
parameter._parameterDirection = _parameterDirection;
parameter._type = _type;
parameter.Name = this.Name;
parameter._typeUsageBuilder = this._typeUsageBuilder;
return parameter;
}
protected override bool HandleAttribute(XmlReader reader)
{
if (base.HandleAttribute(reader))
{
return true;
}
else if (CanHandleAttribute(reader, XmlConstants.TypeElement))
{
HandleTypeAttribute(reader);
return true;
}
else if (CanHandleAttribute(reader, XmlConstants.Mode))
{
HandleModeAttribute(reader);
return true;
}
else if (_typeUsageBuilder.HandleAttribute(reader))
{
return true;
}
return false;
}
#region Private Methods
private void HandleTypeAttribute(XmlReader reader)
{
Debug.Assert(reader != null);
Debug.Assert(UnresolvedType == null);
string type;
if (!Utils.GetString(Schema, reader, out type))
return;
switch (Function.RemoveTypeModifier(ref type))
{
case TypeModifier.Array:
CollectionKind = CollectionKind.Bag;
break;
case TypeModifier.None:
break;
default:
AddError(ErrorCode.BadType, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.BadTypeModifier(FQName, reader.Value));
break;
}
if (!Utils.ValidateDottedName(Schema, reader, type))
return;
UnresolvedType = type;
}
private void HandleModeAttribute(XmlReader reader)
{
Debug.Assert(reader != null);
string value = reader.Value;
if (String.IsNullOrEmpty(value))
{
return;
}
value = value.Trim();
if (!String.IsNullOrEmpty(value))
{
switch (value)
{
case XmlConstants.In:
_parameterDirection = ParameterDirection.Input;
break;
case XmlConstants.Out:
_parameterDirection = ParameterDirection.Output;
break;
case XmlConstants.InOut:
_parameterDirection = ParameterDirection.InputOutput;
break;
default:
{
// don't try to identify the parameter by any of the attributes
// because we are still parsing attributes, and we don't know which ones
// have been parsed yet.
int index = ParentElement.Parameters.Count;
AddError(ErrorCode.BadParameterDirection, EdmSchemaErrorSeverity.Error, reader,
System.Data.Entity.Strings.BadParameterDirection(
value,
index,
this.ParentElement.Name,
this.ParentElement.ParentElement.FQName));
}
break;
}
}
}
#endregion
}
}
// 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
- DbExpressionVisitor_TResultType.cs
- HttpClientCertificate.cs
- TreeViewItemAutomationPeer.cs
- EntityDataSourceChangingEventArgs.cs
- TimeSpanMinutesConverter.cs
- ToolConsole.cs
- PropertyGroupDescription.cs
- UiaCoreTypesApi.cs
- MatrixAnimationBase.cs
- VirtualPath.cs
- BinHexDecoder.cs
- IIS7UserPrincipal.cs
- MessagePropertyDescription.cs
- DocumentViewerConstants.cs
- FixedFindEngine.cs
- EdgeModeValidation.cs
- TitleStyle.cs
- FamilyTypefaceCollection.cs
- CachedPathData.cs
- GridViewActionList.cs
- DispatchWrapper.cs
- SmtpFailedRecipientException.cs
- PackageFilter.cs
- JournalEntryListConverter.cs
- messageonlyhwndwrapper.cs
- DatatypeImplementation.cs
- IsolatedStorageException.cs
- PngBitmapDecoder.cs
- ToolStripContentPanelRenderEventArgs.cs
- RuleSetCollection.cs
- FindCompletedEventArgs.cs
- CurrentTimeZone.cs
- ExceptionDetail.cs
- DataTemplateSelector.cs
- FileDialogCustomPlace.cs
- SystemIPv6InterfaceProperties.cs
- DrawingContext.cs
- DLinqColumnProvider.cs
- QuestionEventArgs.cs
- SqlDataSourceQuery.cs
- Calendar.cs
- FixedTextView.cs
- PasswordRecovery.cs
- FixedMaxHeap.cs
- TraceFilter.cs
- GlyphManager.cs
- RelationshipDetailsRow.cs
- OutputCacheProviderCollection.cs
- Graphics.cs
- CommunicationObjectFaultedException.cs
- PerformanceCounterCategory.cs
- TransactionState.cs
- PerformanceCounterManager.cs
- CalculatedColumn.cs
- WebEvents.cs
- ApplicationSettingsBase.cs
- _NestedSingleAsyncResult.cs
- BitHelper.cs
- SecureStringHasher.cs
- PointF.cs
- WmlControlAdapter.cs
- BamlMapTable.cs
- SrgsDocument.cs
- BamlResourceDeserializer.cs
- CodeCommentStatementCollection.cs
- EvidenceTypeDescriptor.cs
- SmtpReplyReaderFactory.cs
- GuidelineSet.cs
- ModelVisual3D.cs
- arabicshape.cs
- FixedTextSelectionProcessor.cs
- PeerTransportListenAddressConverter.cs
- HtmlWindow.cs
- ResourcePermissionBaseEntry.cs
- Geometry3D.cs
- ApplicationServicesHostFactory.cs
- AnimationStorage.cs
- ObjectContextServiceProvider.cs
- Grant.cs
- BoolLiteral.cs
- Section.cs
- InputLangChangeRequestEvent.cs
- WorkflowDesignerMessageFilter.cs
- ContainerSelectorBehavior.cs
- FormViewUpdatedEventArgs.cs
- ExtractorMetadata.cs
- BindingSource.cs
- Visual3DCollection.cs
- ActivityXRefPropertyEditor.cs
- Metadata.cs
- ADConnectionHelper.cs
- ColorBlend.cs
- X500Name.cs
- InputMethod.cs
- ReachFixedPageSerializerAsync.cs
- UserControlCodeDomTreeGenerator.cs
- InputBindingCollection.cs
- BlobPersonalizationState.cs
- DescendantBaseQuery.cs
- Wildcard.cs