Refactor new Services for thread safety, plus unit tests. Not all services are updated to be correct, only the

ContentService, the rest need to be updated as well.
This commit is contained in:
Shannon Deminick
2012-12-11 12:03:36 +05:00
parent aeab577627
commit feff68ada8
49 changed files with 987 additions and 490 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Repositories;
@@ -51,7 +52,7 @@ namespace Umbraco.Core.Models
public static IProfile GetCreatorProfile(this IContent content)
{
var repository = RepositoryResolver.Current.Factory.CreateUserRepository(
new PetaPocoUnitOfWork());
new PetaPocoUnitOfWork(DatabaseContext.Current.Database));
return repository.GetProfileById(content.CreatorId);
}
@@ -61,7 +62,7 @@ namespace Umbraco.Core.Models
public static IProfile GetWriterProfile(this IContent content)
{
var repository = RepositoryResolver.Current.Factory.CreateUserRepository(
new PetaPocoUnitOfWork());
new PetaPocoUnitOfWork(DatabaseContext.Current.Database));
return repository.GetProfileById(content.WriterId);
}
}