2013-09-13 18:11:20 +10:00
|
|
|
using Umbraco.Core.Configuration;
|
2014-01-28 10:46:59 +11:00
|
|
|
using System;
|
2016-01-06 14:17:51 +01:00
|
|
|
using Umbraco.Core.Cache;
|
2015-12-21 13:36:58 +01:00
|
|
|
using LightInject;
|
2013-09-13 18:11:20 +10:00
|
|
|
using Umbraco.Core.Configuration.UmbracoSettings;
|
2015-01-09 10:51:15 +11:00
|
|
|
using Umbraco.Core.IO;
|
|
|
|
|
using Umbraco.Core.Logging;
|
2015-12-18 13:29:12 +01:00
|
|
|
using Umbraco.Core.Persistence.Mappers;
|
|
|
|
|
using Umbraco.Core.Persistence.Querying;
|
2012-12-09 09:01:00 +05:00
|
|
|
using Umbraco.Core.Persistence.Repositories;
|
2015-01-13 13:25:36 +11:00
|
|
|
using Umbraco.Core.Persistence.SqlSyntax;
|
2012-12-09 09:01:00 +05:00
|
|
|
using Umbraco.Core.Persistence.UnitOfWork;
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Persistence
|
|
|
|
|
{
|
2012-12-10 08:44:17 -01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Used to instantiate each repository type
|
|
|
|
|
/// </summary>
|
2015-12-21 13:36:58 +01:00
|
|
|
public class RepositoryFactory
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
private readonly IServiceContainer _container;
|
|
|
|
|
public ISqlSyntaxProvider SqlSyntax { get; private set; }
|
|
|
|
|
|
|
|
|
|
public RepositoryFactory(ISqlSyntaxProvider sqlSyntax, IServiceContainer container)
|
2015-01-09 10:51:15 +11:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
_container = container;
|
|
|
|
|
SqlSyntax = sqlSyntax;
|
2015-01-09 10:51:15 +11:00
|
|
|
}
|
|
|
|
|
|
2015-12-21 13:36:58 +01:00
|
|
|
public virtual INotificationsRepository CreateNotificationsRepository(IDatabaseUnitOfWork uow)
|
2013-09-18 13:26:09 +10:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, INotificationsRepository>(uow);
|
2013-09-18 13:26:09 +10:00
|
|
|
}
|
|
|
|
|
|
2015-02-09 17:37:21 +11:00
|
|
|
public virtual IExternalLoginRepository CreateExternalLoginRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IExternalLoginRepository>(uow);
|
2015-02-09 17:37:21 +11:00
|
|
|
}
|
|
|
|
|
|
2015-01-28 13:16:50 +11:00
|
|
|
public virtual IPublicAccessRepository CreatePublicAccessRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IPublicAccessRepository>(uow);
|
2015-01-28 13:16:50 +11:00
|
|
|
}
|
|
|
|
|
|
2015-01-19 18:37:48 +11:00
|
|
|
public virtual ITaskRepository CreateTaskRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, ITaskRepository>(uow);
|
2015-01-19 18:37:48 +11:00
|
|
|
}
|
|
|
|
|
|
2015-01-19 15:12:34 +11:00
|
|
|
public virtual IAuditRepository CreateAuditRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IAuditRepository>(uow);
|
2015-01-19 15:12:34 +11:00
|
|
|
}
|
|
|
|
|
|
2014-09-01 18:06:24 +10:00
|
|
|
public virtual ITagRepository CreateTagRepository(IDatabaseUnitOfWork uow)
|
2013-10-04 16:11:51 +10:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, ITagRepository>(uow);
|
2013-10-04 16:11:51 +10:00
|
|
|
}
|
2013-09-18 12:54:06 +10:00
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IContentRepository CreateContentRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IContentRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IContentTypeRepository CreateContentTypeRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IContentTypeRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IDataTypeDefinitionRepository CreateDataTypeDefinitionRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IDataTypeDefinitionRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IDictionaryRepository CreateDictionaryRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IDictionaryRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual ILanguageRepository CreateLanguageRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, ILanguageRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IMediaRepository CreateMediaRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMediaRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IMediaTypeRepository CreateMediaTypeRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMediaTypeRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IRelationRepository CreateRelationRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IRelationRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IRelationTypeRepository CreateRelationTypeRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IRelationTypeRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IScriptRepository CreateScriptRepository(IUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IUnitOfWork, IScriptRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
internal virtual IPartialViewRepository CreatePartialViewRepository(IUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IUnitOfWork, IPartialViewRepository>(uow, "PartialViewRepository");
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
}
|
|
|
|
|
|
2015-01-09 18:39:44 +11:00
|
|
|
internal virtual IPartialViewRepository CreatePartialViewMacroRepository(IUnitOfWork uow)
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IUnitOfWork, IPartialViewRepository>(uow, "PartialViewMacroRepository");
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
}
|
|
|
|
|
|
2013-10-29 09:24:05 -04:00
|
|
|
public virtual IStylesheetRepository CreateStylesheetRepository(IUnitOfWork uow, IDatabaseUnitOfWork db)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IUnitOfWork, IStylesheetRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual ITemplateRepository CreateTemplateRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2015-12-21 15:02:21 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, ITemplateRepository>(uow);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
2013-08-14 16:12:13 +02:00
|
|
|
|
2015-06-19 12:03:02 +02:00
|
|
|
public virtual IMigrationEntryRepository CreateMigrationEntryRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMigrationEntryRepository>(uow);
|
2015-06-19 12:03:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual IServerRegistrationRepository CreateServerRegistrationRepository(IDatabaseUnitOfWork uow)
|
2013-08-14 16:12:13 +02:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IServerRegistrationRepository>(uow);
|
2013-08-14 16:12:13 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-20 21:56:58 +11:00
|
|
|
public virtual IUserTypeRepository CreateUserTypeRepository(IDatabaseUnitOfWork uow)
|
2013-08-14 16:12:13 +02:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IUserTypeRepository>(uow);
|
2013-08-14 16:12:13 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-20 21:56:58 +11:00
|
|
|
public virtual IUserRepository CreateUserRepository(IDatabaseUnitOfWork uow)
|
2015-12-21 13:36:58 +01:00
|
|
|
{
|
|
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IUserRepository>(uow);
|
2013-08-14 16:12:13 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-17 20:19:27 +10:00
|
|
|
internal virtual IMacroRepository CreateMacroRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMacroRepository>(uow);
|
2013-09-17 20:19:27 +10:00
|
|
|
}
|
|
|
|
|
|
2014-02-20 21:56:58 +11:00
|
|
|
public virtual IMemberRepository CreateMemberRepository(IDatabaseUnitOfWork uow)
|
2013-08-26 16:59:41 +02:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMemberRepository>(uow);
|
2013-08-26 16:59:41 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-20 21:56:58 +11:00
|
|
|
public virtual IMemberTypeRepository CreateMemberTypeRepository(IDatabaseUnitOfWork uow)
|
2013-09-02 15:53:09 +02:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMemberTypeRepository>(uow);
|
2013-09-02 15:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-20 21:56:58 +11:00
|
|
|
public virtual IMemberGroupRepository CreateMemberGroupRepository(IDatabaseUnitOfWork uow)
|
2014-02-10 19:48:16 +11:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IMemberGroupRepository>(uow);
|
2013-08-26 16:59:41 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-20 21:56:58 +11:00
|
|
|
public virtual IEntityRepository CreateEntityRepository(IDatabaseUnitOfWork uow)
|
2013-08-14 16:12:13 +02:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IEntityRepository>(uow);
|
2013-08-14 16:12:13 +02:00
|
|
|
}
|
|
|
|
|
|
2015-12-16 09:50:17 +01:00
|
|
|
public virtual IDomainRepository CreateDomainRepository(IDatabaseUnitOfWork uow)
|
2015-01-21 18:35:08 +11:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, IDomainRepository>(uow);
|
2015-01-21 18:35:08 +11:00
|
|
|
}
|
2015-01-22 19:19:21 +11:00
|
|
|
|
2015-12-21 13:36:58 +01:00
|
|
|
public virtual ITaskTypeRepository CreateTaskTypeRepository(IDatabaseUnitOfWork uow)
|
2015-01-22 19:19:21 +11:00
|
|
|
{
|
2015-12-21 13:36:58 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, ITaskTypeRepository>(uow);
|
2015-01-22 19:19:21 +11:00
|
|
|
}
|
2015-11-20 13:39:42 +01:00
|
|
|
|
2016-01-14 19:33:53 +01:00
|
|
|
internal virtual EntityContainerRepository CreateEntityContainerRepository(IDatabaseUnitOfWork uow, Guid containerObjectType)
|
2015-11-20 13:39:42 +01:00
|
|
|
{
|
2016-03-10 19:47:10 +01:00
|
|
|
return _container.GetInstance<IDatabaseUnitOfWork, EntityContainerRepository>(uow);
|
2015-11-20 13:39:42 +01:00
|
|
|
}
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
2012-12-09 09:01:00 +05:00
|
|
|
}
|