本文整理汇总了C#中IEdmModel.HasDefaultStream方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.HasDefaultStream方法的具体用法?C# IEdmModel.HasDefaultStream怎么用?C# IEdmModel.HasDefaultStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.HasDefaultStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateEntryMetadata
internal static void ValidateEntryMetadata(ODataEntry entry, IEdmEntityType entityType, IEdmModel model, bool validateMediaResource)
{
if ((entityType != null) && validateMediaResource)
{
bool flag = model.HasDefaultStream(entityType);
if (entry.MediaResource == null)
{
if (flag)
{
throw new ODataException(Microsoft.Data.OData.Strings.ValidationUtils_EntryWithoutMediaResourceAndMLEType(entityType.ODataFullName()));
}
}
else if (!flag)
{
throw new ODataException(Microsoft.Data.OData.Strings.ValidationUtils_EntryWithMediaResourceAndNonMLEType(entityType.ODataFullName()));
}
}
}
示例2: ValidateEntryMetadata
/// <summary>
/// Validates that the specified <paramref name="entry"/> is a valid entry as per the specified type.
/// </summary>
/// <param name="entry">The entry to validate.</param>
/// <param name="entityType">Optional entity type to validate the entry against.</param>
/// <param name="model">Model containing the entity type.</param>
/// <param name="validateMediaResource">true if the validation of the default MediaResource should be done; false otherwise.</param>
/// <remarks>If the <paramref name="entityType"/> is available only entry-level tests are performed, properties and such are not validated.</remarks>
internal static void ValidateEntryMetadata(ODataEntry entry, IEdmEntityType entityType, IEdmModel model, bool validateMediaResource)
{
DebugUtils.CheckNoExternalCallers();
Debug.Assert(entry != null, "entry != null");
if (entityType != null)
{
Debug.Assert(model != null, "model != null");
Debug.Assert(model.IsUserModel(), "model.IsUserModel()");
if (validateMediaResource)
{
bool hasDefaultStream = model.HasDefaultStream(entityType);
if (entry.MediaResource == null)
{
if (hasDefaultStream)
{
throw new ODataException(Strings.ValidationUtils_EntryWithoutMediaResourceAndMLEType(entityType.ODataFullName()));
}
}
else
{
if (!hasDefaultStream)
{
throw new ODataException(Strings.ValidationUtils_EntryWithMediaResourceAndNonMLEType(entityType.ODataFullName()));
}
}
}
}
}