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.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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

    Hi,

    You can try:

    options.Events.OnAuthorizationCodeReceived = async receivedContext =>
    {
        var userRepository = receivedContext.HttpContext.RequestServices
            .GetRequiredService<IIdentityUserRepository>();
    
        var users = await userRepository.GetListAsync();
    };
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.