コード例 #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            MvcDependencyResolver.ForRepositoriesUseSharpRepository("repository.json", "sharpRepository", null, Lifecycles.Get <SingletonLifecycle>());
        }
コード例 #2
0
 public void SetLifecycleTo <T>() where T : ILifecycle, new()
 {
     _lifecycle = Lifecycles.Get <T>();
 }
コード例 #3
0
 /// <summary>
 /// Use InstanceScope for the constants now
 /// </summary>
 /// <typeparam name="T"></typeparam>
 public void SetScopeTo <T>() where T : ILifecycle, new()
 {
     _lifecycle = new Lazy <ILifecycle>(() => Lifecycles.Get <T>());
 }
コード例 #4
0
 public void getting_transient_gets_the_flyweight()
 {
     Lifecycles.Get <TransientLifecycle>().ShouldBeTheSameAs(Lifecycles.Transient);
 }
コード例 #5
0
 public void getting_unique_gets_the_flyweight()
 {
     Lifecycles.Get <UniquePerRequestLifecycle>().ShouldBeTheSameAs(Lifecycles.Unique);
 }
コード例 #6
0
 public void getting_singleton_gets_the_flyweight()
 {
     Lifecycles.Get <SingletonLifecycle>().ShouldBeTheSameAs(Lifecycles.Singleton);
 }