如何在WCF C#中获取对集合的引用?
我在一个解决方案中有两个WCF服务:如何在WCF C#中获取对集合的引用?,c#,wcf,C#,Wcf,我在一个解决方案中有两个WCF服务: Wcf.BLL Wcf.model 我有一个额外的类注册列表正在使用Wcf.model,代码如下: namespace Wcf.model { class RegistrationList { [Required] public string Login { get; set; } [Required] publ
- Wcf.BLL
- Wcf.model
注册列表
正在使用Wcf.model
,代码如下:
namespace Wcf.model
{
class RegistrationList
{
[Required]
public string Login { get; set; }
[Required]
public string Password { get; set; }
}
}
如何从第一个服务的Wcf.BLL
的ServiceContract
访问RegistrationList
,以设置类型为RegistrationList
的参数
[ServiceContract]
public interface IWcf.BLL
{
[OperationContract]
string Register(RegistrationList Login); // Here I can set type as `RegistrationList`
}
您没有为
注册列表
类指定任何访问修饰符。默认值为internal
,因此它仅在Wcf.model
assembly中可用
如果要在另一个程序集中使用注册列表
,请将其设置为公共
public class RegistrationList
{
//...
}
你能试着提高你问题的质量吗?你想做什么和不想做什么都不太清楚。有问题的地方做了一些修改,希望更清楚。你已经在Wcf.BLL中添加了对Wcf.Model的项目引用了吗?是的,但是在
Wcf.Model
中我有单独的类(文件)注册列表
如果您想将其保留为内部,也可以添加InternalsVisibleTo。这对我没有帮助。我没有在Wcf.model
中看到classRegistrationList
方法,但我确实请求在Wcf服务中分离class,可能是因为这个原因吗?@Ahmed确保您在Wcf.BLL
中添加了对Wcf.model
项目的引用