-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Ali-YousefiTelori/develop
simple refactor
- Loading branch information
Showing
6 changed files
with
31 additions
and
24 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
22 changes: 8 additions & 14 deletions
22
src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.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 |
---|---|---|
@@ -1,27 +1,21 @@ | ||
using EasyMicroservices.ContentsMicroservice.Database; | ||
using EasyMicroservices.Cores.Relational.EntityFrameworkCore.Intrerfaces; | ||
using EasyMicroservices.Cores.Relational.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace EasyMicroservices.ContentsMicroservice | ||
{ | ||
public class DatabaseBuilder : IEntityFrameworkCoreDatabaseBuilder | ||
public class DatabaseBuilder : EntityFrameworkCoreDatabaseBuilder | ||
{ | ||
IConfiguration _configuration; | ||
public DatabaseBuilder(IConfiguration configuration) | ||
public DatabaseBuilder(IConfiguration configuration) : base(configuration) | ||
{ | ||
_configuration = configuration; | ||
} | ||
|
||
public void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
public override void OnConfiguring(DbContextOptionsBuilder optionsBuilder, string name) | ||
{ | ||
optionsBuilder.UseInMemoryDatabase("ContentDatabase"); | ||
//optionsBuilder.UseSqlServer(_configuration.GetConnectionString("local")); | ||
if (name == "SqlServer") | ||
optionsBuilder.UseSqlServer(Configuration.GetConnectionString("local")); | ||
else | ||
optionsBuilder.UseInMemoryDatabase("Contents"); | ||
} | ||
} | ||
} |
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