mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-25 04:27:14 +08:00
Update db.First razor
This commit is contained in:
@@ -144,6 +144,7 @@ namespace SqlSugar
|
||||
Check.Exception(true, ErrorMessage.GetThrowMessage("Need to achieve ConnectionConfig.ConfigureExternal Services.RazorService", "需要实现 ConnectionConfig.ConfigureExternal Services.RazorService接口"));
|
||||
}
|
||||
this.Context.Utilities.RemoveCacheAll();
|
||||
result.FormatFileNameFunc = this.FormatFileNameFunc;
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace SqlSugar
|
||||
public class RazorFirst
|
||||
{
|
||||
internal List<KeyValuePair<string,string>> ClassStringList { get; set; }
|
||||
internal Func<string, string> FormatFileNameFunc { get; set; }
|
||||
|
||||
public static string DefaultRazorClassTemplate =
|
||||
@"using System;
|
||||
@@ -79,7 +80,12 @@ namespace @Model.Namespace
|
||||
{
|
||||
foreach (var item in ClassStringList)
|
||||
{
|
||||
var filePath = directoryPath.TrimEnd('\\').TrimEnd('/') + string.Format(seChar + "{0}.cs", item.Key);
|
||||
var fileName = item.Key;
|
||||
if (this.FormatFileNameFunc != null)
|
||||
{
|
||||
fileName = this.FormatFileNameFunc(fileName);
|
||||
}
|
||||
var filePath = directoryPath.TrimEnd('\\').TrimEnd('/') + string.Format(seChar + "{0}.cs",fileName);
|
||||
FileHelper.CreateFile(filePath, item.Value, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user