diff --git a/Orion.Api/Orion.Api.csproj b/Orion.Api/Orion.Api.csproj
index a3a0128..2a04fef 100644
--- a/Orion.Api/Orion.Api.csproj
+++ b/Orion.Api/Orion.Api.csproj
@@ -8,28 +8,32 @@
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
+
+
-
+
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/Orion.Data/Context/DataContext.cs b/Orion.Data/Context/DataContext.cs
index b1e84de..7c7ec1f 100644
--- a/Orion.Data/Context/DataContext.cs
+++ b/Orion.Data/Context/DataContext.cs
@@ -1,10 +1,10 @@
using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Linq;
using System.Threading.Tasks;
using Orion.Data.Mapping;
using Orion.Entities.Domain;
+using Microsoft.Extensions.Configuration;
namespace Orion.Data.Context
{
@@ -12,10 +12,11 @@ public class DataContext : DbContext
{
public ModelBuilder ModelBuilder { get; private set; }
- public DataContext() : base(GetDefaultOptions())
+ public DataContext(IConfiguration configuration) : base(GetDefaultOptions(configuration))
{
}
+
public DataContext(DbContextOptions options) : base(options)
{
@@ -27,9 +28,9 @@ public DataContext(DbContextOptions options) : base(options)
public DbSet RefreshTokens { get; set; }
#endregion
- private static DbContextOptions GetDefaultOptions()
+ private static DbContextOptions GetDefaultOptions(IConfiguration configuration)
{
- var connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=Orion;Integrated Security=True;MultipleActiveResultSets=True;";
+ var connectionString = configuration.GetSection("DatabaseOptions:ConnectionString").Value;
return SqlServerDbContextOptionsExtensions.UseSqlServer(new DbContextOptionsBuilder(), connectionString).Options;
}
@@ -40,7 +41,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.ApplyConfiguration(new UserMapping());
modelBuilder.ApplyConfiguration(new RefreshTokenMapping());
- foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
+ foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
modelBuilder.Entity(entityType.ClrType).ToTable(entityType.ClrType.Name);
}
diff --git a/Orion.Data/Orion.Data.csproj b/Orion.Data/Orion.Data.csproj
index 0b5ce2d..388adb8 100644
--- a/Orion.Data/Orion.Data.csproj
+++ b/Orion.Data/Orion.Data.csproj
@@ -11,9 +11,9 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Orion.Resources/Orion.Resources.csproj b/Orion.Resources/Orion.Resources.csproj
index 7db0706..36a9818 100644
--- a/Orion.Resources/Orion.Resources.csproj
+++ b/Orion.Resources/Orion.Resources.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/Orion.Test/Orion.Test.csproj b/Orion.Test/Orion.Test.csproj
index 8147da7..1057957 100644
--- a/Orion.Test/Orion.Test.csproj
+++ b/Orion.Test/Orion.Test.csproj
@@ -12,22 +12,22 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/README.md b/README.md
index 4c510be..b678590 100644
--- a/README.md
+++ b/README.md
@@ -54,3 +54,7 @@ The main objective is to start projects with a clean and simple architecture, wi
**Todo**
1. API Test.
+
+**Run database migrations**
+
+ dotnet ef database update -p Orion.Data -s Orion.Api --verbose
\ No newline at end of file