コード例 #1
0
        public static void Init(ContainerBuilder builder)
        {
            builder.RegisterInstance(new at_botEntities());
            builder.RegisterType <DataService>();
            builder.RegisterType <MainService>();
            builder.RegisterType <FacebookService>();

            builder.RegisterAssemblyTypes(typeof(StartCommandHandler).Assembly)
            .Where(t => t.IsAssignableTo <BaseCommandHandler>())
            .As <BaseCommandHandler>();

            builder.Register(context =>
            {
                var commandHandlerList = new CommandHandlerList();
                var handlers           = context.Resolve <IEnumerable <BaseCommandHandler> >();
                foreach (var handler in handlers)
                {
                    commandHandlerList.Add(handler);
                }
                return(commandHandlerList);
            }).SingleInstance();

            builder.RegisterType <RootDialog>().InstancePerRequest();
            builder.RegisterType <BotJob>();
        }
コード例 #2
0
ファイル: RootDialog.cs プロジェクト: angels2it/bot.ait.codes
 public RootDialog(CommandHandlerList handlerList)
 {
     _handlerList = handlerList;
 }