我正在创建一个WCF服务来运行对数据库的查询。
class ServiceManager : IServiceManager
{
public IList<T> ExecuteDataReader<T>(ParametersEL parameters)
{
throw new NotImplementedException();
}
public int ExecuteNonQuery(ParametersEL parameters)
{
throw new NotImplementedException();
}
public object ExecuteScalar(ParametersEL parameters)
{
throw new NotImplementedException();
}
public bool Transaccion(List<string> querys, List<SqlParameterCollection> lstParams)
{
throw new NotImplementedException();
}
}
但是当你运行该服务时会产生这个错误。
System.Runtime.Serialization.InvalidDataContractException: The type 'System.Collections.Generic.IList`1 [T]' can not be exported as type of scheme, because it is an open generic type. You can only export a generic type if all parameters are generic types of real rates.
这是WCF接口
[ServiceContract]
interface IServiceManager
{
[OperationContract]
IList<T> ExecuteDataReader<T>(ParametersEL parameters);
[OperationContract]
int ExecuteNonQuery(ParametersEL parameters);
[OperationContract]
object ExecuteScalar(ParametersEL parameters);
[OperationContract]
Boolean Transaccion(List<String> querys, List<SqlParameterCollection> lstParams);
}
请有人告诉我为什么会出现此错误以及如何更正或通过WCF传递此通用列表的某些解决方案。这个想法是任何实体使用此OperationContract
的通用