Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting WCF ClientCredentials in MVC project using unity Dependency Injection Container
    primarykey
    data
    text
    <p>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..</p> <pre><code>container.RegisterType&lt;IOrderServiceClient, OrderServiceClientClient&gt;( new InjectionConstructor( new InjectionProperty("ClientCredentials.UserName.UserName", "test"), new InjectionProperty("ClientCredentials.UserName.Password", "password"))); </code></pre> <p>is something like this possible?</p> <p>EDIT:</p> <p>looking into the service reference the defination looks like this for the class:</p> <pre><code>class ProductMasterServiceClientClient : System.ServiceModel.ClientBase&lt;com.luzern.co40.web.pm.wsProductMasterService.IProductMasterServiceClient&gt;, com.luzern.co40.web.pm.wsProductMasterService.IProductMasterServiceClient </code></pre> <p>And the parent class ClientBase class contains the definition for the ClientCredential member.. </p> <p>I dont want to replace the Whole ClientCredential member, i just want to set the 2 propertys username and password on it!</p> <p>EDIT 2!!</p> <pre><code>[System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class OrderServiceClientClient : System.ServiceModel.ClientBase&lt;com.luzern.co40.web.pm.wsOrderService.IOrderServiceClient&gt;, 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&lt;bool&gt; GenerateInvoiceAsync(int orderId, string email) { return base.Channel.GenerateInvoiceAsync(orderId, email); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload