Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataWeb / Server / System / Data / Services / Providers / ServiceOperation.cs / 2 / ServiceOperation.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a type to represent custom operations on services.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Providers
{
using System;
using System.Diagnostics;
using System.Reflection;
/// Use this class to represent a custom service operation.
[DebuggerVisualizer("ServiceOperation={Name}")]
internal class ServiceOperation
{
/// Whether this is an update method or a GET method.
/// Might need to be more specific than this when we design service operation updates.
private readonly bool invoke;
/// for the service operation.
private readonly MethodInfo method;
/// MIME type specified on primitive results, possibly null.
private readonly string mimeType;
/// In-order parameters for this operation.
private readonly ServiceOperationParameter[] parameters;
/// Kind of result expected from this operation.
private readonly ServiceOperationResultKind resultKind;
/// Type of element of the method result.
private readonly Type resultType;
/// Entity set from which entities are read, if applicable.
private ResourceContainer entitySet;
/// Access rights to this service operation.
private ServiceOperationRights rights;
///
/// Initializes a new instance.
///
/// for the service operation.
/// Kind of result expected from this operation.
/// Type of element of the method result.
/// MIME type specified on primitive results, possibly null.
/// Whether this is an update method or a GET method.
/// In-order parameters for this operation.
public ServiceOperation(
MethodInfo method,
ServiceOperationResultKind resultKind,
Type resultType,
string mimeType,
bool invoke,
ServiceOperationParameter[] parameters)
{
Debug.Assert(method != null, "method != null");
Debug.Assert(resultType != null, "resultType != null");
Debug.Assert(parameters != null, "parameters != null");
WebUtil.DebugEnumIsDefined(resultKind);
if (mimeType != null && !WebUtil.IsValidMimeType(mimeType))
{
string message = Strings.ServiceOperation_MimeTypeNotValid(mimeType, method.Name, method.DeclaringType);
throw new InvalidOperationException(message);
}
this.method = method;
this.resultKind = resultKind;
this.resultType = resultType;
this.mimeType = mimeType;
this.invoke = invoke;
this.parameters = parameters;
}
/// Entity set from which entities are read (possibly null).
public ResourceContainer EntitySet
{
get { return this.entitySet; }
set { this.entitySet = value; }
}
/// Whether this is an update method or a GET method.
public bool Invoke
{
get { return this.invoke; }
}
/// for the service operation.
public MethodInfo Method
{
get { return this.method; }
}
/// MIME type specified on primitive results, possibly null.
public string MimeType
{
get { return this.mimeType; }
}
/// Name of the service operation.
public string Name
{
get { return this.method.Name; }
}
/// In-order parameters for this operation.
public ServiceOperationParameter[] Parameters
{
get { return this.parameters; }
}
/// Kind of result expected from this operation.
public ServiceOperationResultKind ResultKind
{
get { return this.resultKind; }
}
/// Element of result type.
///
/// Note that if the method returns an IEnumerable<string>,
/// this property will be typeof(string).
///
public Type ResultType
{
get { return this.resultType; }
}
/// Whether the operation is visible to service consumers.
internal bool IsHidden
{
get { return (this.rights & ~ServiceOperationRights.OverrideEntitySetRights) == ServiceOperationRights.None; }
}
/// Access rights to this service operation.
internal ServiceOperationRights Rights
{
get { return this.rights; }
set { this.rights = value; }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a type to represent custom operations on services.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Providers
{
using System;
using System.Diagnostics;
using System.Reflection;
/// Use this class to represent a custom service operation.
[DebuggerVisualizer("ServiceOperation={Name}")]
internal class ServiceOperation
{
/// Whether this is an update method or a GET method.
/// Might need to be more specific than this when we design service operation updates.
private readonly bool invoke;
/// for the service operation.
private readonly MethodInfo method;
/// MIME type specified on primitive results, possibly null.
private readonly string mimeType;
/// In-order parameters for this operation.
private readonly ServiceOperationParameter[] parameters;
/// Kind of result expected from this operation.
private readonly ServiceOperationResultKind resultKind;
/// Type of element of the method result.
private readonly Type resultType;
/// Entity set from which entities are read, if applicable.
private ResourceContainer entitySet;
/// Access rights to this service operation.
private ServiceOperationRights rights;
///
/// Initializes a new instance.
///
/// for the service operation.
/// Kind of result expected from this operation.
/// Type of element of the method result.
/// MIME type specified on primitive results, possibly null.
/// Whether this is an update method or a GET method.
/// In-order parameters for this operation.
public ServiceOperation(
MethodInfo method,
ServiceOperationResultKind resultKind,
Type resultType,
string mimeType,
bool invoke,
ServiceOperationParameter[] parameters)
{
Debug.Assert(method != null, "method != null");
Debug.Assert(resultType != null, "resultType != null");
Debug.Assert(parameters != null, "parameters != null");
WebUtil.DebugEnumIsDefined(resultKind);
if (mimeType != null && !WebUtil.IsValidMimeType(mimeType))
{
string message = Strings.ServiceOperation_MimeTypeNotValid(mimeType, method.Name, method.DeclaringType);
throw new InvalidOperationException(message);
}
this.method = method;
this.resultKind = resultKind;
this.resultType = resultType;
this.mimeType = mimeType;
this.invoke = invoke;
this.parameters = parameters;
}
/// Entity set from which entities are read (possibly null).
public ResourceContainer EntitySet
{
get { return this.entitySet; }
set { this.entitySet = value; }
}
/// Whether this is an update method or a GET method.
public bool Invoke
{
get { return this.invoke; }
}
/// for the service operation.
public MethodInfo Method
{
get { return this.method; }
}
/// MIME type specified on primitive results, possibly null.
public string MimeType
{
get { return this.mimeType; }
}
/// Name of the service operation.
public string Name
{
get { return this.method.Name; }
}
/// In-order parameters for this operation.
public ServiceOperationParameter[] Parameters
{
get { return this.parameters; }
}
/// Kind of result expected from this operation.
public ServiceOperationResultKind ResultKind
{
get { return this.resultKind; }
}
/// Element of result type.
///
/// Note that if the method returns an IEnumerable<string>,
/// this property will be typeof(string).
///
public Type ResultType
{
get { return this.resultType; }
}
/// Whether the operation is visible to service consumers.
internal bool IsHidden
{
get { return (this.rights & ~ServiceOperationRights.OverrideEntitySetRights) == ServiceOperationRights.None; }
}
/// Access rights to this service operation.
internal ServiceOperationRights Rights
{
get { return this.rights; }
set { this.rights = value; }
}
}
}
// 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
- CommandLibraryHelper.cs
- ActiveDocumentEvent.cs
- URLIdentityPermission.cs
- TriggerBase.cs
- ComponentEditorForm.cs
- ToolStripDropDownButton.cs
- QuaternionAnimationBase.cs
- itemelement.cs
- IResourceProvider.cs
- EmptyReadOnlyDictionaryInternal.cs
- ExchangeUtilities.cs
- ToolStripActionList.cs
- StructuredTypeEmitter.cs
- ThreadInterruptedException.cs
- Reference.cs
- TextTreeUndo.cs
- PersonalizationAdministration.cs
- DataGridColumn.cs
- JsonDataContract.cs
- WeakReference.cs
- DesignerSerializationVisibilityAttribute.cs
- ScriptModule.cs
- LinkTarget.cs
- WebMessageEncodingBindingElement.cs
- TextTreeText.cs
- XmlDomTextWriter.cs
- AssertUtility.cs
- SiteMapPath.cs
- PathData.cs
- UserNamePasswordValidator.cs
- ThreadStartException.cs
- EncoderReplacementFallback.cs
- TitleStyle.cs
- DataViewSettingCollection.cs
- WmlPageAdapter.cs
- PaintEvent.cs
- UriSection.cs
- Accessors.cs
- BorderGapMaskConverter.cs
- ModuleBuilderData.cs
- DeleteBookmarkScope.cs
- TextAutomationPeer.cs
- XmlDocumentSerializer.cs
- RelAssertionDirectKeyIdentifierClause.cs
- SafeRightsManagementQueryHandle.cs
- RuntimeConfig.cs
- SharedDp.cs
- CodeMemberProperty.cs
- QuadraticBezierSegment.cs
- IndicShape.cs
- ValidatorCompatibilityHelper.cs
- ReaderWriterLock.cs
- Visual3D.cs
- MissingFieldException.cs
- PlanCompiler.cs
- _NtlmClient.cs
- DllNotFoundException.cs
- TextEditorTyping.cs
- KeyValueInternalCollection.cs
- Permission.cs
- SafeNativeMethods.cs
- Regex.cs
- MdiWindowListItemConverter.cs
- PageRequestManager.cs
- ContainerActivationHelper.cs
- RijndaelManagedTransform.cs
- ComboBoxAutomationPeer.cs
- SeekStoryboard.cs
- SqlParameter.cs
- Int32Rect.cs
- DataPagerCommandEventArgs.cs
- ObjectListShowCommandsEventArgs.cs
- WorkflowOperationInvoker.cs
- DbgCompiler.cs
- XPathConvert.cs
- FormViewCommandEventArgs.cs
- ObjectStateFormatter.cs
- FontFamilyIdentifier.cs
- AlignmentXValidation.cs
- HGlobalSafeHandle.cs
- ExceptionHelpers.cs
- WebServiceMethodData.cs
- EdmItemCollection.OcAssemblyCache.cs
- ConnectionPointGlyph.cs
- AssemblyNameProxy.cs
- TypeElement.cs
- ViewRendering.cs
- RSAPKCS1KeyExchangeFormatter.cs
- DocumentSchemaValidator.cs
- TemplateControlParser.cs
- RegistryExceptionHelper.cs
- DrawToolTipEventArgs.cs
- Guid.cs
- MulticastIPAddressInformationCollection.cs
- HtmlElement.cs
- FixedTextContainer.cs
- XmlFormatExtensionAttribute.cs
- BrushMappingModeValidation.cs
- ListParagraph.cs
- SmiEventSink_Default.cs