[opt] 优化配置中错误创建了抽象类型时的错误提示
parent
142e3ddf93
commit
f7814a0612
|
|
@ -245,7 +245,7 @@ namespace Luban.Job.Cfg.Utils
|
||||||
{
|
{
|
||||||
throw new Exception($"module:'{bean.Namespace}' 多态数据type不能为空");
|
throw new Exception($"module:'{bean.Namespace}' 多态数据type不能为空");
|
||||||
}
|
}
|
||||||
DefBean defType = bean.HierarchyNotAbstractChildren.Cast<DefBean>().Where(c => c.Alias == subType || c.Name == subType || c.FullName == subType).FirstOrDefault();
|
DefBean defType = bean.GetHierarchyChildren().Cast<DefBean>().Where(c => c.Alias == subType || c.Name == subType || c.FullName == subType).FirstOrDefault();
|
||||||
if (defType == null)
|
if (defType == null)
|
||||||
{
|
{
|
||||||
throw new Exception($"module:'{bean.Namespace}' type:'{subType}' 不是合法类型");
|
throw new Exception($"module:'{bean.Namespace}' type:'{subType}' 不是合法类型");
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,22 @@ namespace Luban.Job.Common.Defs
|
||||||
|
|
||||||
public List<DefBeanBase> HierarchyNotAbstractChildren { get; set; }
|
public List<DefBeanBase> HierarchyNotAbstractChildren { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<DefBeanBase> GetHierarchyChildren()
|
||||||
|
{
|
||||||
|
yield return this;
|
||||||
|
if (Children == null)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
foreach (var child in Children)
|
||||||
|
{
|
||||||
|
foreach(var c2 in child.GetHierarchyChildren())
|
||||||
|
{
|
||||||
|
yield return c2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsNotAbstractType => Children == null;
|
public bool IsNotAbstractType => Children == null;
|
||||||
|
|
||||||
public bool IsAbstractType => Children != null;
|
public bool IsAbstractType => Children != null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue