Update DbHelper.ttinclude

This commit is contained in:
anjoy8 2020-12-01 07:06:58 +00:00
parent 9382f1a112
commit be47f3a9a5
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# K 快速上手 # K 快速上手
注意 注意
请确保你的 `Visual Studio 2019` 版本 >= `16.4` 请确保你的 `Visual Studio 2019` 版本 >= `16.4`
@ -104,7 +104,13 @@ Gitee国内 下载 [https://gitee.com/laozhangIsPhi/Blog.Core](https://git
## 新增数据库表,如何反向生成四层文件 ## 新增数据库表,如何反向生成四层文件
1、可以通过 `T4` 模板来生成,在 `Blog.Core.FrameWork` 层,使用方法: [9757999.html](https://www.cnblogs.com/laozhang-is-phi/p/9757999.html#autoid-4-3-0) 1、可以通过 `T4` 模板来生成,在 `Blog.Core.FrameWork` 层,使用方法: [9757999.html](https://www.cnblogs.com/laozhang-is-phi/p/9757999.html#autoid-4-3-0)
> 注意:这种方案,目前默认的只能是 `SqlServer` ,其他类型的数据库,可以看上边文章中的代码,或者群文件里对应的代码。 > 注意:这种方案,目前默认的只能是 `SqlServer` ,其他类型的数据库,可以看上边文章中的代码,或者群文件里对应的代码。
> 1、修改`DbHelper.ttinclude`文件中的连接字符串,注意是`SqlServer`的: public static readonly string ConnectionString;
> 2、然后去各个层模板文件点击`Ctrl+S`;
> 3、就会在对应的层内看到新文件比如Blog.Core.Model/Model_NEW
2、也可以通过 `Sqlsugar` 所带的方法来实现 `DbFirst`,具体查看 `Controller` 层下的 `DbFirstController.cs` 2、也可以通过 `Sqlsugar` 所带的方法来实现 `DbFirst`,具体查看 `Controller` 层下的 `DbFirstController.cs`

View File

@ -1,7 +1,7 @@
<#+ <#+
public class config public class config
{ {
public static readonly string ConnectionString = File.Exists(@"C:\my-file\dbCountPswSolsticeALDDD.txt") ? File.ReadAllText(@"C:\my-file\dbCountPswSolsticeALDDD.txt").Trim(): "server=.;uid=sa;pwd=sa;database=WMBlogDB"; public static readonly string ConnectionString = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMBLOG_MSSQL_1;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
public static readonly string DbDatabase = ""; public static readonly string DbDatabase = "";
public static readonly string TableName = ""; public static readonly string TableName = "";
} }