/// <summary> /// Used to attach child entities to the User aggregate, i.e. Roles, Logins, and Claims /// </summary> /// <param name="filter"></param> /// <returns></returns> protected virtual async Task <SysUser> GetUserAggregateAsync(Expression <Func <SysUser, bool> > filter) { Int32 id; SysUser user; if (FindByIdFilterParser.TryMatchAndGetId(filter, out id)) { user = await _userStore.GetByKeyAsync(id); } else { user = await Users.FirstOrDefaultAsync(filter); } if (user != null) { // await EnsureClaimsLoaded(user); // await EnsureLoginsLoaded(user); // await EnsureRolesLoaded(user); } return(user); }
/// <summary> /// Used to attach child entities to the User aggregate, i.e. Roles, Logins, and Claims /// </summary> /// <param name="filter"></param> /// <returns></returns> protected virtual async Task <AspNetUser> GetUserAggregateAsync(Expression <Func <AspNetUser, bool> > filter) { string id; AspNetUser user; if (FindByIdFilterParser.TryMatchAndGetId(filter, out id)) { user = await _userStore.GetByIdAsync(id).WithCurrentCulture( ); } else { user = await Users.FirstOrDefaultAsync(filter).WithCurrentCulture( ); } if (user != null) { await EnsureClaimsLoaded(user).WithCurrentCulture( ); await EnsureLoginsLoaded(user).WithCurrentCulture( ); await EnsureRolesLoaded(user).WithCurrentCulture( ); } return(user); }
protected virtual async Task <ApplicationUser> GetUserAggregateAsync(Expression <Func <ApplicationUser, bool> > filter) { long id; ApplicationUser user; if (FindByIdFilterParser.TryMatchAndGetId(filter, out id)) { user = await _userStore.GetByIdAsync(id).ConfigureAwait(false); } else { user = await Users.FirstOrDefaultAsync(filter).ConfigureAwait(false); } if (user == null) { return(null); } await EnsureClaimsLoaded(user).ConfigureAwait(false); await EnsureLoginsLoaded(user).ConfigureAwait(false); await EnsureRolesLoaded(user).ConfigureAwait(false); return(user); }