简体   繁体   English

如何在structuremap中基于最后一个接口注册具体的类

[英]How can I register concrete class based on last interface in structuremap

I have following interfaces and 我有以下界面和

public interface IHandleAService : IHandleDomainService
public interface IHandleBService : IHandleDomainService

public class AService : IHandleAService
public class BService : IHandleBService

How can I scan and register all these concrete classes based on IHandleDomainService interface in StructureMap. 如何在StructureMap中基于IHandleDomainService接口扫描和注册所有这些具体类。

This works for me: 这对我有用:

ObjectFactory.Initialize(c => c.Scan(scan =>
{
    scan.TheCallingAssembly();
    scan.AddAllTypesOf<IHandleDomainService>();
}));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将具体类注册到通用接口? - How to register Concrete Class to Generic Interface? 如何注册界面 <T> 与T是Structuremap中的接口 - How to register Interface<T> with T is an interface in Structuremap StructureMap:具体类构造函数接受相同接口类型的多个参数 - StructureMap: Concrete class constructor accepts multiple arguments of same interface type 如何使用StructureMap在Global.asax中注册IAuthenticationManager - How can I register IAuthenticationManager in Global.asax with StructureMap MVC3 &amp; StructureMap,基于 controller 注入混凝土 class - MVC3 & StructureMap, injecting concrete class based on the controller 如何使用StructureMap扫描和注册具有属性的类? - How I can scan and register classes with attributes using StructureMap? StructureMap:如何设置特定的接口具体实例以使用特定的CTOR - StructureMap : How to setup for Specific Concrete Instance of Interface to use particular CTOR 为什么我不能将此接口转换为具体的类? - Why can't I cast this interface to a concrete class? 我可以让StructureMap管理具体类型的生命周期吗? - Can I make StructureMap manage the lifecycle of a concrete type? 具体类如何隐藏它实现的接口的成员 - How can a concrete class hide a member of the interface that it implements
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM