Mark van Renswoude
74985e45de
Some are silly, like the "member not used" for public interfaces. The comments everywhere are ugly, sorry, but it keeps the possibly important issues visible without a dependency on some ReSharper annotations package.
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using Tapeti.Config;
|
|
|
|
// ReSharper disable UnusedMember.Global
|
|
|
|
namespace Tapeti.Flow.SQL
|
|
{
|
|
public static class ConfigExtensions
|
|
{
|
|
public static TapetiConfig WithFlowSqlRepository(this TapetiConfig config, string connectionString, int serviceId, string schema = "dbo")
|
|
{
|
|
config.Use(new FlowSqlRepositoryBundle(connectionString, serviceId, schema));
|
|
return config;
|
|
}
|
|
}
|
|
|
|
|
|
internal class FlowSqlRepositoryBundle : ITapetiExtension
|
|
{
|
|
private readonly string connectionString;
|
|
private readonly string schema;
|
|
private readonly int serviceId;
|
|
|
|
|
|
public FlowSqlRepositoryBundle(string connectionString, int serviceId, string schema)
|
|
{
|
|
this.connectionString = connectionString;
|
|
this.serviceId = serviceId;
|
|
this.schema = schema;
|
|
}
|
|
|
|
|
|
public void RegisterDefaults(IDependencyContainer container)
|
|
{
|
|
container.RegisterDefault<IFlowRepository>(() => new SqlConnectionFlowRepository(connectionString, serviceId, schema));
|
|
}
|
|
|
|
|
|
public IEnumerable<object> GetMiddleware(IDependencyResolver dependencyResolver)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|