I use Virtual Assistant. I am going to use Entity Framework Core for saving state. I met a problem. IStorage interface injects like a singleton because other objects which use this interface injects as a singleton.
        services.AddSingleton<IStorage>(new MyDbStorage()); //<-- my storage with dbcontext
        services.AddSingleton<UserState>();          //This class has ctor with IStorage param
        services.AddSingleton<ConversationState>();  //And this class has ctor with IStorage param
        services.AddSingleton(sp =>
        {
            var userState = sp.GetService<UserState>();
            var conversationState = sp.GetService<ConversationState>();
            return new BotStateSet(userState, conversationState);
        });
See on github for details. I know, the global dbcontext is a bad idea. Could you suggest me some options for creating dbcontext? I think about DbContextFactory, but I don't know how exactly create it.
UPDATE I have updated code. See the first line.
 
    