mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 05:23:13 +00:00
fix
This commit is contained in:
@ -354,7 +354,7 @@ public class TypeTemplate
|
||||
}
|
||||
|
||||
|
||||
public static string GetTypeClassName(Type type, string separator = ".")
|
||||
public static string GetTypeClassName(Type type, char separator = '.')
|
||||
{
|
||||
|
||||
if (type.IsGenericType)
|
||||
@ -362,12 +362,12 @@ public class TypeTemplate
|
||||
var index = type.Name.IndexOf("`");
|
||||
var name = $"{type.Namespace}{separator}{((index > -1) ? type.Name.Substring(0, index) : type.Name)}Of";
|
||||
foreach (var t in type.GenericTypeArguments)
|
||||
name += GetTypeClassName(t, "_");
|
||||
name += GetTypeClassName(t, '_');
|
||||
|
||||
return name;
|
||||
}
|
||||
else
|
||||
return $"{type.Namespace}{separator}{type.Name}";
|
||||
return $"{type.Namespace.Replace('.', separator)}{separator}{type.Name}";
|
||||
}
|
||||
|
||||
|
||||
|
@ -767,11 +767,11 @@ public static class Warehouse
|
||||
/// <returns>Resource template.</returns>
|
||||
public static TypeTemplate GetTemplateByType(Type type)
|
||||
{
|
||||
var baseType = ResourceProxy.GetBaseType(type);
|
||||
|
||||
//TemplateType templateType = TemplateType.Unspecified;
|
||||
|
||||
//if (Codec.InheritsClass(type, typeof(DistributedResource)))
|
||||
// templateType = TemplateType.Wrapper;
|
||||
if (baseType == typeof(IResource)
|
||||
|| baseType == typeof(IRecord))
|
||||
return null;
|
||||
|
||||
TemplateType templateType;
|
||||
if (Codec.ImplementsInterface(type, typeof(IResource)))
|
||||
@ -783,20 +783,13 @@ public static class Warehouse
|
||||
else
|
||||
return null;
|
||||
|
||||
var baseType = ResourceProxy.GetBaseType(type);
|
||||
var template = templates[templateType].Values.FirstOrDefault(x => x.DefinedType == baseType);
|
||||
if (template != null)
|
||||
return template;
|
||||
|
||||
if (baseType == typeof(IResource)
|
||||
|| baseType == typeof(IRecord))
|
||||
return null;
|
||||
|
||||
var template = templates[templateType].Values.FirstOrDefault(x => x.DefinedType == type);
|
||||
|
||||
// loaded ?
|
||||
if (template == null)
|
||||
{
|
||||
template = new TypeTemplate(baseType, true);
|
||||
TypeTemplate.GetDependencies(template);
|
||||
}
|
||||
// create new template for type
|
||||
template = new TypeTemplate(baseType, true);
|
||||
TypeTemplate.GetDependencies(template);
|
||||
|
||||
return template;
|
||||
}
|
||||
|
Reference in New Issue
Block a user