For converting type names meets two delegates EntityTypeNamespaceBuilder and EntityTypeNameBuilder.

/// <summary> 
/// Delegate for building names for EDM entity type. 
/// </summary> 
public Func<Type, string> EntityTypeNameBuilder { get; set; }

In EntityTypeNameBuilder you can implement the fixed functionality, i.e. to make the analog method:

/// <summary> 
/// Builds the name of the entity. 
/// Default logic, for <see cref="EntityTypeNameBuilder"/>. 
/// </summary> 
/// <param name="dataObjectType">Type of the data object.</param> 
/// <returns>The name of The appropriate EDM entity.</returns> 
private string BuildEntityTypeName(Type dataObjectType)
{
    PublishNameAttribute attr = dataObjectType.GetCustomAttribute<PublishNameAttribute>(false);
    if (attr != null)
    {
        int lastPos = attr.TypePublishName.LastIndexOf(".");
        if (lastPos < 0)
            return attr.TypePublishName;
        return attr.TypePublishName.Substring(lastPos + 1);
    }
 
    return dataObjectType.Name;
}

Source method.

PstrfEntityTypeNamespaceBuilder` for a method by default returns empty string, so it will also need to override:

builder.EntityTypeNamespaceBuilder = (dataObjectType) => dataObjectType.Namespace;

The name of the entity type in OData must be complete, i.e. with namespace. Accordingly, if no namespace, the full name of the entity type will look like “.ClassName”:

<EntityType Name="DocumentFileKind" BaseType=".Catalog" OpenType="true">
    <Property Name="CreateTime" Type="Edm.DateTimeOffset" />
    <Property Name="Creator" Type="Edm.String" />
    <Property Name="EditTime" Type="Edm.DateTimeOffset" />
    <Property Name="Editor" Type="Edm.String" />
    <NavigationProperty Name="NewName" Type=".DocumentFileKind" />
</EntityType>
 
<EntitySet Name="FederalLaws" EntityType=".FederalLaw">
    <NavigationPropertyBinding Path="LawIntroductionReason" Target="LawIntroductionReasons" />
</EntitySet>
Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru