Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在服务堆栈中的项目之间共享服务?_C#_.net_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">servicestack - Fatal编程技术网 servicestack,C#,.net,servicestack" /> servicestack,C#,.net,servicestack" />

C# 如何在服务堆栈中的项目之间共享服务?

C# 如何在服务堆栈中的项目之间共享服务?,c#,.net,servicestack,C#,.net,servicestack,在服务堆栈项目之间共享服务的最佳方式是什么 我目前的做法是继承所需的服务。例如: // Grabbing a service from another project public class ServiceA : AnotherNamespace.InAnotherAssembly.ServiceC { } // Grabbing a service from another project public class ServiceB : AnotherNamespace.InAnother

在服务堆栈项目之间共享服务的最佳方式是什么

我目前的做法是继承所需的服务。例如:

// Grabbing a service from another project
public class ServiceA : AnotherNamespace.InAnotherAssembly.ServiceC
{
}

// Grabbing a service from another project
public class ServiceB : AnotherNamespace.InAnotherAssembly.ServiceD
{
}

// Business as usual
public class ServiceX : RestServiceBase<RequestPocoX>
{
    ....
}

// Business as usual
public class ServiceY : RestServiceBase<RequestPocoY>
{
    ....
}  
这是一个合理的方法,还是有更好的选择

我之所以提出这个问题,是因为我在尝试解决“已服务”中的服务时遇到了一个问题。我想这可能是因为国际奥委会找不到它


我希望这很清楚。

您应该能够将多个程序集传递给构造函数:

public AppHost()
    : base("Combined Services", 
        typeof(ServiceX).Assembly, 
        typeof(ServiceD).Assembly)
{
}

这是SS最近增加的吗?我不记得过去能够做到这一点。@JeffMitchell该签名已经有
params Assembly[]
多年了。
public AppHost()
    : base("Combined Services", 
        typeof(ServiceX).Assembly, 
        typeof(ServiceD).Assembly)
{
}