mirror of
https://github.com/anjoy8/Blog.Core.git
synced 2024-09-20 23:48:27 +08:00
Update DbHelper.ttinclude
This commit is contained in:
parent
9382f1a112
commit
be47f3a9a5
|
@ -1,4 +1,4 @@
|
|||
# K 快速上手
|
||||
# K 快速上手
|
||||
注意
|
||||
|
||||
请确保你的 `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) ;
|
||||
> 注意:这种方案,目前默认的只能是 `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`;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<#+
|
||||
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 TableName = "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user