You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
860 B
C#

7 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using Autofac.Builder;
using Autofac.Core;
using Autofac.Extras;
using Autofac.Features;
using Autofac.Util;
using OAuth2Study.Model;
using OAuth2Study.IDal;
using OAuth2Study.Dal.MsSql;
using OAuth2Study.IBll;
using OAuth2Study.Bll;
namespace OAuth2Study.UnitTest
{
public class AutoFacManager
{
public IContainer Container { get; set; }
public AutoFacManager()
{
var builder = new ContainerBuilder();
builder.RegisterType<UserDal>().As<UserIDal>();
builder.RegisterType<UserBll>().As<UserIBll>();
Container = builder.Build();
}
public T GetService<T>()
{
return Container.Resolve<T>();
}
}
}