28 lines
884 B
C#
28 lines
884 B
C#
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();
|
|
}
|
|
}
|
|
}
|