Open Closed

Database calls in AbpModule #7413


User avatar
0
derek created

How can I make database calls inside this AbpModule?

I want to be able to save records to my database in this event OnAuthorizationCodeReceived. This event happens after logging into an external provider.


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try:

    options.Events.OnAuthorizationCodeReceived = async receivedContext =>
    {
        var userRepository = receivedContext.HttpContext.RequestServices
            .GetRequiredService<IIdentityUserRepository>();
    
        var users = await userRepository.GetListAsync();
    };
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11