c# - IOC and Silverlight -


In MVC asp.net, I can override a factory to create my controllers, and thus my IOC For just put a reference. By doing so, every interfaces required by the contractors of my controllers will be fed by the IOC.

Is there some normal way to use Silverlight? At the moment, I only found the use of ninject kernels everywhere:

  public partial class MyUserControlSL {public MyUserControlSL () {DataContext = New MyViewModel (kernel. Get & lt; IMyRepository & gt; ()) ; InitializeComponent (); For example using StructureMap and MVC:  
  Public class controllerfighter: Default controller factory {Safe override IController GetControllerInstance (RequestContext requestContext, type controller type) {IController Results = Zero; Try (if the controller type! = Zero) {Results = ObjectFactory.GetInstance (Controller type) as the controller;} Else {return base.GetControllerInstance (requestContext, Controller Type);}} Catch (Structured Mappress) {System.Diagnostics. Debug.WriteLine (ObjectFactory.WhatDoIHave ()); Throw;} Return result;}} Public acetylator (ISSPA service A) {if (Service A == blank) {Throw new exception ("ISCACA may not be blank"); } _ServiceA = Service A;} Public Service A (IRPository Repository) {If (Rip Excogitation == blank) {throw a new exception ("repository irposorory can not be empty");} _Repository = repository;}   

Thanks for your help, please ask if it is not clear

In Silverlight, you can use a bootstrapper on the Combination Route to wade your whole object graph This app can be class AP.XML CAS and

  public number Looks like the class App: Application {private void Anupryog_startap (object sender, Startapaventargs e) {bootstrapper bootstrapper = new bootstrapper (); Bootstrapper.Run (); Generally it should be enough, but if you need a separate factory class for your ideas, take a look.   

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -