Skip to content

Commit 8b27954

Browse files
committed
Improve the code with request from #24, and refactor for #23
1 parent 3975e95 commit 8b27954

28 files changed

+408
-398
lines changed

netcorekit.sln

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
4343
EndProject
4444
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "__", "__", "{EE8515E4-F600-4699-A652-FE8E241B9A83}"
4545
EndProject
46-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreKit.Samples.TodoApi", "samples\TodoApi\NetCoreKit.Samples.TodoApi.csproj", "{07F7005A-062E-478D-93C0-3B7E1C42389E}"
47-
EndProject
4846
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreKit.Infrastructure", "src\NetCoreKit.Infrastructure\NetCoreKit.Infrastructure.csproj", "{EE16B7AA-67D5-463E-A24F-6221DBD80A5F}"
4947
EndProject
5048
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreKit.Infrastructure.EfCore.MySql", "src\NetCoreKit.Infrastructure.EfCore.MySql\NetCoreKit.Infrastructure.EfCore.MySql.csproj", "{CBEEBE6A-BBC3-420A-A491-48EDEEF058FE}"
@@ -72,6 +70,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreKit.Infrastructure.M
7270
EndProject
7371
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreKit.Samples.BiMonetaryApi", "samples\BiMonetaryApi\NetCoreKit.Samples.BiMonetaryApi.csproj", "{1BE9EF11-ED30-4DC7-A12E-2D915E8DA85E}"
7472
EndProject
73+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreKit.Samples.TodoApi", "samples\TodoApi\NetCoreKit.Samples.TodoApi.csproj", "{BF6A7924-82C2-4471-AB03-99DD1259D454}"
74+
EndProject
7575
Global
7676
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7777
Debug|Any CPU = Debug|Any CPU
@@ -144,14 +144,6 @@ Global
144144
{D6B29A97-1417-48A6-B141-74D57E5C8C16}.Release|Any CPU.Build.0 = Release|Any CPU
145145
{D6B29A97-1417-48A6-B141-74D57E5C8C16}.Release|x86.ActiveCfg = Release|Any CPU
146146
{D6B29A97-1417-48A6-B141-74D57E5C8C16}.Release|x86.Build.0 = Release|Any CPU
147-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
148-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Debug|Any CPU.Build.0 = Debug|Any CPU
149-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Debug|x86.ActiveCfg = Debug|Any CPU
150-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Debug|x86.Build.0 = Debug|Any CPU
151-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Release|Any CPU.ActiveCfg = Release|Any CPU
152-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Release|Any CPU.Build.0 = Release|Any CPU
153-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Release|x86.ActiveCfg = Release|Any CPU
154-
{07F7005A-062E-478D-93C0-3B7E1C42389E}.Release|x86.Build.0 = Release|Any CPU
155147
{EE16B7AA-67D5-463E-A24F-6221DBD80A5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
156148
{EE16B7AA-67D5-463E-A24F-6221DBD80A5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
157149
{EE16B7AA-67D5-463E-A24F-6221DBD80A5F}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -240,6 +232,14 @@ Global
240232
{1BE9EF11-ED30-4DC7-A12E-2D915E8DA85E}.Release|Any CPU.Build.0 = Release|Any CPU
241233
{1BE9EF11-ED30-4DC7-A12E-2D915E8DA85E}.Release|x86.ActiveCfg = Release|Any CPU
242234
{1BE9EF11-ED30-4DC7-A12E-2D915E8DA85E}.Release|x86.Build.0 = Release|Any CPU
235+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
236+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Debug|Any CPU.Build.0 = Debug|Any CPU
237+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Debug|x86.ActiveCfg = Debug|Any CPU
238+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Debug|x86.Build.0 = Debug|Any CPU
239+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Release|Any CPU.ActiveCfg = Release|Any CPU
240+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Release|Any CPU.Build.0 = Release|Any CPU
241+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Release|x86.ActiveCfg = Release|Any CPU
242+
{BF6A7924-82C2-4471-AB03-99DD1259D454}.Release|x86.Build.0 = Release|Any CPU
243243
EndGlobalSection
244244
GlobalSection(SolutionProperties) = preSolution
245245
HideSolutionNode = FALSE
@@ -254,7 +254,6 @@ Global
254254
{FA666FF1-5453-481D-BBDD-842F151F9E75} = {6CF50533-EBD6-47B1-9AD9-9EBBFF3AC887}
255255
{D6B29A97-1417-48A6-B141-74D57E5C8C16} = {6CF50533-EBD6-47B1-9AD9-9EBBFF3AC887}
256256
{A1CCC105-67B3-45AE-9A74-DD6716521708} = {EE8515E4-F600-4699-A652-FE8E241B9A83}
257-
{07F7005A-062E-478D-93C0-3B7E1C42389E} = {92D6FD73-B95C-4CBB-A48E-047672EB4E77}
258257
{EE16B7AA-67D5-463E-A24F-6221DBD80A5F} = {6CF50533-EBD6-47B1-9AD9-9EBBFF3AC887}
259258
{CBEEBE6A-BBC3-420A-A491-48EDEEF058FE} = {6CF50533-EBD6-47B1-9AD9-9EBBFF3AC887}
260259
{BEA4FAB4-1A38-4720-8CCB-D7074CF7596D} = {6CF50533-EBD6-47B1-9AD9-9EBBFF3AC887}
@@ -267,6 +266,7 @@ Global
267266
{B955EE6A-DBD9-474A-AE34-E1960E887F0F} = {92D6FD73-B95C-4CBB-A48E-047672EB4E77}
268267
{BAAB999F-EF03-4575-8FD4-9989A544319E} = {6CF50533-EBD6-47B1-9AD9-9EBBFF3AC887}
269268
{1BE9EF11-ED30-4DC7-A12E-2D915E8DA85E} = {92D6FD73-B95C-4CBB-A48E-047672EB4E77}
269+
{BF6A7924-82C2-4471-AB03-99DD1259D454} = {92D6FD73-B95C-4CBB-A48E-047672EB4E77}
270270
EndGlobalSection
271271
GlobalSection(ExtensibilityGlobals) = postSolution
272272
SolutionGuid = {B9325AE8-21A8-4D46-9B04-38BD2BC35C0F}

samples/TodoApi/Infrastructure/Db/TodoListDbModelBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.EntityFrameworkCore;
22
using NetCoreKit.Infrastructure.EfCore.Db;
3-
using NetCoreKit.Samples.TodoAPI.Domain;
43

54
namespace NetCoreKit.Samples.TodoAPI.Infrastructure.Db
65
{

samples/TodoApi/Infrastructure/Gateways/UserGateway.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
using System.Threading.Tasks;
33
using NetCoreKit.Samples.TodoAPI.Domain;
44
using NetCoreKit.Samples.TodoAPI.Dtos;
5-
using NetCoreKit.Utils.Attributes;
65
using Task = System.Threading.Tasks.Task;
76

87
namespace NetCoreKit.Samples.TodoAPI.Infrastructure.Gateways
98
{
10-
[AutoScanAwareness]
119
public class UserGateway : IUserGateway
1210
{
1311
public Task<AuthorDto> GetAuthorAsync()

samples/TodoApi/Migrations/20180921105440_InitToDoDb.Designer.cs renamed to samples/TodoApi/Migrations/20181207042249_InitTodoDb.Designer.cs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/TodoApi/Migrations/20180921105440_InitToDoDb.cs renamed to samples/TodoApi/Migrations/20181207042249_InitTodoDb.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System;
22
using Microsoft.EntityFrameworkCore.Migrations;
33

4-
namespace NetCoreKit.Samples.TodoAPI.Migrations
4+
namespace NetCoreKit.Samples.TodoApi.Migrations
55
{
6-
public partial class InitToDoDb : Migration
6+
public partial class InitTodoDb : Migration
77
{
88
protected override void Up(MigrationBuilder migrationBuilder)
99
{

samples/TodoApi/Migrations/TodoListDbContextModelSnapshot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
66
using NetCoreKit.Samples.TodoAPI.Infrastructure.Db;
77

8-
namespace NetCoreKit.Samples.TodoAPI.Migrations
8+
namespace NetCoreKit.Samples.TodoApi.Migrations
99
{
1010
[DbContext(typeof(TodoListDbContext))]
1111
partial class TodoListDbContextModelSnapshot : ModelSnapshot
@@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1414
{
1515
#pragma warning disable 612, 618
1616
modelBuilder
17-
.HasAnnotation("ProductVersion", "2.1.2-rtm-30932")
17+
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024")
1818
.HasAnnotation("Relational:MaxIdentifierLength", 64);
1919

2020
modelBuilder.Entity("NetCoreKit.Samples.TodoAPI.Domain.Project", b =>

samples/TodoApi/NetCoreKit.Samples.TodoApi.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@
3131
<ProjectReference Include="..\Contracts\NetCoreKit.Samples.Contracts.csproj" />
3232
</ItemGroup>
3333

34-
</Project>
34+
<ItemGroup>
35+
<Folder Include="Migrations\" />
36+
</ItemGroup>
37+
38+
</Project>

samples/TodoApi/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class Program
1111
public static void Main(string[] args)
1212
{
1313
var webHost = CreateWebHostBuilder(args).Build();
14-
var env = webHost.Services.GetService<IHostingEnvironment>();
15-
if (env.IsDevelopment()) webHost = webHost.RegisterDbContext<TodoListDbContext>();
14+
//var env = webHost.Services.GetService<IHostingEnvironment>();
15+
//if (env.IsDevelopment()) webHost = webHost.RegisterDbContext<TodoListDbContext>();
1616
webHost.Run();
1717
}
1818

samples/TodoApi/appsettings.Development.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
"CurrentUri": "http://localhost:5001"
55
}
66
},
7-
"MySqlDb": {
8-
"FQDN": "127.0.0.1:32605",
9-
"Password": "P@ssw0rd"
10-
},
11-
"Redis": {
12-
"FQDN": "127.0.0.1:32170",
13-
"Password": "letmein"
14-
},
15-
"Kafka": {
16-
"FQDN": "127.0.0.1:9092"
7+
"Features": {
8+
"EfCore": {
9+
"MySqlDb": {
10+
"FQDN": "127.0.0.1:32605",
11+
"Password": "P@ssw0rd"
12+
}
13+
},
14+
"Redis": {
15+
"FQDN": "127.0.0.1:32170",
16+
"Password": "letmein"
17+
},
18+
"Kafka": {
19+
"FQDN": "127.0.0.1:9092"
20+
}
1721
},
1822
"Logging": {
1923
"IncludeScopes": false,

samples/TodoApi/appsettings.json

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,41 @@
88
"CurrentUri": "http://localhost:32501"
99
}
1010
},
11-
"EfCore": {
12-
"Enabled": true
13-
},
14-
"RestClient": {
15-
"Enabled": true
16-
},
17-
"CleanArchitecture": {
18-
"Enabled": true
19-
},
20-
"ApiVersion": {
21-
"Enabled": true
22-
},
23-
"OpenApi": {
24-
"Enabled": true,
25-
"UI": {
26-
"Enabled": true
11+
"Features": {
12+
"EfCore": {
13+
"Enabled": true,
14+
//"SqlServerConnString": "Server=tcp:{0},{1};Database={2};User Id={3};Password={4};"
15+
"MySqlDb": {
16+
"Database": "maindb",
17+
"UserName": "root",
18+
"Password": "letmein",
19+
"DbInfo": "5.7.14-mysql",
20+
"ConnString": "server={0};port={1};uid={2};pwd={3};database={4}"
21+
}
2722
},
28-
"Profiler": {
23+
"CleanArch": {
2924
"Enabled": true
25+
},
26+
"ApiVersion": { "Enabled": true },
27+
"OpenApi": {
28+
"Enabled": true,
29+
"UI": {
30+
"Enabled": true
31+
},
32+
"Profiler": {
33+
"Enabled": true
34+
},
35+
"ApiInfo": {
36+
"Title": "Todo APIs",
37+
"Description": "An application with Swagger, Swashbuckle, and API versioning.",
38+
"ContactName": "Vietnam Devs",
39+
"ContactEmail": "[email protected]",
40+
"TermOfService": "Shareware",
41+
"LicenseName": "MIT",
42+
"LicenseUrl": "https://github.com/cloudnative-netcore/netcorekit/blob/master/LICENSE"
43+
}
3044
}
3145
},
32-
"ConnectionStrings": {
33-
"MsSqlDb": "Server=tcp:{0},{1};Database={2};User Id={3};Password={4};",
34-
"MySqlDb": "server={0};port={1};uid={2};pwd={3};database={4}"
35-
},
36-
"MySqlDb": {
37-
"Database": "maindb",
38-
"UserName": "root",
39-
"Password": "letmein",
40-
"DbInfo": "5.7.14-mysql"
41-
},
4246
"Logging": {
4347
"IncludeScopes": false,
4448
"Debug": {

0 commit comments

Comments
 (0)