COA.EnterpriseServices/COA.EnterpriseServices.DataAccess/Dependencies.cs

35 lines
975 B
C#
Raw Normal View History

using AutoMapper;
using COA.EnterpriseServices.DataAccess.Helpers;
2020-10-14 21:57:39 +00:00
using StructureMap;
2020-10-14 12:35:14 +00:00
namespace COA.EnterpriseServices.DataAccess
{
public static class Dependencies
{
public static IContainer Container { get; }
static Dependencies()
{
Container = new Container(c =>
{
c.Scan(s =>
{
s.AddAllTypesOf(typeof(IDataAccess<>));
2020-10-14 21:25:05 +00:00
s.AddAllTypesOf(typeof(DataAccessManager<>));
2020-10-14 12:35:14 +00:00
s.WithDefaultConventions();
s.AssembliesFromApplicationBaseDirectory();
});
2020-10-14 21:57:39 +00:00
c.For(typeof(IDataAccess<>)).Singleton();
c.For(typeof(DataAccessManager<>)).Singleton();
c.For<IMapper>().Singleton().Use(() => Mapping.GetMapper());
2020-10-14 21:57:39 +00:00
c.For<ClientHelper>().Singleton();
c.For<CreditorHelper>().Singleton();
2020-10-14 12:35:14 +00:00
});
}
}
}