private T AssignLoginsCallback(T user)
 {
     if (user != null)
     {
         user.SetLoginsCallback(new Lazy <IEnumerable <IdentityMemberLogin <int> > >(() =>
                                                                                     _externalLoginStore.GetAll(user.Id)));
     }
     return(user);
 }
Exemplo n.º 2
0
        /// <summary>
        /// This is used to assign the lazy callbacks for the user's data collections
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        private TMember AssignUserDataCallback(TMember user)
        {
            if (user != null)
            {
                user.SetLoginsCallback(new Lazy <IEnumerable <IdentityMemberLogin <int> > >(() =>
                                                                                            _externalLoginStore.GetAll(user.Id)));

                user.SetRolesCallback(new Lazy <IEnumerable <IdentityMemberRole <int> > >(() =>
                {
                    IMembershipRoleService <IMember> memberRoleService = _memberService;
                    var roles = memberRoleService.GetAllRoles(user.Id);
                    return(roles.Select(x => new IdentityMemberRole()
                    {
                        RoleName = x,
                        UserId = user.Id
                    }));
                }));
            }
            return(user);
        }