本文整理汇总了C#中IEdmOperation类的典型用法代码示例。如果您正苦于以下问题:C# IEdmOperation类的具体用法?C# IEdmOperation怎么用?C# IEdmOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEdmOperation类属于命名空间,在下文中一共展示了IEdmOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CsdlSemanticsOperationImport
protected CsdlSemanticsOperationImport(CsdlSemanticsEntityContainer container, CsdlOperationImport operationImport, IEdmOperation operation)
: base(operationImport)
{
this.container = container;
this.operationImport = operationImport;
this.Operation = operation;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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*/);
}
示例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()");
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}