-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
63 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
using Autofac; | ||
using NetScape.Abstractions.FileSystem; | ||
using NetScape.Abstractions.Model.Game; | ||
|
||
namespace NetScape.Modules.DAL | ||
{ | ||
public class DALModule : Module | ||
public class DALModule<TPlayer> : Module where TPlayer : Player, new() | ||
{ | ||
protected override void Load(ContainerBuilder builder) | ||
{ | ||
builder.RegisterType<EntityFrameworkPlayerRepository>().As<IPlayerRepository>(); | ||
builder.RegisterType<EntityFrameworkPlayerRepository<TPlayer>>().As<IPlayerRepository>(); | ||
} | ||
} | ||
} |
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
3 changes: 2 additions & 1 deletion
3
NetScape.Modules.DAL/Migrations/20201226151013_AddInitial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
NetScape.Modules.DAL/Migrations/20210123212503_RemoveAppearanceFields.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,21 +1,22 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Design; | ||
using Microsoft.Extensions.Configuration; | ||
using NetScape.Abstractions.Model.Game; | ||
using NetScape.Core; | ||
using NetScape.Modules.DAL; | ||
|
||
namespace NetScape | ||
{ | ||
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<DatabaseContext> | ||
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<DatabaseContext<Player>> | ||
{ | ||
public DatabaseContext CreateDbContext(string[] args) | ||
public DatabaseContext<Player> CreateDbContext(string[] args) | ||
{ | ||
var configRoot = ServerHandler.CreateConfigurationRoot("appsettings.json"); | ||
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>(); | ||
var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext<Player>>(); | ||
optionsBuilder.UseNpgsql(configRoot.GetConnectionString("NetScape"), | ||
x => x.MigrationsAssembly(typeof(DatabaseContext) | ||
x => x.MigrationsAssembly(typeof(DatabaseContext<Player>) | ||
.Assembly.GetName().Name)); | ||
return new DatabaseContext(optionsBuilder.Options); | ||
return new DatabaseContext<Player>(optionsBuilder.Options); | ||
} | ||
} | ||
} |
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