本文整理汇总了C#中IContentService类的典型用法代码示例。如果您正苦于以下问题:C# IContentService类的具体用法?C# IContentService怎么用?C# IContentService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IContentService类属于命名空间,在下文中一共展示了IContentService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContentServiceOnDeleted
private void ContentServiceOnDeleted(IContentService sender, DeleteEventArgs<IContent> deleteEventArgs)
{
foreach(var deletedEntity in deleteEventArgs.DeletedEntities)
{
DeleteEntityIndex(deletedEntity);
}
}
示例2: ServiceContext
/// <summary>
/// public ctor - will generally just be used for unit testing
/// </summary>
/// <param name="contentService"></param>
/// <param name="mediaService"></param>
/// <param name="contentTypeService"></param>
/// <param name="dataTypeService"></param>
/// <param name="fileService"></param>
/// <param name="localizationService"></param>
/// <param name="packagingService"></param>
/// <param name="entityService"></param>
/// <param name="relationService"></param>
/// <param name="sectionService"></param>
/// <param name="treeService"></param>
/// <param name="tagService"></param>
public ServiceContext(
IContentService contentService,
IMediaService mediaService,
IContentTypeService contentTypeService,
IDataTypeService dataTypeService,
IFileService fileService,
ILocalizationService localizationService,
PackagingService packagingService,
IEntityService entityService,
IRelationService relationService,
ISectionService sectionService,
IApplicationTreeService treeService,
ITagService tagService)
{
_tagService = new Lazy<ITagService>(() => tagService);
_contentService = new Lazy<IContentService>(() => contentService);
_mediaService = new Lazy<IMediaService>(() => mediaService);
_contentTypeService = new Lazy<IContentTypeService>(() => contentTypeService);
_dataTypeService = new Lazy<IDataTypeService>(() => dataTypeService);
_fileService = new Lazy<IFileService>(() => fileService);
_localizationService = new Lazy<ILocalizationService>(() => localizationService);
_packagingService = new Lazy<PackagingService>(() => packagingService);
_entityService = new Lazy<IEntityService>(() => entityService);
_relationService = new Lazy<IRelationService>(() => relationService);
_sectionService = new Lazy<ISectionService>(() => sectionService);
_treeService = new Lazy<IApplicationTreeService>(() => treeService);
}
示例3: ContentTypeService
public ContentTypeService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, IContentService contentService, IMediaService mediaService)
{
_uowProvider = provider;
_repositoryFactory = repositoryFactory;
_contentService = contentService;
_mediaService = mediaService;
}
示例4: ContentServiceOnSaving
/// <summary>
/// Set auto-properties on content saving
/// We can't do these properties on create as the source values will not exist
/// </summary>
/// <param name="sender">The content service</param>
/// <param name="e">The save event arguments</param>
protected void ContentServiceOnSaving(IContentService sender, SaveEventArgs<IContent> e)
{
foreach (IContent entity in e.SavedEntities)
{
entity.SetDefaultValue("headTitle", entity.Name);
}
}
示例5: ContentService_Created
static void ContentService_Created(IContentService sender, NewEventArgs<IContent> e)
{
if (UmbracoContext.Current == null) return;
if (e.Entity.ContentType.Alias.InvariantEquals("ArticulateRichText")
|| e.Entity.ContentType.Alias.InvariantEquals("ArticulateMarkdown"))
{
if (UmbracoContext.Current.Security.CurrentUser != null)
{
e.Entity.SetValue("author", UmbracoContext.Current.Security.CurrentUser.Name);
}
e.Entity.SetValue("publishedDate", DateTime.Now);
e.Entity.SetValue("enableComments", 1);
}
else if (e.Entity.ContentType.Alias.InvariantEquals("Articulate"))
{
e.Entity.SetValue("theme", "VAPOR");
e.Entity.SetValue("pageSize", 10);
e.Entity.SetValue("categoriesUrlName", "categories");
e.Entity.SetValue("tagsUrlName", "tags");
e.Entity.SetValue("searchUrlName", "search");
e.Entity.SetValue("categoriesPageName", "Categories");
e.Entity.SetValue("tagsPageName", "Tags");
e.Entity.SetValue("searchPageName", "Search results");
}
}
示例6: ContentController
/// <summary>
/// Initializes a new instance of the ContentController class.
/// </summary>
/// <param name="contentService">Instance of Content Service</param>
/// <param name="profileService">Instance of profile Service</param>
public ContentController(IContentService contentService, IProfileService profileService, INotificationService queueService, ICommunityService communityService)
: base(profileService)
{
_contentService = contentService;
_notificationService = queueService;
_communityService = communityService;
}
示例7: ApiController
public ApiController(
IEntitiesContext entitiesContext,
IPackageService packageService,
IPackageFileService packageFileService,
IUserService userService,
INuGetExeDownloaderService nugetExeDownloaderService,
IContentService contentService,
IIndexingService indexingService,
ISearchService searchService,
IAutomaticallyCuratePackageCommand autoCuratePackage,
IStatusService statusService,
IAppConfiguration config)
{
EntitiesContext = entitiesContext;
PackageService = packageService;
PackageFileService = packageFileService;
UserService = userService;
NugetExeDownloaderService = nugetExeDownloaderService;
ContentService = contentService;
StatisticsService = null;
IndexingService = indexingService;
SearchService = searchService;
AutoCuratePackage = autoCuratePackage;
StatusService = statusService;
_config = config;
}
示例8: ContentLogic
public ContentLogic(IContentService contentService, IAttachmentService attachmentService, ILegacyContentService legacyContentService, IFileViewerService fileViewerService)
{
if (contentService == null)
{
throw new ArgumentNullException("contentService");
}
if (attachmentService == null)
{
throw new ArgumentNullException("attachmentService");
}
if (fileViewerService == null)
{
throw new ArgumentNullException("fileViewerService");
}
if (legacyContentService == null)
{
throw new ArgumentNullException("legacyContentService");
}
ContentService = contentService;
AttachmentService = attachmentService;
LegacyContentService = legacyContentService;
FileViewerService = fileViewerService;
}
示例9: Album_saved
private void Album_saved(IContentService sender, SaveEventArgs<IContent> e)
{
foreach (IContent node in e.SavedEntities)
{
if (node.ContentType.ContentTypeCompositionExists("Album") || node.ContentType.Alias == "Album")
{
IMediaService ms = UmbracoContext.Current.Application.Services.MediaService;
IContent parent = node.Parent();
int media_parentId;
if (parent.ContentType.ContentTypeCompositionExists("Album") || parent.ContentType.Alias == "Album")
{
IMedia media_parent = ms.GetRootMedia().Where(x => x.Name == parent.Name).First(x => x.ContentType.Alias == "Folder");
if (media_parent == null)
{
media_parent = ms.CreateMedia(parent.Name, -1, "Folder");
ms.Save(media_parent);
}
media_parentId = media_parent.Id;
}
else
media_parentId = -1;
IMedia media_album = ms.CreateMedia(node.Name, media_parentId, "Folder");
ms.Save(media_album);
}
}
}
示例10: VideoService
// private readonly IMemberService _memberService;
public VideoService(IContentService content)
{
_content = content;
_context = new UmbracoContextProvider();
//var umbracoConextProvider = DependencyResolver.Current.GetService<IUmbracoConextProvider>();
_umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
}
示例11: SaveContentItemsToDisk
/// <summary>
/// our save routine, checks to see if the item has been renamed, or if it's been moved
/// then saves.
/// </summary>
void SaveContentItemsToDisk(IContentService sender, IEnumerable<IContent> items)
{
SourceInfo.Load();
ContentExporter w = new ContentExporter();
foreach (var item in items)
{
LogHelper.Info<ContentExporter>("Saving {0} [{1}]", () => item.Name, () => item.Name.ToSafeAlias());
string sourceName = SourceInfo.GetName(item.Key);
if ( (sourceName!= null) && (item.Name != sourceName ) )
{
LogHelper.Info<ContentExporter>("Rename {0}", () => item.Name);
w.RenameContent(item, SourceInfo.GetName(item.Key));
}
int? parent = SourceInfo.GetParent(item.Key) ;
if ( (parent != null) && (item.ParentId != parent.Value))
{
LogHelper.Info<ContentExporter>("Move {0}", () => item.Name);
w.MoveContent(item, parent.Value);
}
w.SaveContent(item);
}
SourceInfo.Save();
}
示例12: PagesController
public PagesController(IContentService contentService,
IMessageService messageService,
ISupportRequestService supportRequestService)
{
_contentService = contentService;
_messageService = messageService;
_supportRequestService = supportRequestService;
}
示例13: ContentService_Creating
private void ContentService_Creating(IContentService sender, Umbraco.Core.Events.NewEventArgs<IContent> e)
{
//if (e.Alias == "SOSU-Nyhed")
//{
// e.Entity.SetValue("contentDate", DateTime.Now);
// // e.Entity.SetValue("umbracoNaviHide", true);
//}
}
示例14: CommonController
public CommonController(IUnitOfWork unitOfWork, ICategoryService categoryService, IStoreService storeService,
IContentService contentService)
{
this._unitOfWork = unitOfWork;
this._categoryService = categoryService;
this._storeService = storeService;
this._contentService = contentService;
}
示例15: ContentService_Trashing
/// <summary>
/// when something is deleted it's plopped in the recycle bin
/// </summary>
void ContentService_Trashing(IContentService sender, Umbraco.Core.Events.MoveEventArgs<IContent> e)
{
LogHelper.Info<ContentEvents>("Trashing {0}", () => e.Entity.Name);
ArchiveContentItem(e.Entity);
}