2016-12-05 42 views
0

在EPIServer中是否有任何專家?我需要幫助從版本6遷移代碼10.我在我的文件中的代碼,它給錯誤後,我遷移到版本10替代統一文件在EPIServer 10

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

它詳細介紹了UnifiedFile.The名unifiedfile中不存在錯誤當前上下文。像這樣的錯誤很多。這是什麼選擇?

回答

4

在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/

有簽入文件沒有直接等價的,但也有一些事件,你可以訂閱以運行您的代碼。您可以在初始化方法得到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/

+0

所以我要扔掉所有共同引用unifiedfile,統一目錄? – DevelopmentIsMyPassion

+0

是的,不幸的。可以使用VPi的EPiServers遷移工具將數據遷移到介質,但代碼需要手動修復。 – Andreas

+0

我的同事告訴我說數據已經遷移了,但代碼需要改變。我可以參考哪個代碼示例? – DevelopmentIsMyPassion