Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / OnOperation.cs / 3 / OnOperation.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Xml;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Data.Metadata.Edm;
namespace System.Data.EntityModel.SchemaObjectModel
{
///
/// Represents an OnDelete, OnCopy, OnSecure, OnLock or OnSerialize element
///
internal sealed class OnOperation : SchemaElement
{
private Operation _Operation;
private Action _Action;
///
///
///
///
///
public OnOperation(RelationshipEnd parentElement, Operation operation)
: base(parentElement)
{
Operation = operation;
}
///
/// The operation
///
public Operation Operation
{
get
{
return _Operation;
}
private set
{
_Operation = value;
}
}
///
/// The action
///
public Action Action
{
get
{
return _Action;
}
private set
{
_Action = value;
}
}
protected override bool ProhibitAttribute(string namespaceUri, string localName)
{
if (base.ProhibitAttribute(namespaceUri, localName))
{
return true;
}
if (namespaceUri == null && localName == XmlConstants.Name)
{
return false;
}
return false;
}
protected override bool HandleAttribute(XmlReader reader)
{
if (base.HandleAttribute(reader))
{
return true;
}
else if (CanHandleAttribute(reader, XmlConstants.Action))
{
HandleActionAttribute(reader);
return true;
}
return false;
}
///
/// Handle the Action attribute
///
/// reader positioned at Action attribute
private void HandleActionAttribute(XmlReader reader)
{
Debug.Assert(reader != null);
RelationshipKind relationshipKind = ParentElement.ParentElement.RelationshipKind;
switch ( reader.Value.Trim() )
{
case "None":
Action = Action.None;
break;
case "Cascade":
Action = Action.Cascade;
break;
default:
AddError( ErrorCode.InvalidAction, EdmSchemaErrorSeverity.Error, reader, System.Data.Entity.Strings.InvalidAction(reader.Value, ParentElement.FQName ) );
break;
}
}
///
/// the parent element.
///
private new RelationshipEnd ParentElement
{
get
{
return (RelationshipEnd)base.ParentElement;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Xml;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Data.Metadata.Edm;
namespace System.Data.EntityModel.SchemaObjectModel
{
///
/// Represents an OnDelete, OnCopy, OnSecure, OnLock or OnSerialize element
///
internal sealed class OnOperation : SchemaElement
{
private Operation _Operation;
private Action _Action;
///
///
///
///
///
public OnOperation(RelationshipEnd parentElement, Operation operation)
: base(parentElement)
{
Operation = operation;
}
///
/// The operation
///
public Operation Operation
{
get
{
return _Operation;
}
private set
{
_Operation = value;
}
}
///
/// The action
///
public Action Action
{
get
{
return _Action;
}
private set
{
_Action = value;
}
}
protected override bool ProhibitAttribute(string namespaceUri, string localName)
{
if (base.ProhibitAttribute(namespaceUri, localName))
{
return true;
}
if (namespaceUri == null && localName == XmlConstants.Name)
{
return false;
}
return false;
}
protected override bool HandleAttribute(XmlReader reader)
{
if (base.HandleAttribute(reader))
{
return true;
}
else if (CanHandleAttribute(reader, XmlConstants.Action))
{
HandleActionAttribute(reader);
return true;
}
return false;
}
///
/// Handle the Action attribute
///
/// reader positioned at Action attribute
private void HandleActionAttribute(XmlReader reader)
{
Debug.Assert(reader != null);
RelationshipKind relationshipKind = ParentElement.ParentElement.RelationshipKind;
switch ( reader.Value.Trim() )
{
case "None":
Action = Action.None;
break;
case "Cascade":
Action = Action.Cascade;
break;
default:
AddError( ErrorCode.InvalidAction, EdmSchemaErrorSeverity.Error, reader, System.Data.Entity.Strings.InvalidAction(reader.Value, ParentElement.FQName ) );
break;
}
}
///
/// the parent element.
///
private new RelationshipEnd ParentElement
{
get
{
return (RelationshipEnd)base.ParentElement;
}
}
}
}
// 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
- XmlUTF8TextReader.cs
- ButtonFlatAdapter.cs
- streamingZipPartStream.cs
- SchemaAttDef.cs
- RequiredAttributeAttribute.cs
- MetadataSource.cs
- ByteStreamGeometryContext.cs
- IncrementalHitTester.cs
- CmsInterop.cs
- RadioButton.cs
- VirtualPathUtility.cs
- NativeMethods.cs
- DynamicResourceExtensionConverter.cs
- UIElement3D.cs
- figurelengthconverter.cs
- WebColorConverter.cs
- StringUtil.cs
- Int32AnimationBase.cs
- FileSystemInfo.cs
- XmlCDATASection.cs
- ObjectDataSourceChooseTypePanel.cs
- TextRangeEditLists.cs
- _AuthenticationState.cs
- ValueUtilsSmi.cs
- PropertyMetadata.cs
- ProfileSection.cs
- PictureBox.cs
- RelationshipWrapper.cs
- HelpKeywordAttribute.cs
- EntityDataSourceConfigureObjectContext.cs
- DataControlFieldHeaderCell.cs
- HMACSHA1.cs
- Visual3D.cs
- DispatchWrapper.cs
- SafeNativeMethods.cs
- TextCompositionManager.cs
- HtmlInputReset.cs
- SecurityContext.cs
- UInt16.cs
- PerfService.cs
- ToolTipService.cs
- SqlNode.cs
- EncodingTable.cs
- ShaderEffect.cs
- DocumentReference.cs
- ClearCollection.cs
- ToolStripPanelRow.cs
- InstanceDescriptor.cs
- Vector3DCollection.cs
- EventLogException.cs
- HttpTransportBindingElement.cs
- StyleSelector.cs
- StateMachineHelpers.cs
- GuidelineSet.cs
- basecomparevalidator.cs
- LogicalTreeHelper.cs
- XmlHierarchyData.cs
- DbModificationClause.cs
- CodeVariableDeclarationStatement.cs
- SwitchAttribute.cs
- TraceData.cs
- MessageTransmitTraceRecord.cs
- ClientConfigPaths.cs
- DecimalAnimationUsingKeyFrames.cs
- DataError.cs
- LocatorPartList.cs
- StringArrayConverter.cs
- RuntimeConfig.cs
- DrawingAttributeSerializer.cs
- XmlSerializerObjectSerializer.cs
- GetBrowserTokenRequest.cs
- BasicHttpMessageCredentialType.cs
- TableProviderWrapper.cs
- ApplicationProxyInternal.cs
- ArrayWithOffset.cs
- SafeSystemMetrics.cs
- TogglePattern.cs
- TreeViewDesigner.cs
- MimeMultiPart.cs
- QueryException.cs
- UnaryExpression.cs
- X509ChainElement.cs
- GiveFeedbackEvent.cs
- EnterpriseServicesHelper.cs
- Visitor.cs
- XhtmlBasicCommandAdapter.cs
- MsmqInputMessage.cs
- UnmanagedMemoryStreamWrapper.cs
- XmlNodeReader.cs
- SR.Designer.cs
- ADMembershipProvider.cs
- GridViewDeletedEventArgs.cs
- CloudCollection.cs
- MultiAsyncResult.cs
- StylusButtonCollection.cs
- latinshape.cs
- SqlDataRecord.cs
- shaperfactory.cs
- CqlLexer.cs
- DiscriminatorMap.cs