Broker implementation updated.
This commit is contained in:
27
code/MessengerBroker/Factories/BrokerDbContextFactory.cs
Normal file
27
code/MessengerBroker/Factories/BrokerDbContextFactory.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using MessengerApi.Configuration.Model.Persistence;
|
||||
using MessengerBroker.Configuration.Model;
|
||||
using MessengerBroker.Db;
|
||||
using MessengerBroker.Db.Sql;
|
||||
|
||||
namespace MessengerBroker.Factories
|
||||
{
|
||||
public class BrokerDbContextFactory
|
||||
{
|
||||
private readonly BrokerConfiguration configuration;
|
||||
|
||||
public BrokerDbContextFactory(BrokerConfiguration configuration)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
public BrokerDbContext CreateDbContext()
|
||||
{
|
||||
if(this.configuration.BrokerPersistenceConfiguration.PersistenceType == MessengerApi.Configuration.Enums.PersistenceTypes.Sql)
|
||||
{
|
||||
return new BrokerSqlDbContext((this.configuration.BrokerPersistenceConfiguration as SqlPersistenceConfiguration).ConnectionString);
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user