2016-08-10 2 views
2

アイテムのフォールバックバージョンでSitecoreのアイテムをマッピングするときに、非共有フィールドでGlassmapperを動作させる方法はありますか?GlassMapperがSitecore 8.1のフォールバックフィールドをマッピングしていません

Glassは共有フィールドのみをモデルにマッピングできます。私のSitecoreアイテムは英語で値を持ち、ドイツ語は英語に戻ります。アイテムのドイツ語版を求めたら、共有フィールドのみの値を持つアイテムが返されます。

私はglass mapper v4とSitecore 8.1を使用しています。

マイApplication_BeginRequestメソッドは次のようになります。

[SitecoreType(AutoMap = true)] 
public class CustomModel 
{ 
    [SitecoreField] 
    public virtual string Title { get; set; } 

    [SitecoreField] 
    public virtual string Description { get; set; } 

    [SitecoreField("Another field")] 
    public virtual string AnotherField{ get; set; } 
} 

ありがとう:

protected void Application_BeginRequest(object sender, EventArgs e) 
{ 
    Sitecore.Context.Items["Disable"] = new VersionCountDisabler(); 
} 

と私のクラスは次のようになります!

答えて

1

モデルを返品するときにVersionCountDisablerを使用できますか?

var sitecoreContext = new SitecoreContext(); 
using (new VersionCountDisabler()) 
{ 
    Model1 = sitecoreContext.GetCurrentItem<Model>(); 
} 
関連する問題