0
我的控制器直接使用服务而不是存储库。这些服务被放置在ApplicationServices项目中:s#arp架构查询 - 服务和存储库
public XYZService
(
IBlaRepository BlaRepository,
IBla1Repository Bla1Repository
)
{
Check.Require(BlaRepository != null, "BlaRepository may not be null");
this.BlaRepository = BlaRepository;
....
这工作正常。
该库是这样实现的:
public interface IBlaRepository : IRepository<Bla> (placed in Core/DataInterfaces)
public class BlaRepository : Repository<Bla>, IBlaRepository (placed in Data)
有时候,我可以只使用“纯”犀利架构库。有没有办法让他们进入上述服务?我需要在某处注册吗?
为了澄清这一点 - 服务的构造器看起来是这样的:
public XYZService
(
Repository<UUU> UUURepository
...
希望这是有道理的。
谢谢!
克里斯
嗯,我认为这是通过ComponentRegistrar.AddComponentsTo小号#ARP,但这container.AddComponentLifeStyle自动完成( “repositoryWithTypedId” 的typeof(IRepositoryWithTypedId <,>)的typeof(RepositoryWithTypedId <,>),LifestyleType.PerWebRequest );它在最新的S#arp版本中被删除了吗? – queen3 2010-07-12 15:16:55
谢谢。如果我按照所描述的那样实现接口,那么“自动”就可以工作 - 我正在用'普通的s#arp代表'来锻炼一下。 – cs0815 2010-07-12 15:30:39