2020-10-15 13:34:25 +00:00
|
|
|
|
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
|
|
|
|
|
2020-10-15 01:38:25 +00:00
|
|
|
|
c.For(typeof(IDataAccess<>)).Singleton();
|
|
|
|
|
c.For(typeof(DataAccessManager<>)).Singleton();
|
|
|
|
|
|
2020-10-15 13:34:25 +00:00
|
|
|
|
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
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|