// 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>(); }
private void CreateDbContext() { _context?.Dispose(); _context = new TestsDbContextFactory().CreateDbContext(new string[0]); _storage = new EntityFrameworkStorage(_context); }