本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmComplexTypeReference.FullName方法的典型用法代码示例。如果您正苦于以下问题:C# EdmComplexTypeReference.FullName方法的具体用法?C# EdmComplexTypeReference.FullName怎么用?C# EdmComplexTypeReference.FullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmComplexTypeReference
的用法示例。
在下文中一共展示了EdmComplexTypeReference.FullName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadComplexValue
/// <summary>
/// Deserializes the given <paramref name="complexValue"/> under the given <paramref name="readContext"/>.
/// </summary>
/// <param name="complexValue">The complex value to deserialize.</param>
/// <param name="complexType">The EDM type of the complex value to read.</param>
/// <param name="readContext">The deserializer context.</param>
/// <returns>The deserialized complex value.</returns>
public virtual object ReadComplexValue(ODataComplexValue complexValue, IEdmComplexTypeReference complexType,
ODataDeserializerContext readContext)
{
if (complexValue == null)
{
throw Error.ArgumentNull("complexValue");
}
if (readContext == null)
{
throw Error.ArgumentNull("readContext");
}
if (readContext.Model == null)
{
throw Error.Argument("readContext", SRResources.ModelMissingFromReadContext);
}
if (!String.IsNullOrEmpty(complexValue.TypeName) && complexType.FullName() != complexValue.TypeName)
{
// received a derived complex type in a base type deserializer.
IEdmModel model = readContext.Model;
if (model == null)
{
throw Error.Argument("readContext", SRResources.ModelMissingFromReadContext);
}
IEdmComplexType actualType = model.FindType(complexValue.TypeName) as IEdmComplexType;
if (actualType == null)
{
throw new ODataException(Error.Format(SRResources.ComplexTypeNotInModel, complexValue.TypeName));
}
if (actualType.IsAbstract)
{
string message = Error.Format(SRResources.CannotInstantiateAbstractComplexType,
complexValue.TypeName);
throw new ODataException(message);
}
IEdmTypeReference actualComplexType = new EdmComplexTypeReference(actualType, isNullable: false);
ODataEdmTypeDeserializer deserializer = DeserializerProvider.GetEdmTypeDeserializer(actualComplexType);
if (deserializer == null)
{
throw new SerializationException(
Error.Format(SRResources.TypeCannotBeDeserialized, actualComplexType.FullName(),
typeof(ODataMediaTypeFormatter).Name));
}
object resource = deserializer.ReadInline(complexValue, actualComplexType, readContext);
EdmStructuredObject structuredObject = resource as EdmStructuredObject;
if (structuredObject != null)
{
structuredObject.ExpectedEdmType = complexType.ComplexDefinition();
}
return resource;
}
else
{
object complexResource = CreateResource(complexType, readContext);
foreach (ODataProperty complexProperty in complexValue.Properties)
{
DeserializationHelpers.ApplyProperty(complexProperty, complexType, complexResource,
DeserializerProvider, readContext);
}
return complexResource;
}
}
示例2: Named_type_reference_fullName_returns_fullName
public void Named_type_reference_fullName_returns_fullName()
{
IEdmModel edmModel = this.GetEdmModel();
foreach (var entity in edmModel.SchemaElements.OfType<IEdmEntityType>())
{
var entityTypeRef = new EdmEntityTypeReference(entity, false);
Assert.IsNotNull(entityTypeRef.FullName(), "EntityTypeReference.FullName()");
Assert.AreEqual(entity.FullName(), entityTypeRef.FullName(), "EntityTypeReference.FullName()");
}
foreach (var complex in edmModel.SchemaElements.OfType<IEdmComplexType>())
{
var complexTypeRef = new EdmComplexTypeReference(complex, false);
Assert.IsNotNull(complexTypeRef.FullName(), "ComplexTypeReference.FullName()");
Assert.AreEqual(complex.FullName(), complexTypeRef.FullName(), "ComplexTypeReference.FullName()");
}
}