How can i add contract attributes programaticly?
i have pure an interface like below
public interface IPure
{
Array GetEmployee(int employeeId);
DataSet GetAllProd开发者_开发百科ucts();
List<string> GetAllSubCategoryNames();
double AverageSubTotalFromHeaders();
}
How can i add contract attributes programaticly my interface at runtime?
You can't. Attributes are declarative, not imperative.
You can affect the service host at run time, when you configure it, but that's just moving the information from the configuration file to your code.
Maybe TypeDescriptor.AddAttributes could help you.
精彩评论