本文整理汇总了C#中System.Web.Http.OData.Formatter.Deserialization.ODataDeserializerProvider.GetEdmTypeDeserializer方法的典型用法代码示例。如果您正苦于以下问题:C# ODataDeserializerProvider.GetEdmTypeDeserializer方法的具体用法?C# ODataDeserializerProvider.GetEdmTypeDeserializer怎么用?C# ODataDeserializerProvider.GetEdmTypeDeserializer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Http.OData.Formatter.Deserialization.ODataDeserializerProvider
的用法示例。
在下文中一共展示了ODataDeserializerProvider.GetEdmTypeDeserializer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDeserializer
private ODataDeserializer GetDeserializer(Type type, ODataPath path, IEdmModel model,
ODataDeserializerProvider deserializerProvider, out IEdmTypeReference expectedPayloadType)
{
expectedPayloadType = GetExpectedPayloadType(type, path, model);
// Get the deserializer using the CLR type first from the deserializer provider.
ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(model, type, Request);
if (deserializer == null && expectedPayloadType != null)
{
// we are in typeless mode, get the deserializer using the edm type from the path.
deserializer = deserializerProvider.GetEdmTypeDeserializer(expectedPayloadType);
}
return deserializer;
}
示例2: ConvertCollectionValue
private static object ConvertCollectionValue(ODataCollectionValue collection, IEdmTypeReference propertyType,
ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)
{
IEdmCollectionTypeReference collectionType = propertyType as IEdmCollectionTypeReference;
Contract.Assert(collectionType != null, "The type for collection must be a IEdmCollectionType.");
ODataEdmTypeDeserializer deserializer = deserializerProvider.GetEdmTypeDeserializer(collectionType);
return deserializer.ReadInline(collection, collectionType, readContext);
}
示例3: GetDeserializer
private ODataDeserializer GetDeserializer(Type type, ODataPath path, IEdmModel model,
ODataDeserializerProvider deserializerProvider, out IEdmTypeReference expectedPayloadType)
{
expectedPayloadType = GetExpectedPayloadType(type, path, model);
if (expectedPayloadType != null)
{
return deserializerProvider.GetEdmTypeDeserializer(expectedPayloadType);
}
else
{
return deserializerProvider.GetODataDeserializer(model, type, Request);
}
}
示例4: ConvertComplexValue
private static object ConvertComplexValue(ODataComplexValue complexValue, ref IEdmTypeReference propertyType,
ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)
{
IEdmComplexTypeReference edmComplexType;
if (propertyType == null)
{
// open complex property
Contract.Assert(!String.IsNullOrEmpty(complexValue.TypeName),
"ODataLib should have verified that open complex value has a type name since we provided metadata.");
IEdmModel model = readContext.Model;
IEdmType edmType = model.FindType(complexValue.TypeName);
Contract.Assert(edmType.TypeKind == EdmTypeKind.Complex, "ODataLib should have verified that complex value has a complex resource type.");
edmComplexType = new EdmComplexTypeReference(edmType as IEdmComplexType, isNullable: true);
}
else
{
edmComplexType = propertyType.AsComplex();
}
ODataEdmTypeDeserializer deserializer = deserializerProvider.GetEdmTypeDeserializer(edmComplexType);
return deserializer.ReadInline(complexValue, propertyType, readContext);
}
示例5: GetDeserializer
private ODataDeserializer GetDeserializer(Type type, ODataPath path, IEdmModel model, ODataDeserializerProvider deserializerProvider)
{
if (typeof(IEdmObject).IsAssignableFrom(type))
{
// typeless mode. figure out the expected payload type from the OData Path.
IEdmType edmType = path.EdmType;
if (edmType != null)
{
IEdmTypeReference expectedPayloadType = EdmLibHelpers.ToEdmTypeReference(edmType, isNullable: false);
if (expectedPayloadType.TypeKind() == EdmTypeKind.Collection)
{
IEdmTypeReference elementType = expectedPayloadType.AsCollection().ElementType();
if (elementType.IsEntity())
{
// collection of entities cannot be CREATE/UPDATEd. Instead, the request would contain a single entry.
expectedPayloadType = elementType;
}
}
if (expectedPayloadType != null)
{
return deserializerProvider.GetEdmTypeDeserializer(expectedPayloadType);
}
}
}
else
{
TryGetInnerTypeForDelta(ref type);
return deserializerProvider.GetODataDeserializer(model, type, Request);
}
return null;
}