File tree 13 files changed +84
-30
lines changed
13 files changed +84
-30
lines changed Original file line number Diff line number Diff line change 2
2
<PropertyGroup >
3
3
<VersionMajor >2</VersionMajor >
4
4
<VersionMinor >2</VersionMinor >
5
- <VersionPatch >55 </VersionPatch >
5
+ <VersionPatch >56 </VersionPatch >
6
6
<VersionPrefix >$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix >
7
7
</PropertyGroup >
8
8
</Project >
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ TemplateEngine:
12
12
Name : Razor
13
13
Root : .
14
14
Parameters :
15
- ExtractMode : QueryTime
15
+ ExtractMode : LastMaxModifyTime
16
16
ModifyTime : ModifyTime
17
17
ExtractConnectionString : Data Source=localhost;database=SqlServerDB;uid=SmartSql;pwd=SmartSql
18
18
LoadDbProvider : PostgreSql
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ Output:
14
14
Type : File
15
15
Path : ' E:\SmartSql-Starter'
16
16
Parameters :
17
- SmartSqlVersion : ' 4.0.58 '
18
- SmartSqlSchemaVersion : ' 4.0.42 '
17
+ SmartSqlVersion : ' 4.0.71 '
18
+ SmartSqlSchemaVersion : ' 4.0.65 '
19
19
BuildDir : ' E:\SmartSql-Starter\build'
20
20
DockerImage : ' smartsql.starter'
21
21
Original file line number Diff line number Diff line change 5
5
</PropertyGroup >
6
6
7
7
<ItemGroup >
8
- <PackageReference Include =" SmartSql.Options" Version =" 4.0.58 " />
9
- <PackageReference Include =" SmartSql.TypeHandler" Version =" 4.0.58 " />
10
- <PackageReference Include =" SmartSql.TypeHandler.PostgreSql" Version =" 4.0.58 " />
8
+ <PackageReference Include =" SmartSql.Options" Version =" 4.0.71 " />
9
+ <PackageReference Include =" SmartSql.TypeHandler" Version =" 4.0.71 " />
10
+ <PackageReference Include =" SmartSql.TypeHandler.PostgreSql" Version =" 4.0.71 " />
11
11
<PackageReference Include =" System.Data.SqlClient" Version =" 4.6.1" />
12
12
<PackageReference Include =" System.Data.SQLite" Version =" 1.0.110" />
13
13
<PackageReference Include =" MySql.Data" Version =" 8.0.16" />
Original file line number Diff line number Diff line change 1
- <Project Sdk =" Microsoft.NET.Sdk" >
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
2
3
3
<PropertyGroup >
4
4
<TargetFramework >netstandard2.0</TargetFramework >
5
5
</PropertyGroup >
6
6
7
7
<ItemGroup >
8
- <PackageReference Include =" System.Data.SQLite" Version =" 1.0.110 " />
8
+ <PackageReference Include =" System.Data.SQLite" Version =" 1.0.111 " />
9
9
</ItemGroup >
10
10
11
11
<ItemGroup >
Original file line number Diff line number Diff line change 5
5
</PropertyGroup >
6
6
7
7
<ItemGroup >
8
- <PackageReference Include =" SmartSql.Bulk.MySql" Version =" 4.0.58 " />
9
- <PackageReference Include =" SmartSql.Bulk.PostgreSql" Version =" 4.0.58 " />
10
- <PackageReference Include =" SmartSql.Bulk.SqlServer" Version =" 4.0.58 " />
8
+ <PackageReference Include =" SmartSql.Bulk.MySql" Version =" 4.0.71 " />
9
+ <PackageReference Include =" SmartSql.Bulk.PostgreSql" Version =" 4.0.71 " />
10
+ <PackageReference Include =" SmartSql.Bulk.SqlServer" Version =" 4.0.71 " />
11
11
</ItemGroup >
12
12
13
13
<ItemGroup >
Original file line number Diff line number Diff line change 1
- namespace SmartCode . Generator . Entity {
2
-
3
- public static class ColumnExtensions {
1
+ using System ;
2
+ using System . Text ;
4
3
4
+ namespace SmartCode . Generator . Entity
5
+ {
6
+ public static class ColumnExtensions
7
+ {
5
8
/// <summary>
6
9
/// 获取列的摘要说明,如果 Description 不为空, 则返回 Description;
7
10
/// 否则返回 Name + DbType
8
11
/// </summary>
9
- public static string GetSummary ( this Column column ) {
10
- if ( ! string . IsNullOrEmpty ( column . Description ) ) {
12
+ public static string GetSummary ( this Column column )
13
+ {
14
+ if ( ! string . IsNullOrEmpty ( column . Description ) )
15
+ {
11
16
return column . Description ;
12
17
}
18
+
13
19
return column . Name + ", " + column . DbType ;
14
20
}
15
21
}
16
- }
22
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Text ;
3
+ using SmartCode . Generator . Entity ;
4
+
5
+ namespace SmartCode . Generator . Extensions
6
+ {
7
+ public static class SummaryExtensions
8
+ {
9
+ public static string GetCSharpSummary ( this Column column )
10
+ {
11
+ var summary = column . GetSummary ( ) ;
12
+ return GetCSharpSummary ( summary ) ;
13
+ }
14
+
15
+ public static string GetCSharpSummary ( this Table table )
16
+ {
17
+ var summary = table . GetSummary ( ) ;
18
+ return GetCSharpSummary ( summary ) ;
19
+ }
20
+ public static string GetCSharpSummary ( this string summary )
21
+ {
22
+ StringBuilder csharpSummary = new StringBuilder ( ) ;
23
+ csharpSummary . AppendLine ( "///<summary>" ) ;
24
+ if ( summary . Contains ( Environment . NewLine ) )
25
+ {
26
+ foreach ( var summaryLine in summary . Split ( Environment . NewLine . ToCharArray ( ) ) )
27
+ {
28
+ if ( String . IsNullOrEmpty ( summaryLine ) )
29
+ {
30
+ continue ;
31
+ }
32
+
33
+ csharpSummary . AppendLine ( $ "/// { summaryLine } ") ;
34
+ }
35
+ }
36
+ else
37
+ {
38
+ csharpSummary . AppendLine ( $ "/// { summary } ") ;
39
+ }
40
+
41
+ csharpSummary . Append ( "///</summary>" ) ;
42
+ return csharpSummary . ToString ( ) ;
43
+ }
44
+ }
45
+ }
Original file line number Diff line number Diff line change 1
1
@using SmartCode
2
+ @using SmartCode .Generator .Extensions
2
3
@model BuildContext
3
4
@{
4
5
Layout = " ../_CSharpLayout.cshtml" ;
@@ -25,6 +26,7 @@ using @(project.Module).API.Messages;
25
26
26
27
namespace @( project .Module ) .API.Controllers
27
28
{
29
+ @table.GetCSharpSummary()
28
30
[ApiController ]
29
31
[Route (" [controller]/[action]" )]
30
32
public class @(table.ConvertedName)Controller : Controller
Original file line number Diff line number Diff line change 13
13
" environmentVariables" : {
14
14
" ASPNETCORE_ENVIRONMENT" : " Development"
15
15
} ,
16
- " applicationUrl" : " http://localhost:8088/ "
16
+ " applicationUrl" : " http://localhost:8088"
17
17
}
18
18
}
19
19
}
Original file line number Diff line number Diff line change 1
1
@using SmartCode
2
+ @using SmartCode .Generator .Extensions
2
3
@model BuildContext
3
4
@{
4
5
Layout = " _CSharpLayout.cshtml" ;
@@ -31,21 +32,17 @@ public string ConvertLangType(SmartCode.Generator.Entity.Column column)
31
32
using System;
32
33
namespace @( project .Module ) .@buildTask.Module
33
34
{
34
- @Html.PadLeft(4) @( " ///<summary>" )
35
- @Html.PadLeft(4) @( $" ///{table .Description ?? table .ConvertedName }" )
36
- @Html.PadLeft(4) @( " ///</summary>" )
35
+
36
+ @table.GetCSharpSummary()
37
37
public class @table .ConvertedName
38
38
{
39
39
@foreach (var column in table .Columns)
40
40
{
41
- @Html .PadLeft (8 )@(" ///<summary>" )
42
- @Html .PadLeft (8 )@Html .NewLine ()
43
- @Html .PadLeft (8 )@($" ///{column .Description ?? column .ConvertedName }" )
44
- @Html .PadLeft (8 )@Html .NewLine ()
45
- @Html .PadLeft (8 )@(" ///</summary>" )
46
- @Html .PadLeft (8 )@Html .NewLine ()
47
- @Html .PadLeft (8 )< text > public < / text > < text > @(ConvertLangType (column ))< / text > < text > @column .ConvertedName < / text > < text > { get ; set ; }< / text >
48
- @Html .PadLeft (8 )@Html .NewLine ()
41
+
42
+ @column .GetCSharpSummary ()
43
+ @Html .NewLine ()
44
+ < text > public < / text > < text > @(ConvertLangType (column ))< / text > < text > @column .ConvertedName < / text > < text > { get ; set ; }< / text >
45
+ @Html .NewLine ()
49
46
}
50
47
}
51
48
}
Original file line number Diff line number Diff line change 1
1
@using SmartCode
2
2
@using SmartCode .Db ;
3
+ @using SmartCode .Generator .Extensions
3
4
@model BuildContext
4
5
@{
5
6
Layout = " _CSharpLayout.cshtml" ;
@@ -29,6 +30,7 @@ using @(project.Module).Entity;
29
30
30
31
namespace @( project .Module ) .@buildTask.Module
31
32
{
33
+ @table.GetCSharpSummary()
32
34
public interface I @(table.ConvertedName)Repository : IRepository <@(table .ConvertedName ), @(primaryKeyType )>
33
35
,IRepositoryAsync <@(table .ConvertedName ), @(primaryKeyType )>
34
36
{
Original file line number Diff line number Diff line change 1
1
@using SmartCode
2
+ @using SmartCode .Generator .Extensions
2
3
@model BuildContext
3
4
@{
4
5
Layout = " _CSharpLayout.cshtml" ;
@@ -25,6 +26,7 @@ using @(project.Module).Repository;
25
26
26
27
namespace @( project .Module ) .Service
27
28
{
29
+ @table.GetCSharpSummary()
28
30
public class @serviceName
29
31
{
30
32
public I@(repositoryName ) @repositoryName { get ; }
You can’t perform that action at this time.
0 commit comments