EPIServer 10 中 unifiedFile 的替代方案

Alternative to unifiedFile in EPIServer 10

有没有EPIServer方面的高手。我需要帮助将代码从第 6 版迁移到第 10 版。我的文件中有这段代码,但在我迁移到第 10 版后出现错误。

  public void Initialize(InitializationEngine context)
    {
        UnifiedFile.UnifiedFileCheckedIn += UnifiedFile_UnifiedFileCheckedIn;
    }

它给出错误 UnifiedFile.The 名称统一文件在当前上下文中不存在。像这样许多与之相关的错误。有什么替代方案?

EPiServer 7.5 改变了媒体系统。您必须迁移数据并重写代码才能在 EPiServer 10 中工作。

http://world.episerver.com/documentation/upgrading/Episerver-CMS/75/Migrating-VPP-based-files-to-the-new-media-system/

http://world.episerver.com/documentation/developer-guides/CMS/Content/assets-and-media2/

没有直接等效于签入文件的方法,但是您可以订阅许多事件以 运行 您的代码。您可以在 Initialize 方法中获取 IContentEvents 的实例,并为 SavedContent 事件添加事件处理程序,如下所示:

public void Initialize(InitializationEngine context)
{
   context.Locate.Advanced.GetInstance<IContentEvents>().SavedContent =+    DoStuffWithSavedContent;
}

    private void DoStuffWithSavedContent(object sender, ContentEventArgs e)
    {
     // Do stuff here...
    } 

所有可用事件的描述如下:

http://world.episerver.com/documentation/class-library/?documentId=cms/7/306eae4b-2ba2-dd1e-c114-bccb0d3d2968

以下是使用媒体的更多示例:

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Assets-and-media/Working-with-media/