tags:

views:

58

answers:

2

i have pure an interface like below

public interface IPure
{
  Array GetEmployee(int employeeId);
  DataSet GetAllProducts();
  List<string> GetAllSubCategoryNames();
  double AverageSubTotalFromHeaders();
}

How can i add contract attributes programaticly my interface at runtime?

+4  A: 

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.

blowdart
it made me bad man :( i can only do this. [ServiceContract] public interface IWCFinterface : IPure
tobias
you said configure it,how i can configure?
tobias
Configure what exactly? You can't configure the service interface or data contracts at runtime
blowdart
Then don't use your existing interfaces. Do it via a façade to decouple.
blowdart
i actualy said this.my interfaces make dependency to the wcf's contract attributes.
tobias
A: 

Maybe TypeDescriptor.AddAttributes could help you.

Fernando
Not for WCF it won't
Marc Gravell