U4-10385 Examine indexing performance bottleneck: IUserService.GetProfileById which is not cached
This commit is contained in:
@@ -17,7 +17,7 @@ namespace Umbraco.Core.Models.Membership
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class User : Entity, IUser
|
||||
public class User : Entity, IUser, IProfile
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for creating a new/empty user
|
||||
|
||||
@@ -701,12 +701,11 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="id">Id of the User to retrieve</param>
|
||||
/// <returns><see cref="IProfile"/></returns>
|
||||
public IProfile GetProfileById(int id)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = RepositoryFactory.CreateUserRepository(uow);
|
||||
return repository.GetProfile(id);
|
||||
}
|
||||
{
|
||||
//This is called a TON. Go get the full user from cache which should already be IProfile
|
||||
var fullUser = GetUserById(id);
|
||||
var asProfile = fullUser as IProfile;
|
||||
return asProfile ?? new UserProfile(fullUser.Id, fullUser.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user