From 31bfec18a3d41959a24d0e79772dc0e03532fcf2 Mon Sep 17 00:00:00 2001 From: Maicon Heck <13810070+maiconheck@users.noreply.github.com> Date: Fri, 18 Dec 2020 11:18:36 +0000 Subject: [PATCH] :recycled: Krafted.EntityFrameworkCore deleted --- .../DesignTimeDbContextFactory.cs | 75 ------------------- .../Krafted.EntityFrameworkCore.csproj | 45 ----------- src/Krafted/Krafted.sln | 14 ---- src/Krafted/Krafted/Krafted.csproj | 33 -------- 4 files changed, 167 deletions(-) delete mode 100644 src/Krafted/Krafted.EntityFrameworkCore/DesignTimeDbContextFactory.cs delete mode 100644 src/Krafted/Krafted.EntityFrameworkCore/Krafted.EntityFrameworkCore.csproj delete mode 100644 src/Krafted/Krafted/Krafted.csproj diff --git a/src/Krafted/Krafted.EntityFrameworkCore/DesignTimeDbContextFactory.cs b/src/Krafted/Krafted.EntityFrameworkCore/DesignTimeDbContextFactory.cs deleted file mode 100644 index 8487100..0000000 --- a/src/Krafted/Krafted.EntityFrameworkCore/DesignTimeDbContextFactory.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.IO; -using Krafted.Guards; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; -using Microsoft.Extensions.Configuration; - -namespace Krafted.EntityFrameworkCore -{ - /// - /// A factory to creating derived Microsoft.EntityFrameworkCore.DbContext instances. - /// See Design-time DbContext Creation. - /// See IDesignTimeDbContextFactory{TContext} Interface. - /// - /// - /// The type of the DbContext. - public abstract class DesignTimeDbContextFactory : IDesignTimeDbContextFactory where TContext : DbContext - { - private readonly string _connectionStringName; - - /// - /// Initializes a new instance of the class. - /// - /// Name of the connection string. - protected DesignTimeDbContextFactory(string connectionStringName) - { - Guard.Against.NullOrWhiteSpace(connectionStringName, nameof(connectionStringName)); - _connectionStringName = connectionStringName; - } - - /// - /// Gets the options to be used by a Microsoft.EntityFrameworkCore.DbContext. - /// - /// - /// The options to be used by a Microsoft.EntityFrameworkCore.DbContext. - /// - protected DbContextOptions Options - { - get - { - var optionsBuilder = new DbContextOptionsBuilder(); - optionsBuilder.UseSqlServer(GetConnectionString()); - - return optionsBuilder.Options; - } - } - - /// - /// Creates a new instance of a derived context. - /// - /// Arguments provided by the design-time service. - /// - /// An instance of . - /// - public abstract TContext CreateDbContext(string[] args); - - private string GetConnectionString() - { - string basePath = Directory.GetCurrentDirectory(); - string environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - - var builder = new ConfigurationBuilder() - .SetBasePath(basePath) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true) - .AddEnvironmentVariables() - .Build(); - - var connectionString = builder.GetConnectionString(_connectionStringName); - Guard.Against.NullOrWhiteSpace(connectionString, nameof(connectionString)); - - return connectionString; - } - } -} diff --git a/src/Krafted/Krafted.EntityFrameworkCore/Krafted.EntityFrameworkCore.csproj b/src/Krafted/Krafted.EntityFrameworkCore/Krafted.EntityFrameworkCore.csproj deleted file mode 100644 index 3643bb6..0000000 --- a/src/Krafted/Krafted.EntityFrameworkCore/Krafted.EntityFrameworkCore.csproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - netstandard2.1 - true - Some common boilerplate classes used in EF Core projects like the IDesignTimeDbContextFactory implementation. - Some common boilerplate classes used in EF Core projects like the IDesignTimeDbContextFactory implementation. - - - - true - ..\Analyzers\All.ruleset - AllEnabledByDefault - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - runtime; build; native; contentfiles; analyzers - all - - - - runtime; build; native; contentfiles; analyzers - all - - - - - - - - diff --git a/src/Krafted/Krafted.sln b/src/Krafted/Krafted.sln index 8f51e65..dcc2c0c 100644 --- a/src/Krafted/Krafted.sln +++ b/src/Krafted/Krafted.sln @@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Krafted.Net", "Krafted.Net\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Krafted.ValueObjects", "Krafted.ValueObjects\Krafted.ValueObjects.csproj", "{4370F87A-DE90-4550-AD68-802DA71E0BE0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Krafted.EntityFrameworkCore", "Krafted.EntityFrameworkCore\Krafted.EntityFrameworkCore.csproj", "{2E69EA7D-BA61-4B7D-ACD4-12B89553E336}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Krafted.DataAnnotations", "Krafted.DataAnnotations\Krafted.DataAnnotations.csproj", "{EC2B19EB-86AF-4F75-96EC-B19600159362}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Krafted.Extensions", "Krafted.Extensions\Krafted.Extensions.csproj", "{F8B9C561-2D64-4E2A-9185-85C517729D57}" @@ -107,18 +105,6 @@ Global {4370F87A-DE90-4550-AD68-802DA71E0BE0}.Release|x64.Build.0 = Release|Any CPU {4370F87A-DE90-4550-AD68-802DA71E0BE0}.Release|x86.ActiveCfg = Release|Any CPU {4370F87A-DE90-4550-AD68-802DA71E0BE0}.Release|x86.Build.0 = Release|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Debug|x64.ActiveCfg = Debug|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Debug|x64.Build.0 = Debug|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Debug|x86.Build.0 = Debug|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Release|Any CPU.Build.0 = Release|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Release|x64.ActiveCfg = Release|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Release|x64.Build.0 = Release|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Release|x86.ActiveCfg = Release|Any CPU - {2E69EA7D-BA61-4B7D-ACD4-12B89553E336}.Release|x86.Build.0 = Release|Any CPU {EC2B19EB-86AF-4F75-96EC-B19600159362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EC2B19EB-86AF-4F75-96EC-B19600159362}.Debug|Any CPU.Build.0 = Debug|Any CPU {EC2B19EB-86AF-4F75-96EC-B19600159362}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/src/Krafted/Krafted/Krafted.csproj b/src/Krafted/Krafted/Krafted.csproj deleted file mode 100644 index 7cccb60..0000000 --- a/src/Krafted/Krafted/Krafted.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - - netstandard2.0 - true - The Krafted's core library, containing a set of classes for the most common uses, like Guard Clauses, DataAnnotations and Extension Methods. - The Krafted's core library, containing a set of classes for the most common uses, like Guard Clauses, DataAnnotations and Extension Methods. - - - - true - ..\Analyzers\All.ruleset - AllEnabledByDefault - - - - - - - - - runtime; build; native; contentfiles; analyzers - all - - - - runtime; build; native; contentfiles; analyzers - all - - - -