public static void ConfigureRezolver(IRezolver rezolver)
 {
     rezolver.RegisterType <RezolvingControllerActivator, IControllerActivator>();
     rezolver.RegisterObject("Hello rezolver!");
     rezolver.RegisterType <Rezolver.Examples.Mvc.Controllers.HomeController>();
     rezolver.RegisterExpression(c => new MessagesModel()
     {
         MainMessage = c.Resolve <string>(), OriginalRezolveName = c.Name
     });
 }
Esempio n. 2
0
 public override void RegisterArea(AreaRegistrationContext context, IRezolver rezolver)
 {
     if (rezolver != null)
     {
         rezolver.RegisterObject("hello area1 rezolver!", path: AreaName);
         rezolver.RegisterType <Controllers.HomeController>();
     }
     //can register
     context.MapRoute(
         "Area1_default",
         "Area1/{controller}/{action}/{id}",
         new { action = "Index", id = UrlParameter.Optional },
         new[] { typeof(Area1AreaRegistration).Namespace + ".Controllers" }
         );
 }
        public static IRezolver CreateAndConfigureRezolver()
        {
            //this is an initial idea for how to create and initialize your rezolver for the application.
            //Most applications probably don't need change it.
            IRezolver rezolver = null;

            LoggingCallTracker.Default.AddTargets(new DebugTraceLoggingTarget());
            //note that we're not passing a builder to these resolvers on creation - registrations
            //will be done directly into them.
#if DEBUG
            //this resolver logs nearly all calls to the debug output
            rezolver = new TrackedDefaultRezolver(LoggingCallTracker.Default);
#else
            rezolver = new DefaultRezolver();
#endif

            ConfigureRezolver(rezolver);

            return(rezolver);
        }
 public static IDependencyResolver CreateDependencyResolverInstance(IRezolver resolver)
 {
     //called by the RezolverConfig.Start method to get the IDependencyResolver to
     //set as MVCs default resolver.
     return(new RezolverDependencyResolver(resolver));
 }