2012-12-09 09:01:00 +05:00
|
|
|
using Umbraco.Core.Persistence.Caching;
|
|
|
|
|
using Umbraco.Core.Persistence.Repositories;
|
|
|
|
|
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>
|
|
|
|
|
public class RepositoryFactory
|
|
|
|
|
{
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IContentRepository CreateContentRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new ContentRepository(
|
|
|
|
|
uow,
|
|
|
|
|
RuntimeCacheProvider.Current,
|
|
|
|
|
CreateContentTypeRepository(uow),
|
2013-08-31 11:28:19 +10:00
|
|
|
CreateTemplateRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming };
|
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
|
|
|
{
|
|
|
|
|
return new ContentTypeRepository(
|
|
|
|
|
uow,
|
|
|
|
|
InMemoryCacheProvider.Current,
|
|
|
|
|
new TemplateRepository(uow, NullCacheProvider.Current));
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IDataTypeDefinitionRepository CreateDataTypeDefinitionRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new DataTypeDefinitionRepository(
|
|
|
|
|
uow,
|
|
|
|
|
NullCacheProvider.Current);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IDictionaryRepository CreateDictionaryRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new DictionaryRepository(
|
|
|
|
|
uow,
|
|
|
|
|
InMemoryCacheProvider.Current,
|
|
|
|
|
CreateLanguageRepository(uow));
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual ILanguageRepository CreateLanguageRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new LanguageRepository(
|
|
|
|
|
uow,
|
|
|
|
|
InMemoryCacheProvider.Current);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IMediaRepository CreateMediaRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new MediaRepository(
|
|
|
|
|
uow,
|
|
|
|
|
RuntimeCacheProvider.Current,
|
2013-08-31 11:28:19 +10:00
|
|
|
CreateMediaTypeRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming };
|
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
|
|
|
{
|
|
|
|
|
return new MediaTypeRepository(
|
|
|
|
|
uow,
|
|
|
|
|
InMemoryCacheProvider.Current);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IRelationRepository CreateRelationRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new RelationRepository(
|
|
|
|
|
uow,
|
|
|
|
|
NullCacheProvider.Current,
|
|
|
|
|
CreateRelationTypeRepository(uow));
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IRelationTypeRepository CreateRelationTypeRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new RelationTypeRepository(
|
|
|
|
|
uow,
|
|
|
|
|
NullCacheProvider.Current);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IScriptRepository CreateScriptRepository(IUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new ScriptRepository(uow);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual IStylesheetRepository CreateStylesheetRepository(IUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
|
|
|
|
return new StylesheetRepository(uow);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-12 17:37:13 -01:00
|
|
|
public virtual ITemplateRepository CreateTemplateRepository(IDatabaseUnitOfWork uow)
|
2012-12-10 08:44:17 -01:00
|
|
|
{
|
2013-07-23 11:46:18 +10:00
|
|
|
return new TemplateRepository(uow, RuntimeCacheProvider.Current);
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
2013-08-14 16:12:13 +02:00
|
|
|
|
|
|
|
|
internal virtual ServerRegistrationRepository CreateServerRegistrationRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
|
|
|
|
return new ServerRegistrationRepository(
|
|
|
|
|
uow,
|
|
|
|
|
NullCacheProvider.Current);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal virtual IUserTypeRepository CreateUserTypeRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
|
|
|
|
return new UserTypeRepository(
|
|
|
|
|
uow,
|
|
|
|
|
NullCacheProvider.Current);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal virtual IUserRepository CreateUserRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
|
|
|
|
return new UserRepository(
|
|
|
|
|
uow,
|
|
|
|
|
NullCacheProvider.Current,
|
|
|
|
|
CreateUserTypeRepository(uow));
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-26 16:59:41 +02:00
|
|
|
internal virtual IMemberRepository CreateMemberRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
2013-09-03 17:02:15 +02:00
|
|
|
return new MemberRepository(uow, RuntimeCacheProvider.Current, CreateMemberTypeRepository(uow));
|
2013-08-26 16:59:41 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-02 15:53:09 +02:00
|
|
|
internal virtual IMemberTypeRepository CreateMemberTypeRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
|
|
|
|
return new MemberTypeRepository(uow, InMemoryCacheProvider.Current);
|
2013-08-26 16:59:41 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-14 16:12:13 +02:00
|
|
|
internal virtual IEntityRepository CreateEntityRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
|
|
|
|
return new EntityRepository(uow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal virtual RecycleBinRepository CreateRecycleBinRepository(IDatabaseUnitOfWork uow)
|
|
|
|
|
{
|
|
|
|
|
return new RecycleBinRepository(uow);
|
|
|
|
|
}
|
2012-12-10 08:44:17 -01:00
|
|
|
}
|
2012-12-09 09:01:00 +05:00
|
|
|
}
|