I was wondering whether you thought this or something similiar would be possible with unity? I want to inject the username and password credentials for the the WCF Service reference OrderServiceClientClient() i am using in my curent project..
container.RegisterType<IOrderServiceClient, OrderServiceClientClient>(
new InjectionConstructor(
new InjectionProperty("ClientCredentials.UserName.UserName", "test"),
new InjectionProperty("ClientCredentials.UserName.Password", "password")));
is something like this possible?
EDIT:
looking into the service reference the defination looks like this for the class:
class ProductMasterServiceClientClient : System.ServiceModel.ClientBase<com.luzern.co40.web.pm.wsProductMasterService.IProductMasterServiceClient>, com.luzern.co40.web.pm.wsProductMasterService.IProductMasterServiceClient
And the parent class ClientBase class contains the definition for the ClientCredential member..
I dont want to replace the Whole ClientCredential member, i just want to set the 2 propertys username and password on it!
EDIT 2!!
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class OrderServiceClientClient : System.ServiceModel.ClientBase<com.luzern.co40.web.pm.wsOrderService.IOrderServiceClient>, com.luzern.co40.web.pm.wsOrderService.IOrderServiceClient {
public OrderServiceClientClient() {
}
public OrderServiceClientClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public OrderServiceClientClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public OrderServiceClientClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public OrderServiceClientClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public bool GenerateInvoice(int orderId, string email) {
return base.Channel.GenerateInvoice(orderId, email);
}
public System.Threading.Tasks.Task<bool> GenerateInvoiceAsync(int orderId, string email) {
return base.Channel.GenerateInvoiceAsync(orderId, email);
}
}