-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'LiveDevTeam:master' into master
- Loading branch information
Showing
34 changed files
with
483 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#!/bin/bash | ||
|
||
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=your@Password" -e "MSSQL_PID=sql" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest up | ||
|
||
# docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=your@Password" -e "MSSQL_PID=sql" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest up | ||
sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=your@Password" \ | ||
-p 1433:1433 --name sql1 -h sql1 \ | ||
-d \ | ||
mcr.microsoft.com/mssql/server:2017-latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Services/c-gen/O2NextGen.CertificateManagement.Api/Filters/ApiExceptionFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace O2NextGen.CertificateManagement.Web.Filters | ||
{ | ||
public class ApiExceptionFilter: IExceptionFilter | ||
|
||
{ | ||
public void OnException(ExceptionContext context) | ||
{ | ||
if (context.ExceptionHandled is DbUpdateConcurrencyException) | ||
{ | ||
context.Result = | ||
new ConflictObjectResult(new {Message = "Entity was updated, please refresh your copy."}); | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Services/c-gen/O2NextGen.CertificateManagement.Api/IoC/ServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using O2NextGen.CertificateManagement.Business.Services; | ||
using O2NextGen.CertificateManagement.Impl.Services; | ||
using O2NextGen.CertificateManagement.Web.Filters; | ||
|
||
namespace O2NextGen.CertificateManagement.Web.IoC | ||
{ | ||
public static class ServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddRequiredMvcComponents(this IServiceCollection services) | ||
{ | ||
services.AddTransient<ApiExceptionFilter>(); | ||
|
||
var mvcBuilder = services.AddMvcCore(options => | ||
{ | ||
options.Filters.Add<ApiExceptionFilter>(); | ||
} ); | ||
mvcBuilder.SetCompatibilityVersion(CompatibilityVersion.Version_2_2); | ||
mvcBuilder.AddJsonFormatters(); | ||
return services; | ||
} | ||
|
||
public static IServiceCollection AddBusiness(this IServiceCollection services) | ||
{ | ||
// services.AddSingleton<ICertificatesService, InMemoryCertificatesService>(); | ||
// Include DataLayer | ||
services.AddScoped<ICertificatesService, CertificatesService>(); | ||
//more business services... | ||
|
||
return services; | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Services/c-gen/O2NextGen.CertificateManagement.Api/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore; | ||
using Microsoft.AspNetCore.Hosting; | ||
|
||
namespace O2NextGen.CertificateManagement.Web | ||
{ | ||
public class Program | ||
{ | ||
public static async Task Main(string[] args) | ||
{ | ||
try | ||
{ | ||
var host = CreateWebHostBuilder(args).Build(); | ||
Console.WriteLine("################# Starting Application #################"); | ||
await host.EnsureDbUpdate(); | ||
await host.RunAsync(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e); | ||
throw; | ||
} | ||
|
||
} | ||
|
||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => | ||
WebHost.CreateDefaultBuilder(args) | ||
.UseStartup<Startup>(); | ||
} | ||
} |
File renamed without changes.
10 changes: 7 additions & 3 deletions
10
...tGen.CertificateManagement.Web/Startup.cs → ...tGen.CertificateManagement.Api/Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Services/c-gen/O2NextGen.CertificateManagement.Api/StartupHelpers/DatabaseExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using O2NextGen.CertificateManagement.Data; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Microsoft.AspNetCore.Hosting | ||
{ | ||
internal static class DatabaseExtensions | ||
{ | ||
internal static async Task EnsureDbUpdate(this IWebHost host) | ||
{ | ||
using (var scope = host.Services.CreateScope()) | ||
{ | ||
var context = scope.ServiceProvider.GetRequiredService<CertificateManagementDbContext>(); | ||
await context.Database.MigrateAsync(); | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Services/c-gen/O2NextGen.CertificateManagement.Data/CertificateManagementDbContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using O2NextGen.CertificateManagement.Data.Entities; | ||
|
||
namespace O2NextGen.CertificateManagement.Data | ||
{ | ||
public class CertificateManagementDbContext : DbContext | ||
{ | ||
|
||
#region Fields | ||
|
||
public DbSet<CertificateEntity> Certificates { get; set; } | ||
|
||
#endregion | ||
|
||
#region Ctors | ||
|
||
public CertificateManagementDbContext(DbContextOptions<CertificateManagementDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
#endregion | ||
|
||
#region Configure | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.Entity<CertificateEntity>(ConfigureCertificateEntity); | ||
} | ||
|
||
private void ConfigureCertificateEntity(EntityTypeBuilder<CertificateEntity> builder) | ||
{ | ||
builder.ToTable("Certificate"); | ||
|
||
builder.Property(ci => ci.Id) | ||
.HasColumnType("bigint") | ||
.ForSqlServerUseSequenceHiLo("certificate_hilo") | ||
.IsRequired(); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CertificateEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace O2NextGen.CertificateManagement.Data.Entities | ||
{ | ||
public class CertificateEntity | ||
{ | ||
public long Id { get; set; } | ||
public string Name { get; set; } | ||
} | ||
} |
Oops, something went wrong.