Skip to content

Commit 42c5492

Browse files
committed
Update the entity -> nvarchar type,create database automatically
更新实体,创建nvarchar类型,并自动生成数据库
1 parent 781aa4d commit 42c5492

17 files changed

Lines changed: 88 additions & 95 deletions

Blog.Core.Common/DB/BaseDBConfig.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.IO;
1+
using System;
2+
using System.IO;
23

34
namespace Blog.Core.Common.DB
45
{
@@ -26,7 +27,7 @@ private static string InitConn()
2627
if (isSqliteEnabled)
2728
{
2829
DbType = DataBaseType.Sqlite;
29-
return sqliteConnection;
30+
return $"DataSource=" + Path.Combine(Environment.CurrentDirectory, sqliteConnection);
3031
}
3132
else if (isSqlServerEnabled)
3233
{

Blog.Core.Model/Models/Advertisement.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ public class Advertisement : RootEntity
99
/// <summary>
1010
/// 广告图片
1111
/// </summary>
12-
[SugarColumn(Length = 512, IsNullable = true)]
12+
[SugarColumn(Length = 512, IsNullable = true,ColumnDataType ="nvarchar")]
1313
public string ImgUrl { get; set; }
1414

1515
/// <summary>
1616
/// 广告标题
1717
/// </summary>
18-
[SugarColumn(Length = 64, IsNullable = true)]
18+
[SugarColumn(Length = 64, IsNullable = true,ColumnDataType ="nvarchar")]
1919
public string Title { get; set; }
2020

2121
/// <summary>
2222
/// 广告链接
2323
/// </summary>
24-
[SugarColumn(Length = 256, IsNullable = true)]
24+
[SugarColumn(Length = 256, IsNullable = true,ColumnDataType ="nvarchar")]
2525
public string Url { get; set; }
2626

2727
/// <summary>
2828
/// 备注
2929
/// </summary>
30-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
30+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
3131
public string Remark { get; set; }
3232

3333
/// <summary>

Blog.Core.Model/Models/BlogArticle.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ public class BlogArticle
1717
/// <summary>
1818
/// 创建人
1919
/// </summary>
20-
[SugarColumn(Length = 60, IsNullable = true)]
20+
[SugarColumn(Length = 60, IsNullable = true,ColumnDataType ="nvarchar")]
2121
public string bsubmitter { get; set; }
2222

2323
/// <summary>
2424
/// 标题blog
2525
/// </summary>
26-
[SugarColumn(Length = 256, IsNullable = true)]
26+
[SugarColumn(Length = 256, IsNullable = true,ColumnDataType ="nvarchar")]
2727
public string btitle { get; set; }
2828

2929
/// <summary>
3030
/// 类别
3131
/// </summary>
32-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
32+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
3333
public string bcategory { get; set; }
3434

3535
/// <summary>
@@ -60,7 +60,7 @@ public class BlogArticle
6060
/// <summary>
6161
/// 备注
6262
/// </summary>
63-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
63+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
6464
public string bRemark { get; set; }
6565

6666
/// <summary>

Blog.Core.Model/Models/Guestbook.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ public class Guestbook
2121
/// </summary>
2222
public DateTime createdate { get; set; }
2323

24-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
24+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
2525
public string username { get; set; }
2626

2727
/// <summary>手机
2828
///
2929
/// </summary>
30-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
30+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
3131
public string phone { get; set; }
3232
/// <summary>qq
3333
///
3434
/// </summary>
35-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
35+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
3636
public string QQ { get; set; }
3737

3838
/// <summary>留言内容
3939
///
4040
/// </summary>
41-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
41+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
4242
public string body { get; set; }
4343
/// <summary>ip地址
4444
///
4545
/// </summary>
46-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
46+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
4747
public string ip { get; set; }
4848

4949
/// <summary>是否显示在前台,0否1是

Blog.Core.Model/Models/Module.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,37 @@ public Module()
3333
/// <summary>
3434
/// 名称
3535
/// </summary>
36-
[SugarColumn(Length = 50, IsNullable = true)]
36+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
3737
public string Name { get; set; }
3838
/// <summary>
3939
/// 菜单链接地址
4040
/// </summary>
41-
[SugarColumn(Length = 100, IsNullable = true)]
41+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
4242
public string LinkUrl { get; set; }
4343
/// <summary>
4444
/// 区域名称
4545
/// </summary>
46-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
46+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
4747
public string Area { get; set; }
4848
/// <summary>
4949
/// 控制器名称
5050
/// </summary>
51-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
51+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
5252
public string Controller { get; set; }
5353
/// <summary>
5454
/// Action名称
5555
/// </summary>
56-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
56+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
5757
public string Action { get; set; }
5858
/// <summary>
5959
/// 图标
6060
/// </summary>
61-
[SugarColumn(Length = 100, IsNullable = true)]
61+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
6262
public string Icon { get; set; }
6363
/// <summary>
6464
/// 菜单编号
6565
/// </summary>
66-
[SugarColumn(Length = 10, IsNullable = true)]
66+
[SugarColumn(Length = 10, IsNullable = true,ColumnDataType ="nvarchar")]
6767
public string Code { get; set; }
6868
/// <summary>
6969
/// 排序
@@ -72,7 +72,7 @@ public Module()
7272
/// <summary>
7373
/// /描述
7474
/// </summary>
75-
[SugarColumn(Length = 100, IsNullable = true)]
75+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
7676
public string Description { get; set; }
7777
/// <summary>
7878
/// 是否是右侧菜单
@@ -90,7 +90,7 @@ public Module()
9090
/// <summary>
9191
/// 创建者
9292
/// </summary>
93-
[SugarColumn(Length = 50, IsNullable = true)]
93+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
9494
public string CreateBy { get; set; }
9595
/// <summary>
9696
/// 创建时间
@@ -105,7 +105,7 @@ public Module()
105105
/// <summary>
106106
/// 修改者
107107
/// </summary>
108-
[SugarColumn(Length = 100, IsNullable = true)]
108+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
109109
public string ModifyBy { get; set; }
110110
/// <summary>
111111
/// 修改时间

Blog.Core.Model/Models/ModulePermission.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class ModulePermission : RootEntity
3434
/// <summary>
3535
/// 创建者
3636
/// </summary>
37-
[SugarColumn(Length = 50, IsNullable = true)]
37+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
3838
public string CreateBy { get; set; }
3939
/// <summary>
4040
/// 创建时间
@@ -49,7 +49,7 @@ public class ModulePermission : RootEntity
4949
/// <summary>
5050
/// 修改者
5151
/// </summary>
52-
[SugarColumn(Length = 50, IsNullable = true)]
52+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
5353
public string ModifyBy { get; set; }
5454
/// <summary>
5555
///修改时间

Blog.Core.Model/Models/OperateLog.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ public class OperateLog : RootEntity
2121
/// <summary>
2222
/// 区域名
2323
/// </summary>
24-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
24+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
2525
public string Area { get; set; }
2626
/// <summary>
2727
/// 区域控制器名
2828
/// </summary>
29-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
29+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
3030
public string Controller { get; set; }
3131
/// <summary>
3232
/// Action名称
3333
/// </summary>
34-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
34+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
3535
public string Action { get; set; }
3636
/// <summary>
3737
/// IP地址
3838
/// </summary>
39-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
39+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
4040
public string IPAddress { get; set; }
4141
/// <summary>
4242
/// 描述
4343
/// </summary>
44-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
44+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
4545
public string Description { get; set; }
4646
/// <summary>
4747
/// 登录时间
@@ -51,7 +51,7 @@ public class OperateLog : RootEntity
5151
/// <summary>
5252
/// 登录名称
5353
/// </summary>
54-
[SugarColumn(Length = int.MaxValue, IsNullable = true)]
54+
[SugarColumn(Length = int.MaxValue, IsNullable = true,ColumnDataType ="nvarchar")]
5555
public string LoginName { get; set; }
5656
/// <summary>
5757
/// 用户ID

Blog.Core.Model/Models/PasswordLib.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public class PasswordLib
2121
[SugarColumn(IsNullable = true)]
2222
public bool? IsDeleted { get; set; }
2323

24-
[SugarColumn(Length = 200, IsNullable = true)]
24+
[SugarColumn(Length = 200, IsNullable = true,ColumnDataType ="nvarchar")]
2525
public string plURL { get; set; }
2626

27-
[SugarColumn(Length = 100, IsNullable = true)]
27+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
2828
public string plPWD { get; set; }
2929

30-
[SugarColumn(Length = 200, IsNullable = true)]
30+
[SugarColumn(Length = 200, IsNullable = true,ColumnDataType ="nvarchar")]
3131
public string plAccountName { get; set; }
3232

3333
[SugarColumn( IsNullable = true)]
@@ -36,10 +36,10 @@ public class PasswordLib
3636
[SugarColumn( IsNullable = true)]
3737
public int? plErrorCount { get; set; }
3838

39-
[SugarColumn(Length = 200, IsNullable = true)]
39+
[SugarColumn(Length = 200, IsNullable = true,ColumnDataType ="nvarchar")]
4040
public string plHintPwd { get; set; }
4141

42-
[SugarColumn(Length = 200, IsNullable = true)]
42+
[SugarColumn(Length = 200, IsNullable = true,ColumnDataType ="nvarchar")]
4343
public string plHintquestion { get; set; }
4444

4545
[SugarColumn( IsNullable = true)]
@@ -51,7 +51,7 @@ public class PasswordLib
5151
[SugarColumn( IsNullable = true)]
5252
public DateTime? plLastErrTime { get; set; }
5353

54-
[SugarColumn(Length = 200, IsNullable = true)]
54+
[SugarColumn(Length = 200, IsNullable = true,ColumnDataType ="nvarchar")]
5555
public string test { get; set; }
5656

5757

Blog.Core.Model/Models/Permission.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public Permission()
2121
/// <summary>
2222
/// 菜单执行Action名
2323
/// </summary>
24-
[SugarColumn(Length = 50, IsNullable = true)]
24+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
2525
public string Code { get; set; }
2626
/// <summary>
2727
/// 菜单显示名(如用户页、编辑(按钮)、删除(按钮))
2828
/// </summary>
29-
[SugarColumn(Length = 50, IsNullable = true)]
29+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
3030
public string Name { get; set; }
3131
/// <summary>
3232
/// 是否是按钮
@@ -42,7 +42,7 @@ public Permission()
4242
/// <summary>
4343
/// 按钮事件
4444
/// </summary>
45-
[SugarColumn(IsNullable = true)]
45+
[SugarColumn(IsNullable = true,ColumnDataType ="nvarchar")]
4646
public string Func { get; set; }
4747

4848

@@ -65,12 +65,12 @@ public Permission()
6565
/// <summary>
6666
/// 菜单图标
6767
/// </summary>
68-
[SugarColumn(Length = 100, IsNullable = true)]
68+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
6969
public string Icon { get; set; }
7070
/// <summary>
7171
/// 菜单描述
7272
/// </summary>
73-
[SugarColumn(Length = 100, IsNullable = true)]
73+
[SugarColumn(Length = 100, IsNullable = true,ColumnDataType ="nvarchar")]
7474
public string Description { get; set; }
7575
/// <summary>
7676
/// 激活状态
@@ -84,7 +84,7 @@ public Permission()
8484
/// <summary>
8585
/// 创建者
8686
/// </summary>
87-
[SugarColumn(Length = 50, IsNullable = true)]
87+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
8888
public string CreateBy { get; set; }
8989
/// <summary>
9090
/// 创建时间
@@ -99,7 +99,7 @@ public Permission()
9999
/// <summary>
100100
/// 修改者
101101
/// </summary>
102-
[SugarColumn(Length = 50, IsNullable = true)]
102+
[SugarColumn(Length = 50, IsNullable = true,ColumnDataType ="nvarchar")]
103103
public string ModifyBy { get; set; }
104104
/// <summary>
105105
/// 修改时间

0 commit comments

Comments
 (0)