* U4-4748 - refactor Content-, Media- and MemberTypeRepository * Cleanup Attempt * Cleanup OperationStatus * U4-4748 - refactor Content-, Media- and MemberTypeService * U4-4748 - cleanup locking * U4-4748 - refactor Content-, Media- and MemberRepository * U4-4748 - refactor ContentService (in progress) * U4-4748 - all unit of work must be completed * U4-4748 - refactor locks, fix tests * U4-4748 - deal with fixmes * U4-4748 - lock table migration * Update UmbracoVersion * Fix AuthorizeUpgrade * U4-4748 - cleanup+bugfix lock objects * U4-4748 - bugfix * updates a string interpolation
22 lines
835 B
C#
22 lines
835 B
C#
using System;
|
|
using Umbraco.Core.Models;
|
|
using Umbraco.Core.Services;
|
|
|
|
namespace Umbraco.Core
|
|
{
|
|
public static class ServiceContextExtensions
|
|
{
|
|
public static IContentTypeServiceBase<T> GetContentTypeService<T>(this ServiceContext services)
|
|
where T : IContentTypeComposition
|
|
{
|
|
if (typeof(T).Implements<IContentType>())
|
|
return services.ContentTypeService as IContentTypeServiceBase<T>;
|
|
if (typeof(T).Implements<IMediaType>())
|
|
return services.MediaTypeService as IContentTypeServiceBase<T>;
|
|
if (typeof(T).Implements<IMemberType>())
|
|
return services.MemberTypeService as IContentTypeServiceBase<T>;
|
|
throw new ArgumentException("Type " + typeof(T).FullName + " does not have a service.");
|
|
}
|
|
}
|
|
}
|