Removed any manual instantiation of PetaPocoUnitOfWork as this should generally always
be done by the PetaPocoUnitOfWorkProvider to ensure that for a UOW it always uses a new database instance, not a shared one.
This commit is contained in:
@@ -51,9 +51,11 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
public static IProfile GetCreatorProfile(this IContent content)
|
||||
{
|
||||
var repository = RepositoryResolver.Current.Factory.CreateUserRepository(
|
||||
new PetaPocoUnitOfWork(DatabaseContext.Current.Database));
|
||||
return repository.GetProfileById(content.CreatorId);
|
||||
using (var repository = RepositoryResolver.Current.Factory.CreateUserRepository(
|
||||
PetaPocoUnitOfWorkProvider.CreateUnitOfWork()))
|
||||
{
|
||||
return repository.GetProfileById(content.CreatorId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,9 +63,11 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
public static IProfile GetWriterProfile(this IContent content)
|
||||
{
|
||||
var repository = RepositoryResolver.Current.Factory.CreateUserRepository(
|
||||
new PetaPocoUnitOfWork(DatabaseContext.Current.Database));
|
||||
return repository.GetProfileById(content.WriterId);
|
||||
using(var repository = RepositoryResolver.Current.Factory.CreateUserRepository(
|
||||
PetaPocoUnitOfWorkProvider.CreateUnitOfWork()))
|
||||
{
|
||||
return repository.GetProfileById(content.WriterId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user