Changes PetaPocoUnitOfWorkFactory to accept an IDatabaseFactory as ctor. Changes PetaPocoUnitOfWork to not dispose of the Database since
it will be shared with the current thread in order to support nested transactions and changes how the Transaction object is created and used and then disposed of. Changes PetaPocoUnitOfWorkFactory to ensure that the UOW is created with the shared Database instance. Fixes a method in UserService to ensure that the UOW is disposed since it wasn't using a repository.
This commit is contained in:
@@ -53,16 +53,18 @@ namespace Umbraco.Core.Services
|
||||
|
||||
if(HttpRuntime.Cache[cacheKey] == null)
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
userId =
|
||||
uow.Database.ExecuteScalar<int>(
|
||||
"select userID from umbracoUserLogins where contextID = @ContextId",
|
||||
new {ContextId = new Guid(contextId)});
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
userId =
|
||||
uow.Database.ExecuteScalar<int>(
|
||||
"select userID from umbracoUserLogins where contextID = @ContextId",
|
||||
new { ContextId = new Guid(contextId) });
|
||||
|
||||
HttpRuntime.Cache.Insert(cacheKey, userId,
|
||||
null,
|
||||
System.Web.Caching.Cache.NoAbsoluteExpiration,
|
||||
new TimeSpan(0, (int)(Umbraco.Core.Configuration.GlobalSettings.TimeOutInMinutes / 10), 0));
|
||||
HttpRuntime.Cache.Insert(cacheKey, userId,
|
||||
null,
|
||||
System.Web.Caching.Cache.NoAbsoluteExpiration,
|
||||
new TimeSpan(0, (int)(Umbraco.Core.Configuration.GlobalSettings.TimeOutInMinutes / 10), 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user