[fix] 修复db生成代码的bug

main
walon 2023-01-06 21:49:38 +08:00
parent 874f966a40
commit ea30f8c202
6 changed files with 27 additions and 26 deletions

View File

@ -339,27 +339,5 @@ namespace Luban.Job.Cfg.Utils
{
return type.Apply(CsEditorInitValueVisitor.Ins);
}
public static string CsStartNameSpaceGrace(string np)
{
if (string.IsNullOrEmpty(np))
{
return string.Empty;
}
else
{
return $"namespace {np}\n{{";
}
}
public static string CsEndNameSpaceGrace(string np)
{
if (string.IsNullOrEmpty(np))
{
return string.Empty;
}
else
{
return "}";
}
}
}
}

View File

@ -318,5 +318,28 @@ namespace Luban.Job.Common.Defs
{
return type is TDateTime && !type.IsNullable && ExternalTypeUtil.GetExternalTypeMappfer("datetime") == null;
}
public static string CsStartNameSpaceGrace(string np)
{
if (string.IsNullOrEmpty(np))
{
return string.Empty;
}
else
{
return $"namespace {np}\n{{";
}
}
public static string CsEndNameSpaceGrace(string np)
{
if (string.IsNullOrEmpty(np))
{
return string.Empty;
}
else
{
return "}";
}
}
}
}

View File

@ -23,7 +23,7 @@ namespace Luban.Job.Db.Generate
public string Render(DefEnum e)
{
var template = StringTemplateManager.Ins.GetTemplate("common/cs/enum");
var result = template.Render(e);
var result = template.RenderCode(e);
return result;
}

View File

@ -112,7 +112,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
public {{db_cs_define_type ctype}} {{field.convention_name}} => {{field.internal_name}};
{{~end~}}
{{~if ctype.bean || ctype.element_type ~}}
{{~if ctype.bean || (ctype.element_type && !ctype.is_map) ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.escape_comment}}

View File

@ -112,7 +112,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
public {{db_cs_define_type ctype}} {{field.convention_name}} => {{field.internal_name}};
{{~end~}}
{{~if ctype.bean || ctype.element_type ~}}
{{~if ctype.bean || (ctype.element_type && !ctype.is_map) ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.escape_comment}}