本文整理汇总了C#中System.Web.OData.Formatter.Deserialization.ODataDeserializerContext.GetEdmType方法的典型用法代码示例。如果您正苦于以下问题:C# ODataDeserializerContext.GetEdmType方法的具体用法?C# ODataDeserializerContext.GetEdmType怎么用?C# ODataDeserializerContext.GetEdmType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.OData.Formatter.Deserialization.ODataDeserializerContext
的用法示例。
在下文中一共展示了ODataDeserializerContext.GetEdmType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <inheritdoc />
public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
{
if (messageReader == null)
{
throw Error.ArgumentNull("messageReader");
}
IEdmTypeReference edmType = readContext.GetEdmType(type);
Contract.Assert(edmType != null);
ODataProperty property = messageReader.ReadProperty();
return ReadInline(property, edmType, readContext);
}
示例2: Read
/// <inheritdoc />
public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
{
if (messageReader == null)
{
throw Error.ArgumentNull("messageReader");
}
IEdmTypeReference edmType = readContext.GetEdmType(type);
Contract.Assert(edmType != null);
if (!edmType.IsComplex())
{
throw Error.Argument("type", SRResources.ArgumentMustBeOfType, EdmTypeKind.Complex);
}
ODataProperty property = messageReader.ReadProperty();
return ReadInline(property, edmType, readContext);
}
示例3: Read
/// <inheritdoc />
public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
{
if (messageReader == null)
{
throw Error.ArgumentNull("messageReader");
}
IEdmTypeReference edmType = readContext.GetEdmType(type);
Contract.Assert(edmType != null);
if (!edmType.IsCollection())
{
throw Error.Argument("type", SRResources.ArgumentMustBeOfType, EdmTypeKind.Collection);
}
IEdmCollectionTypeReference collectionType = edmType.AsCollection();
IEdmTypeReference elementType = collectionType.ElementType();
ODataCollectionReader reader = messageReader.CreateODataCollectionReader(elementType);
return ReadInline(ReadCollection(reader), edmType, readContext);
}
示例4: Read
/// <inheritdoc />
public override object Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
{
if (messageReader == null)
{
throw Error.ArgumentNull("messageReader");
}
if (readContext == null)
{
throw Error.ArgumentNull("readContext");
}
if (readContext.Path == null)
{
throw Error.Argument("readContext", SRResources.ODataPathMissing);
}
IEdmEntitySet entitySet = GetEntitySet(readContext.Path);
if (entitySet == null)
{
throw new SerializationException(SRResources.EntitySetMissingDuringDeserialization);
}
IEdmTypeReference edmType = readContext.GetEdmType(type);
Contract.Assert(edmType != null);
if (!edmType.IsEntity())
{
throw Error.Argument("type", SRResources.ArgumentMustBeOfType, EdmTypeKind.Entity);
}
IEdmEntityTypeReference entityType = edmType.AsEntity();
ODataReader odataReader = messageReader.CreateODataEntryReader(entitySet, entityType.EntityDefinition());
ODataEntryWithNavigationLinks topLevelEntry = ReadEntryOrFeed(odataReader) as ODataEntryWithNavigationLinks;
Contract.Assert(topLevelEntry != null);
return ReadInline(topLevelEntry, entityType, readContext);
}