1
0
mirror of synced 2024-11-05 02:59:16 +00:00
Tapeti/Tapeti.Flow.SQL/ConfigExtensions.cs
Mark van Renswoude 74985e45de Fixed all ReSharper issues
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.
2018-12-19 20:50:56 +01:00

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;
}
}
}