U4-10385 Examine indexing performance bottleneck: IUserService.GetProfileById which is not cached

This commit is contained in:
Shannon
2017-09-05 16:41:06 +10:00
parent 6a95da31b0
commit 8ff89c4f48
2 changed files with 6 additions and 7 deletions

View File

@@ -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

View File

@@ -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>