C# 如何以编程方式添加合同属性?
我有一个纯界面,如下所示C# 如何以编程方式添加合同属性?,c#,wcf,C#,Wcf,我有一个纯界面,如下所示 public interface IPure { Array GetEmployee(int employeeId); DataSet GetAllProducts(); List<string> GetAllSubCategoryNames(); double AverageSubTotalFromHeaders(); } 公共接口IPure { 数组GetEmployee(int employeeId); 数据集GetAllProduc
public interface IPure
{
Array GetEmployee(int employeeId);
DataSet GetAllProducts();
List<string> GetAllSubCategoryNames();
double AverageSubTotalFromHeaders();
}
公共接口IPure
{
数组GetEmployee(int employeeId);
数据集GetAllProducts();
列出GetAllSubcategory名称();
double Average SubtotalfromHeaders();
}
如何在运行时以编程方式将合同属性添加到界面中?您不能。属性是声明性的,而不是命令性的
配置服务主机时,您可以在运行时影响它,但这只是将信息从配置文件移动到代码中。也许可以帮助您。这让我成了坏人:(我只能这样做。[ServiceContract]公共接口IWCF接口:我说过要配置它,我该如何配置?具体配置什么?你不能在运行时配置服务接口或数据契约,那么就不要使用你现有的接口。通过一个外观来解耦。我实际上是这么说的。我的接口依赖于wcf的契约属性。