Search code examples
.netasp.net-mvc-5aspnetboilerplate

how to use abp repository in global.aspx?


In the mvc5 project, I want to take database data fill in Redis at Application_Start. but at that time IocManager registration not completed. What should I do to solve this problem (don't use ADO.Net)


Solution

  • You can feed your Redis application in PostInitialize method of WebMvcModule.cs class.

    In the sample code, I am retrieving users from the database.

    public override void PostInitialize()
    {
        var userRepository = IocManager.Resolve<IRepository<User, long>>();
        var users = userRepository.GetAllList();
        /* Feed the Redis here... */
    }