本文整理汇总了C#中IEdmOperation类的典型用法代码示例。如果您正苦于以下问题:C# IEdmOperation类的具体用法?C# IEdmOperation怎么用?C# IEdmOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEdmOperation类属于命名空间,在下文中一共展示了IEdmOperation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CsdlSemanticsOperationImport
protected CsdlSemanticsOperationImport(CsdlSemanticsEntityContainer container, CsdlOperationImport operationImport, IEdmOperation operation)
: base(operationImport)
{
this.container = container;
this.operationImport = operationImport;
this.Operation = operation;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:7,代码来源:CsdlSemanticsOperationImport.cs
示例2: ODataJsonLightParameterWriter
/// <summary>
/// Constructor.
/// </summary>
/// <param name="jsonLightOutputContext">The output context to write to.</param>
/// <param name="operation">The operation import whose parameters will be written.</param>
internal ODataJsonLightParameterWriter(ODataJsonLightOutputContext jsonLightOutputContext, IEdmOperation operation)
: base(jsonLightOutputContext, operation)
{
Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null");
this.jsonLightOutputContext = jsonLightOutputContext;
this.jsonLightValueSerializer = new ODataJsonLightValueSerializer(this.jsonLightOutputContext);
}
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:13,代码来源:ODataJsonLightParameterWriter.cs
示例3: ODataAvroParameterReader
public ODataAvroParameterReader(ODataAvroInputContext inputContext, IEdmOperation operation)
{
Debug.Assert(inputContext != null, "inputContext != null");
Debug.Assert(operation != null, "operation != null");
this.inputContext = inputContext;
this.operation = operation;
this.state = ODataParameterReaderState.Start;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:9,代码来源:ODataAvroParameterReader.cs
示例4: ODataAvroParameterWriter
public ODataAvroParameterWriter(ODataAvroOutputContext outputContext, IEdmOperation operation)
{
Debug.Assert(outputContext != null, "outputContext != null");
Debug.Assert(operation != null, "operation != null");
this.outputContext = outputContext;
schema = (RecordSchema)this.outputContext.AvroWriter.UpdateSchema(null, this.GetTmpType(operation));
this.record = new AvroRecord(schema);
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:9,代码来源:ODataAvroParameterWriter.cs
示例5: EdmOperationParameter
/// <summary>
/// Initializes a new instance of the <see cref="EdmOperationParameter"/> class.
/// </summary>
/// <param name="declaringOperation">Declaring function of the parameter.</param>
/// <param name="name">Name of the parameter.</param>
/// <param name="type">Type of the parameter.</param>
public EdmOperationParameter(IEdmOperation declaringOperation, string name, IEdmTypeReference type)
: base(name)
{
EdmUtil.CheckArgumentNull(declaringOperation, "declaringFunction");
EdmUtil.CheckArgumentNull(name, "name");
EdmUtil.CheckArgumentNull(type, "type");
this.Type = type;
this.DeclaringOperation = declaringOperation;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:EdmOperationParameter.cs
示例6: IsDuplicateOperation
public static bool IsDuplicateOperation(IEdmOperation operation, IEnumerable<IEdmOperation> candidateDuplicateOperations)
{
var validator = new DuplicateOperationValidator(null);
foreach (var candidateOperation in candidateDuplicateOperations)
{
validator.ValidateNotDuplicate(candidateOperation, true /*skipError*/);
}
return validator.ValidateNotDuplicate(operation, true /*skipError*/);
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:10,代码来源:DuplicateOperationValidator.cs
示例7: ODataJsonLightParameterReader
/// <summary>
/// Constructor.
/// </summary>
/// <param name="jsonLightInputContext">The input to read the payload from.</param>
/// <param name="operation">The operation import whose parameters are being read.</param>
internal ODataJsonLightParameterReader(ODataJsonLightInputContext jsonLightInputContext, IEdmOperation operation)
: base(jsonLightInputContext, operation)
{
Debug.Assert(jsonLightInputContext != null, "jsonLightInputContext != null");
Debug.Assert(jsonLightInputContext.ReadingResponse == false, "jsonLightInputContext.ReadingResponse == false");
Debug.Assert(operation != null, "operationImport != null");
this.jsonLightInputContext = jsonLightInputContext;
this.jsonLightParameterDeserializer = new ODataJsonLightParameterDeserializer(this, jsonLightInputContext);
Debug.Assert(this.jsonLightInputContext.Model.IsUserModel(), "this.jsonLightInputContext.Model.IsUserModel()");
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:ODataJsonLightParameterReader.cs
示例8: GetTmpType
private IEdmType GetTmpType(IEdmOperation operation)
{
EdmComplexType type = new EdmComplexType(operation.Namespace, operation.Name + AvroConstants.ParameterTypeSuffix);
foreach (var parameter in operation.Parameters.Skip(operation.IsBound ? 1 : 0))
{
type.AddStructuralProperty(parameter.Name, parameter.Type);
}
return type;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:11,代码来源:ODataAvroParameterWriter.cs
示例9: EdmOperationImport
/// <summary>
/// Initializes a new instance of <see cref="EdmOperationImport"/> class.
/// </summary>
/// <param name="container">An <see cref="IEdmEntityContainer"/> containing this operation import.</param>
/// <param name="operation">The operation of the import.</param>
/// <param name="name">Name of the operation import.</param>
/// <param name="entitySet">An entity set containing entities returned by this operation import.
/// The two expression kinds supported are <see cref="IEdmEntitySetReferenceExpression"/> and <see cref="IEdmPathExpression"/>.</param>
protected EdmOperationImport(
IEdmEntityContainer container,
IEdmOperation operation,
string name,
IEdmExpression entitySet)
: base(name)
{
EdmUtil.CheckArgumentNull(container, "container");
EdmUtil.CheckArgumentNull(operation, this.OperationArgumentNullParameterName());
this.Container = container;
this.Operation = operation;
this.EntitySet = entitySet;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:22,代码来源:EdmOperationImport.cs
示例10: ResolveOperationParameters
public override IDictionary<IEdmOperationParameter, SingleValueNode> ResolveOperationParameters(IEdmOperation operation, IDictionary<string, SingleValueNode> input)
{
Dictionary<IEdmOperationParameter, SingleValueNode> result = new Dictionary<IEdmOperationParameter, SingleValueNode>(EqualityComparer<IEdmOperationParameter>.Default);
foreach (var item in input)
{
IEdmOperationParameter functionParameter = null;
if (EnableCaseInsensitive)
{
functionParameter = ODataUriResolver.ResolveOpearationParameterNameCaseInsensitive(operation, item.Key);
}
else
{
functionParameter = operation.FindParameter(item.Key);
}
// ensure parameter name existis
if (functionParameter == null)
{
throw new ODataException(Strings.ODataParameterWriterCore_ParameterNameNotFoundInOperation(item.Key, operation.Name));
}
SingleValueNode newVal = item.Value;
if (functionParameter.Type.IsEnum()
&& newVal is ConstantNode
&& newVal.TypeReference != null
&& newVal.TypeReference.IsString())
{
string text = ((ConstantNode)item.Value).Value as string;
ODataEnumValue val;
IEdmTypeReference typeRef = functionParameter.Type;
if (TryParseEnum(typeRef.Definition as IEdmEnumType, text, out val))
{
newVal = new ConstantNode(val, text, typeRef);
}
}
result.Add(functionParameter, newVal);
}
return result;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:43,代码来源:StringAsEnumResolver.cs
示例11: GenerateFunctionLink
/// <summary>
/// Generates an function link following the OData URL conventions for the function <paramref name="function"/> and bound to the entity
/// represented by <paramref name="entityContext"/>.
/// </summary>
/// <param name="entityContext">The <see cref="EntityInstanceContext"/> representing the entity for which the function link needs to be generated.</param>
/// <param name="function">The function for which the function link needs to be generated.</param>
/// <returns>The generated function link following OData URL conventions.</returns>
public static Uri GenerateFunctionLink(this EntityInstanceContext entityContext, IEdmOperation function)
{
if (entityContext == null)
{
throw Error.ArgumentNull("entityContext");
}
if (function == null)
{
throw Error.ArgumentNull("function");
}
IEdmOperationParameter bindingParameter = function.Parameters.FirstOrDefault();
if (bindingParameter == null || !bindingParameter.Type.IsEntity())
{
throw Error.Argument("function", SRResources.FunctionNotBoundToEntity, function.Name);
}
return GenerateFunctionLink(entityContext, bindingParameter.Type.FullName(), function.Name, function.Parameters.Select(p => p.Name));
}
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:26,代码来源:LinkGenerationHelpers.cs
示例12: TryParseOperationParameters
private static bool TryParseOperationParameters(string functionName, string parenthesisExpression, ParameterAliasValueAccessor paramAliasAccessor, IEdmOperation operation, out ICollection<OperationSegmentParameter> parsedSegementParameters)
{
ICollection<FunctionParameterToken> splitParameters;
parsedSegementParameters = null;
ODataUriParserConfiguration configuration = new ODataUriParserConfiguration(HardCodedTestModel.TestModel) { ParameterAliasValueAccessor = paramAliasAccessor };
if (FunctionParameterParser.TrySplitOperationParameters(parenthesisExpression, configuration, out splitParameters))
{
parsedSegementParameters = FunctionCallBinder.BindSegmentParameters(configuration, operation, splitParameters);
return true;
}
return false;
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:13,代码来源:FunctionParameterParserTests.cs
示例13: ResolveOpearationParameterNameCaseInsensitive
/// <summary>
/// Resolve an operation parameter's name with case insensitive enabled
/// </summary>
/// <param name="operation">The operation.</param>
/// <param name="identifier">Name for the parameter.</param>
/// <returns>The resolved operation parameter.</returns>
internal static IEdmOperationParameter ResolveOpearationParameterNameCaseInsensitive(IEdmOperation operation, string identifier)
{
var list = operation.Parameters.Where(parameter => string.Equals(identifier, parameter.Name, StringComparison.OrdinalIgnoreCase)).ToList();
if (list.Count > 1)
{
throw new ODataException(Strings.UriParserMetadata_MultipleMatchingParametersFound(identifier));
}
if (list.Count == 1)
{
return list.Single();
}
return null;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:22,代码来源:ODataUriResolver.cs
示例14: ProcessActionInvokePostBody
private Expression[] ProcessActionInvokePostBody(IODataRequestMessage message, IEdmOperation operation)
{
using (var messageReader = new ODataMessageReader(message, this.GetReaderSettings(), this.DataSource.Model))
{
List<Expression> parameterValues = new List<Expression>();
var parameterReader = messageReader.CreateODataParameterReader(operation);
while (parameterReader.Read())
{
switch (parameterReader.State)
{
case ODataParameterReaderState.Value:
{
object clrValue = ODataObjectModelConverter.ConvertPropertyValue(parameterReader.Value);
parameterValues.Add(Expression.Constant(clrValue));
break;
}
case ODataParameterReaderState.Collection:
{
ODataCollectionReader collectionReader = parameterReader.CreateCollectionReader();
object clrValue = ODataObjectModelConverter.ConvertPropertyValue(ODataObjectModelConverter.ReadCollectionParameterValue(collectionReader));
parameterValues.Add(Expression.Constant(clrValue, clrValue.GetType()));
break;
}
case ODataParameterReaderState.Entry:
{
var entryReader = parameterReader.CreateEntryReader();
object clrValue = ODataObjectModelConverter.ConvertPropertyValue(ODataObjectModelConverter.ReadEntryParameterValue(entryReader));
parameterValues.Add(Expression.Constant(clrValue, clrValue.GetType()));
break;
}
case ODataParameterReaderState.Feed:
{
IList collectionList = null;
var feedReader = parameterReader.CreateFeedReader();
while (feedReader.Read())
{
if (feedReader.State == ODataReaderState.EntryEnd)
{
object clrItem = ODataObjectModelConverter.ConvertPropertyValue(feedReader.Item);
if (collectionList == null)
{
Type itemType = clrItem.GetType();
Type listType = typeof(List<>).MakeGenericType(new[] { itemType });
collectionList = (IList)Utility.QuickCreateInstance(listType);
}
collectionList.Add(clrItem);
}
}
parameterValues.Add(Expression.Constant(collectionList, collectionList.GetType()));
break;
}
}
}
return parameterValues.ToArray();
}
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:60,代码来源:OperationHandler.cs
示例15: CreateMetadataFragment
internal static string CreateMetadataFragment(IEdmOperation operation)
{
// There can only be one entity container in OData V4.
string actionName = operation.Name;
string fragment = operation.Namespace + "." + actionName;
return fragment;
}
开发者ID:chinadragon0515,项目名称:WebApi,代码行数:8,代码来源:ODataEntityTypeSerializer.cs
示例16: CheckMethodsInBaseClass
internal bool CheckMethodsInBaseClass(IEdmStructuredType structuredType, IEdmOperation operation, Dictionary<IEdmStructuredType, List<IEdmOperation>> boundOperationsMap)
{
if (structuredType != null)
{
List<IEdmOperation> operations;
if (boundOperationsMap.TryGetValue(structuredType, out operations))
{
foreach (var op in operations)
{
var targetParameter = operation.Parameters.ToList();
var checkParameter = op.Parameters.ToList();
if (operation.Name == op.Name && targetParameter.Count == checkParameter.Count)
{
var areSame = true;
for (var i = 1; i < targetParameter.Count; ++i)
{
var targetParameterType = targetParameter[i].Type;
var checkParameterType = checkParameter[i].Type;
if (!targetParameterType.Definition.Equals(checkParameterType.Definition)
|| targetParameterType.IsNullable != checkParameterType.IsNullable)
{
areSame = false;
break;
}
}
if (areSame)
{
return true;
}
}
}
}
return CheckMethodsInBaseClass(structuredType.BaseType, operation, boundOperationsMap);
}
return false;
}
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:39,代码来源:ODataClientTemplate.cs
示例17: ResolveOperationParameters
public override IDictionary<IEdmOperationParameter, SingleValueNode> ResolveOperationParameters(
IEdmOperation operation, IDictionary<string, SingleValueNode> input)
{
return _stringAsEnum.ResolveOperationParameters(operation, input);
}
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:5,代码来源:UnqualifiedCallAndEnumPrefixFreeResolver.cs
示例18: ValidateNoError
private static void ValidateNoError(IEdmModel model, IEdmOperation operation)
{
IEnumerable<EdmError> errorsFound = null;
IEdmOperationParameter operationParameter = null;
IEnumerable<IEdmNavigationProperty> navigationProperties = null;
IEdmEntityType entityType = null;
operation.TryGetRelativeEntitySetPath(model, out operationParameter, out navigationProperties, out entityType, out errorsFound);
errorsFound.Should().HaveCount(0);
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:10,代码来源:ExtensionMethodTests.cs
示例19: CreateODataOperation
private static ODataOperation CreateODataOperation(IEdmOperation operation, ProcedureLinkBuilder builder, EntityInstanceContext entityInstanceContext)
{
Contract.Assert(operation != null);
Contract.Assert(builder != null);
Contract.Assert(entityInstanceContext != null);
ODataMetadataLevel metadataLevel = entityInstanceContext.SerializerContext.MetadataLevel;
IEdmModel model = entityInstanceContext.EdmModel;
if (ShouldOmitOperation(operation, builder, metadataLevel))
{
return null;
}
Uri target = builder.BuildLink(entityInstanceContext);
if (target == null)
{
return null;
}
Uri baseUri = new Uri(entityInstanceContext.Url.CreateODataLink(new MetadataPathSegment()));
Uri metadata = new Uri(baseUri, "#" + CreateMetadataFragment(operation));
ODataOperation odataOperation;
if (operation is IEdmAction)
{
odataOperation = new ODataAction();
}
else
{
odataOperation = new ODataFunction();
}
odataOperation.Metadata = metadata;
// Always omit the title in minimal/no metadata modes.
if (metadataLevel == ODataMetadataLevel.FullMetadata)
{
EmitTitle(model, operation, odataOperation);
}
// Omit the target in minimal/no metadata modes unless it doesn't follow conventions.
if (!builder.FollowsConventions || metadataLevel == ODataMetadataLevel.FullMetadata)
{
odataOperation.Target = target;
}
return odataOperation;
}
开发者ID:chinadragon0515,项目名称:WebApi,代码行数:48,代码来源:ODataEntityTypeSerializer.cs
示例20: ValidateError
private static void ValidateError(IEdmModel model, IEdmOperation operation, EdmErrorCode expectedErrorCode, string expectedError)
{
IEnumerable<EdmError> errorsFound = null;
IEdmOperationParameter operationParameter = null;
IEnumerable<IEdmNavigationProperty> navigationProperties = null;
IEdmEntityType entityType = null;
operation.TryGetRelativeEntitySetPath(model, out operationParameter, out navigationProperties, out entityType, out errorsFound);
errorsFound.Should().HaveCount(1);
var errorsFoundList = errorsFound.ToList();
errorsFoundList[0].ErrorCode.Should().Be(expectedErrorCode);
errorsFoundList[0].ErrorMessage.Should().Be(expectedError);
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:ExtensionMethodTests.cs
注:本文中的IEdmOperation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论