Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structural Refactoring - .NET 6.0 & SqlServer #45

Merged
merged 20 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ checks:
config:
threshold: 100
exclude_patterns:
- "src/IronHook.PostgreSql/Migrations/"
- "src/IronHook.EntityFrameworkCore.PostgreSql/Migrations/"
- "src/IronHook.EntityFrameworkCore.SqlServer/Migrations/"
- "samples/IronHook.Web/Migrations/"
35 changes: 26 additions & 9 deletions IronHook.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31410.223
# Visual Studio Version 17
VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B3D9DF87-38B1-4397-A4F5-9F6C45063E1B}"
EndProject
Expand All @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.Core", "src\IronHo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.EntityFrameworkCore", "src\IronHook.EntityFrameworkCore\IronHook.EntityFrameworkCore.csproj", "{1EE36765-D6E8-452E-B4A2-DC7157EF16D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.PostgreSql", "src\IronHook.PostgreSql\IronHook.PostgreSql.csproj", "{C7DF96DD-4046-425E-895D-295E66741FE6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.Web", "samples\IronHook.Web\IronHook.Web.csproj", "{DFF10173-23A6-4E76-88AE-0E6900236607}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{228129FA-C2BF-4B64-8B5F-E7DC3B6A2CA8}"
Expand All @@ -24,6 +22,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Dockerfile = Dockerfile
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.EntityFrameworkCore.SqlServer", "src\IronHook.EntityFrameworkCore.SqlServer\IronHook.EntityFrameworkCore.SqlServer.csproj", "{19CB6A33-941C-41BC-94A9-5E254F68A787}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.EntityFrameworkCore.PostgreSql", "src\IronHook.EntityFrameworkCore.PostgreSql\IronHook.EntityFrameworkCore.PostgreSql.csproj", "{7DB75589-C32C-42E7-B4B5-E140DB21082A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet6", "dotnet6", "{CA4AC978-0A6F-4B86-B805-DFE2F6904DAF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronHook.Web", "samples\dotnet6\IronHook.Web\IronHook.Web.csproj", "{719956BA-2B70-404C-A8CB-F780623F4178}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -38,23 +44,34 @@ Global
{1EE36765-D6E8-452E-B4A2-DC7157EF16D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EE36765-D6E8-452E-B4A2-DC7157EF16D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EE36765-D6E8-452E-B4A2-DC7157EF16D2}.Release|Any CPU.Build.0 = Release|Any CPU
{C7DF96DD-4046-425E-895D-295E66741FE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7DF96DD-4046-425E-895D-295E66741FE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7DF96DD-4046-425E-895D-295E66741FE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7DF96DD-4046-425E-895D-295E66741FE6}.Release|Any CPU.Build.0 = Release|Any CPU
{DFF10173-23A6-4E76-88AE-0E6900236607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DFF10173-23A6-4E76-88AE-0E6900236607}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFF10173-23A6-4E76-88AE-0E6900236607}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFF10173-23A6-4E76-88AE-0E6900236607}.Release|Any CPU.Build.0 = Release|Any CPU
{19CB6A33-941C-41BC-94A9-5E254F68A787}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19CB6A33-941C-41BC-94A9-5E254F68A787}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19CB6A33-941C-41BC-94A9-5E254F68A787}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19CB6A33-941C-41BC-94A9-5E254F68A787}.Release|Any CPU.Build.0 = Release|Any CPU
{7DB75589-C32C-42E7-B4B5-E140DB21082A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DB75589-C32C-42E7-B4B5-E140DB21082A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DB75589-C32C-42E7-B4B5-E140DB21082A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DB75589-C32C-42E7-B4B5-E140DB21082A}.Release|Any CPU.Build.0 = Release|Any CPU
{719956BA-2B70-404C-A8CB-F780623F4178}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{719956BA-2B70-404C-A8CB-F780623F4178}.Debug|Any CPU.Build.0 = Debug|Any CPU
{719956BA-2B70-404C-A8CB-F780623F4178}.Release|Any CPU.ActiveCfg = Release|Any CPU
{719956BA-2B70-404C-A8CB-F780623F4178}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{92BA62A2-B3F9-4897-874A-41C4FA78BF47} = {B3D9DF87-38B1-4397-A4F5-9F6C45063E1B}
{1EE36765-D6E8-452E-B4A2-DC7157EF16D2} = {B3D9DF87-38B1-4397-A4F5-9F6C45063E1B}
{C7DF96DD-4046-425E-895D-295E66741FE6} = {B3D9DF87-38B1-4397-A4F5-9F6C45063E1B}
{DFF10173-23A6-4E76-88AE-0E6900236607} = {2550698D-C602-4592-8DEF-C15AF6C6E46F}
{19CB6A33-941C-41BC-94A9-5E254F68A787} = {B3D9DF87-38B1-4397-A4F5-9F6C45063E1B}
{7DB75589-C32C-42E7-B4B5-E140DB21082A} = {B3D9DF87-38B1-4397-A4F5-9F6C45063E1B}
{CA4AC978-0A6F-4B86-B805-DFE2F6904DAF} = {2550698D-C602-4592-8DEF-C15AF6C6E46F}
{719956BA-2B70-404C-A8CB-F780623F4178} = {CA4AC978-0A6F-4B86-B805-DFE2F6904DAF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {44DC5620-2F91-4082-84BB-AA4895AD0037}
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ This repo provides easily management hook operations of for dotnet application.
***

### Getting Started
Install `IronHook.PostgreSql` from [Nuget Package](https://www.nuget.org/packages/IronHook.PostgreSql)
Install `IronHook.EntityFramework.PostgreSql` from [Nuget Package](https://www.nuget.org/packages/IronHook.PostgreSql)

Initalize `Startup` configuration.

```csharp
services.AddIronHook(options =>
{
options.UseNpgsql(Configuration.GetConnectionString("{YOUR_CONNECTION_STRING}"));
options.UseNpgsql(
Configuration.GetConnectionString("{YOUR_CONNECTION_STRING}"),
opts => opts.UseIronHookNpgsqlMigrations()
);
});
```

Expand All @@ -58,7 +61,7 @@ after
```csharp
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseIronHook();
app.MigrateIronHook();
// ...
}
```
Expand Down
1 change: 0 additions & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net5.0</TargetFrameworks>
<Version>1.0.0</Version>
<LangVersion>latest</LangVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand Down
5 changes: 2 additions & 3 deletions samples/IronHook.Web/Controllers/CustomersController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using IronHook.Core.Abstractions;
using IronHook.Core.Primitives;
using IronHook.PostgreSql.Context;
using IronHook.Web.Context;
using IronHook.Web.Dtos;
using IronHook.Web.Entities;
Expand All @@ -23,7 +22,7 @@ namespace IronHook.Web.Controllers
public class CustomersController : ControllerBase
{
private readonly SampleDbContext sampleDbContext;
private readonly IHookService<IronHookPostgreSqlDbContext> hookService;
private readonly IHookService hookService;

/// <summary>
/// Ctor
Expand All @@ -34,7 +33,7 @@ public class CustomersController : ControllerBase
/// <param name="hookService">
/// Hook Service
/// </param>
public CustomersController(SampleDbContext sampleDbContext, IHookService<IronHookPostgreSqlDbContext> hookService)
public CustomersController(SampleDbContext sampleDbContext, IHookService hookService)
{
this.sampleDbContext = sampleDbContext;
this.hookService = hookService;
Expand Down
5 changes: 2 additions & 3 deletions samples/IronHook.Web/Controllers/HookController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using IronHook.Core.Abstractions;
using IronHook.Core.Entities;
using IronHook.PostgreSql.Context;
using IronHook.Web.Dtos;
using Microsoft.AspNetCore.Mvc;
using System;
Expand All @@ -18,15 +17,15 @@ namespace IronHook.Web.Controllers
[Route("hooks")]
public class HookController : ControllerBase
{
private readonly IHookService<IronHookPostgreSqlDbContext> hookService;
private readonly IHookService hookService;

/// <summary>
/// Ctor
/// </summary>
/// <param name="hookService">
/// Hook Operation Service
/// </param>
public HookController(IHookService<IronHookPostgreSqlDbContext> hookService)
public HookController(IHookService hookService)
{
this.hookService = hookService;
}
Expand Down
6 changes: 3 additions & 3 deletions samples/IronHook.Web/IronHook.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\IronHook.PostgreSql\IronHook.PostgreSql.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.MarkdownDocumenting" Version="2.3.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.14" />
Expand All @@ -25,6 +22,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\IronHook.EntityFrameworkCore.PostgreSql\IronHook.EntityFrameworkCore.PostgreSql.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Docs\PostgreSql\Step3.md">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
9 changes: 2 additions & 7 deletions samples/IronHook.Web/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using IronHook.PostgreSql.Extensions;
using IronHook.Web.Context;
using MarkdownDocumenting.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace IronHook.Web
{
Expand All @@ -33,7 +28,7 @@ public void ConfigureServices(IServiceCollection services)

services.AddIronHook(options =>
{
options.UseNpgsql(Configuration.GetConnectionString("Default"));
options.UseNpgsql(Configuration.GetConnectionString("Default"), opts => opts.UseIronHookNpgsqlMigrations());
});

services.AddDbContext<SampleDbContext>(options =>
Expand Down Expand Up @@ -70,7 +65,7 @@ public void ConfigureServices(IServiceCollection services)
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseIronHook();
app.MigrateIronHook();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand Down
2 changes: 1 addition & 1 deletion samples/IronHook.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Default": "{YOUR_CONNECTION_STRING}"
"Default": "{YOUR_CONNECTIONSTRING_HERE}"
},
"DocumentationOptions": {
"HighlightJsStyle": "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.8/styles/zenburn.min.css",
Expand Down
Loading