Skip to content

Commit

Permalink
ubuntu环境测试postgresql数据库
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTzeng committed Nov 27, 2017
1 parent 52cffd0 commit e581f9d
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Zxw.Framework.Website/bin/Debug/netcoreapp2.0/Zxw.Framework.Website.dll",
"args": [],
"cwd": "${workspaceFolder}/Zxw.Framework.Website",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"taskName": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Zxw.Framework.Website/Zxw.Framework.Website.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
4 changes: 2 additions & 2 deletions Zxw.Framework.Website.Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public HomeController(ITutorClassTypeService tutorClassTypeService)
}
public IActionResult Index()
{
CodeGenerator.Generate();//生成所有实体类对应的Repository和Service层代码文件
CodeGenerator.GenerateSingle<TutorClassType, int>();//生成单个实体类对应的Repository和Service层代码文件
// CodeGenerator.Generate();//生成所有实体类对应的Repository和Service层代码文件
// CodeGenerator.GenerateSingle<TutorClassType, int>();//生成单个实体类对应的Repository和Service层代码文件
var list = iTutorClassTypeService.GetByCache();
return View(list);
}
Expand Down
4 changes: 2 additions & 2 deletions Zxw.Framework.Website/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
/// <returns></returns>
private IServiceProvider InitIoC(IServiceCollection services)
{
var connectionString = Configuration.GetConnectionString("MsSqlServer");
var connectionString = Configuration.GetConnectionString("PostgreSQL");
var dbContextOption = new DbContextOption
{
ConnectionString = connectionString,
ModelAssemblyName = "Zxw.Framework.Website.Models",
DbType = DbType.MSSQLSERVER
DbType = DbType.NPGSQL
};
var codeGenerateOption = new CodeGenerateOption
{
Expand Down
3 changes: 2 additions & 1 deletion Zxw.Framework.Website/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}
},
"ConnectionStrings": {
"MsSqlServer": "initial catalog=HolidaySchool;data source=127.0.0.1;password=123456;User id=sa;MultipleActiveResultSets=True"
"MsSqlServer": "initial catalog=HolidaySchool;data source=127.0.0.1;password=123456;User id=sa;MultipleActiveResultSets=True",
"PostgreSQL":"User ID=zengxw;Password=123456;Host=localhost;Port=5432;Database=PgTest;Pooling=true;"
}
}

0 comments on commit e581f9d

Please sign in to comment.