当前位置: 首页>>代码示例>>C#>>正文


C# IKernel.Scan方法代码示例

本文整理汇总了C#中IKernel.Scan方法的典型用法代码示例。如果您正苦于以下问题:C# IKernel.Scan方法的具体用法?C# IKernel.Scan怎么用?C# IKernel.Scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IKernel的用法示例。


在下文中一共展示了IKernel.Scan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterServices

 /// <summary>
 /// Load your modules or register your services here!
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     kernel.Scan(x =>
      {
          x.FromAssembliesMatching("*");
          x.BindWith(new DefaultBindingGenerator());
      });
 }
开发者ID:saitodisse,项目名称:EmeTools,代码行数:12,代码来源:NinjectMVC3.cs

示例2: RegisterServices

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            var scanner = new AssemblyScanner();
            scanner.FromCallingAssembly();
            scanner.BindWith<DefaultBindingGenerator>();
            kernel.Scan(scanner);

            ProPartners.Loan.Service.Infrastructure.AppStart.RegisterAssemblies(kernel);
        }
开发者ID:JasonMore,项目名称:FamilyFeud,代码行数:13,代码来源:NinjectMVC3.cs

示例3: RegisterServices

 /// <summary>
 /// Load your modules or register your services here!
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     kernel.Scan(scanner =>
                     {
                         scanner.FromAssembliesMatching("Candidate.*");
                         scanner.AutoLoadModules();
                         scanner.BindWithDefaultConventions();
                     }
         );
 }
开发者ID:haos11,项目名称:candidate,代码行数:14,代码来源:NinjectMVC3.cs

示例4: RegisterServices

 /// <summary>
 /// Load your modules or register your services here!
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     kernel.Scan(a =>
     {
         a.FromCallingAssembly();
         a.FromAssembliesMatching("GiveCRM.*.dll");
         a.AutoLoadModules();
         a.BindWithDefaultConventions();
     });           
 }        
开发者ID:markrendle,项目名称:GiveCRM.Admin,代码行数:14,代码来源:NinjectMVC3.cs

示例5: ProjectFactory

 static ProjectFactory()
 {
     _kernel = new StandardKernel();
      _kernel.Scan(x =>
      {
     x.FromCallingAssembly();
     x.WhereTypeInheritsFrom(typeof(IProblem));
     x.BindWith( new InterfaceBindingGenerator( typeof( IProblem ) ) );
      });
 }
开发者ID:rprouse,项目名称:ProjectEuler,代码行数:10,代码来源:ProjectFactory.cs

示例6: RegisterServices

 /// <summary>
 /// Load your modules or register your services here!
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     kernel.Scan(
         x =>
         {
             x.FromAssembliesMatching(new[] { "MvcFramework.*.dll", "Infrastructure.*.dll" });
             x.BindWithDefaultConventions();
             x.InTransientScope();
         });
 }
开发者ID:StuartLeitch,项目名称:MvcFrameworkTest,代码行数:14,代码来源:NinjectMVC3.cs

示例7: RegisterAssemblies

        public static void RegisterAssemblies(IKernel kernel)
        {
            //there are better ways to getting the namespace of the mappers, but this is the most straightforward in the POC
            const string mapperNamespace = "IMapperPOC.Service.Mappers";

            var scanner = new AssemblyScanner();
            scanner.WhereTypeIsNotInNamespace(mapperNamespace);
            scanner.FromCallingAssembly();
            scanner.BindWith<DefaultBindingGenerator>();
            kernel.Scan(scanner);

            var mapScanner = new AssemblyScanner();
            mapScanner.FromCallingAssembly();
            mapScanner.WhereTypeIsInNamespace(mapperNamespace);
            mapScanner.BindWith<DefaultBindingGenerator>();

            //only create the mappers once since AutoMapper registration has a lot of overhead.
            mapScanner.InSingletonScope();
            kernel.Scan(mapScanner);
        }
开发者ID:JasonMore,项目名称:AutoMapper-Ioc-Example,代码行数:20,代码来源:AppStart.cs

示例8: ScanAssemblies

        public static IKernel ScanAssemblies(IKernel kernel)
        {
            var scanner = new AssemblyScanner();
            scanner.FromAssembliesMatching("Basketball.Service.dll"); // Services classes here
            scanner.FromAssembliesMatching("Basketball.Data.dll");  // Repositories here
            scanner.BindWithDefaultConventions();

            kernel.Scan(scanner);

            return kernel;
        }
开发者ID:philjhale,项目名称:TeessideBasketballLeague,代码行数:11,代码来源:TblNinjectKernel.cs

示例9: RegisterServices

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            kernel.Bind<SessionFactoryProvider>().ToSelf().InSingletonScope();
            kernel.Bind<SessionProvider>().ToSelf().InRequestScope();

            // Ninject.Extensions.Conventions
            kernel.Scan(x =>
            {
                x.FromAssembliesMatching("*");
                x.BindWith(new DefaultBindingGenerator());
            });
        }
