Over the past few days, I have been battling the Identity system in conjunction with the Entity Framework Core. Here is some information before identifying my problem:
- The Framework Core object does not support lazy loading, which means I use eager loading, telling which elements to include
- To indicate which elements of the object I would like to receive, I redefine the method in each repository (the properties that were restored are permanent)
The Identity system that I use is configured as:
services.AddIdentity<ApplicationUser, ApplicationRole>(options => { options.Cookies.ApplicationCookie.AutomaticChallenge = false; }) .AddUserManager<UserManager>() .AddRoleManager<RoleManager>() .AddUserStore<UserStore>() .AddRoleStore<RoleStore>() .AddEntityFrameworkStores<ApplicationDbContext, int>() .AddDefaultTokenProviders();
Now about the problem itself:
I would like to use an identification system to generate tokens, receive users, etc., but I cannot load the UserManager object UserManager , since it returns the Task<ApplicationUser> methods, and the Include() method itself requires IQueryable (in order to load) . What is the general way to be able to use impatient loading and UserManager ?
Hristo
source share