// This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddNewtonsoftJson();

            var loggerConnectionString = Configuration["StoreConnectionString"];
            var logger = new EntityFrameworkTranscriptStore(loggerConnectionString);

            services.AddSingleton <ITranscriptStore>(logger);

            //// Conversation State Storage
            IStorage conversationDataStore = new EntityFrameworkStorage(Configuration["StoreConnectionString"]);

            services.AddSingleton <ConversationState>(new ConversationState(conversationDataStore));

            //// User State Storage
            //IStorage userDataStore = new EntityFrameworkStorage(connectionString);
            //var userState = new UserState(userDataStore);

            // Create the Bot Framework Adapter with error handling enabled.
            services.AddSingleton <IBotFrameworkHttpAdapter, AdapterWithErrorHandler>();

            // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
            services.AddTransient <IBot, EchoBot>();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            var loggerConnectionString = Configuration["TranscriptStoreConnectionString"];
            var logger = new EntityFrameworkTranscriptStore(loggerConnectionString);
            var transcriptMiddleware = new TranscriptLoggerMiddleware(logger);

            services.AddSingleton <ITranscriptStore>(logger);

            //// Conversation State Storage
            //IStorage conversationDataStore = new EntityFrameworkStorage(connectionString);
            //var conversationState = new ConversationState(conversationDataStore);

            //// User State Storage
            //IStorage userDataStore = new EntityFrameworkStorage(connectionString);
            //var userState = new UserState(userDataStore);

            // Create the Bot Framework Adapter with error handling enabled.
            services.AddSingleton <IBotFrameworkHttpAdapter, AdapterWithErrorHandler>();

            // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
            services.AddTransient <IBot, EchoBot>();
        }