开发者ID:saitodisse,项目名称:csMovies,代码行数:16,代码来源:NinjectMVC3.cs

示例10: RegisterServices

 /// <summary>
 /// Load your modules or register your services here!
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 private static void RegisterServices(IKernel kernel)
 {
     kernel.Scan(a =>
                     {
                         a.FromCallingAssembly();
                         a.FromAssembliesMatching("GiveCRM.*.dll");
                         a.BindWithDefaultConventions();
                         a.BindWith(new RegexBindingGenerator("(I)(?<name>.+)(Repository)"));
                         a.BindWith(new GenericBindingGenerator(typeof(IRepository<>)));
                         a.InRequestScope();
                     });
 }
开发者ID:AnthonySteele,项目名称:GiveCRM,代码行数:16,代码来源:NinjectMVC3.cs

示例11: RegisterServices

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            var scanner = new AssemblyScanner();
            scanner.FromCallingAssembly();

            //This will register all interfaces with concrete types based on convention
            //ex: IPersonService will register to PersonService
            scanner.BindWith<DefaultBindingGenerator>();
            kernel.Scan(scanner);

            IMapperPOC.Service.Infrustructure.AppStart.RegisterAssemblies(kernel);
        }
开发者ID:JasonMore,项目名称:AutoMapper-Ioc-Example,代码行数:16,代码来源:NinjectMVC3.cs

示例12: RegisterServices

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            kernel.Scan(a =>
                            {
                                a.FromCallingAssembly();
                                a.FromAssembliesMatching("GiveCRM.*.dll");
                                a.BindWithDefaultConventions();
                                a.InRequestScope();
                            });

            kernel.Bind<IMembershipService>().To<MembershipService>();
        }
开发者ID:robinminto,项目名称:GiveCRM,代码行数:16,代码来源:NinjectMVC3.cs

示例13: RegisterAssemblies

        public static void RegisterAssemblies(IKernel kernel)
        {
            if (kernel == null)
                throw new ArgumentException("can not be null", "kernel");

            kernel.Bind<ITimeTrackerSession>().To<TimeTrackerSession>().InRequestScope();
            kernel.Bind<ITimeTrackerReadOnlySession>().To<TimeTrackerReadOnlySession>().InRequestScope();

            var scanner = new AssemblyScanner();
            scanner.WhereTypeIsNotInNamespace("TimeTracker.Service.Storage.Context");
            scanner.WhereTypeIsNotInNamespace("TimeTracker.Service.Mappers");
            scanner.FromCallingAssembly();
            scanner.BindWith<DefaultBindingGenerator>();
            kernel.Scan(scanner);

            //set mappers to singleton
            var mapScanner = new AssemblyScanner();
            mapScanner.FromCallingAssembly();
            mapScanner.WhereTypeIsInNamespace("TimeTracker.Service.Mappers");
            mapScanner.BindWith<DefaultBindingGenerator>();
            mapScanner.InSingletonScope();
            kernel.Scan(mapScanner);
        }
开发者ID:JasonMore,项目名称:TimeTracker,代码行数:23,代码来源:AppStart.cs

示例14: RegisterServices

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>));
            kernel.Bind(typeof(IUnitOfWork)).To(typeof(UnitOfWork));

            kernel.Bind<DbContextAdapter>().ToSelf().InRequestScope();
            kernel.Bind<IObjectSetFactory>().ToMethod(x => x.Kernel.Get<DbContextAdapter>()).InRequestScope();
            kernel.Bind<IObjectContext>().ToMethod(x => x.Kernel.Get<DbContextAdapter>()).InRequestScope();

            kernel.Scan(scanner =>
                            {
                                scanner.From("MvcArch.IServices");
                                scanner.From("MvcArch.Services");
                                scanner.BindWithDefaultConventions();
                            }
                        );

            Type contextType = Type.GetType("MvcArch.Dal.Context, MvcArch.Dal");
            kernel.Bind(typeof(DbContext)).To(contextType);
        }
开发者ID:fmichellonet,项目名称:MVCArch,代码行数:24,代码来源:NinjectMVC3.cs

示例15: RegisterServices

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            kernel.Scan(scanner => {
                scanner.FromAssembliesMatching("RazorPad.*");
                scanner.BindWithDefaultConventions();
                scanner.Excluding<EntityFramework.Repository>();
            });

            kernel.Bind<Services.IRepository>()
                .To<EntityFramework.Repository>()
                .InRequestScope()
                .WithConstructorArgument("isSharedContext", false);

            kernel.Bind<EntityFramework.RazorPadContext>()
                .ToSelf()
                .InRequestScope();


            kernel.Bind<Authentication.Facebook.FacebookService>().ToSelf()
                .InSingletonScope()
                .WithPropertyValue("LocalEndpoint", x => x.Kernel.Get<UrlHelper>().ExternalAction("Authorize", "Facebook"));
        }        
开发者ID:RazorPad,项目名称:RazorPad.Website,代码行数:26,代码来源:NinjectMVC3.cs


注:本文中的IKernel.Scan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。