【发布时间】:2010-09-27 18:22:26
【问题描述】:
当我在我的解决方案中新建一个 WCF 服务时,我可以执行以下操作,有一个带参数的构造函数要传入吗?如果是,运行时如何、何时以及在何处填充我所需的 IBusinessLogic 对象?
[ServiceContract]
public interface IServiceContract
{
[OperationContract]
...
}
public class MyService : IServiceContract
{
IBusinessLogic _businessLogic;
public ServiceLayer(IBusinessLogic businessLogic)
{
_businessLogic = businessLogic;
}
...
}
【问题讨论】:
-
@MarkSeemann - 在下面查看我的答案。
标签: wcf dependency-injection constructor