Skip to main content
added 1 character in body
Source Link
Søren Kruse
  • 3.3k
  • 1
  • 17
  • 22

I believe linked items by default are loaded lazily, which is probably what is causing this.

If you first access the property outside the VersionCountDisabler then the items are loaded without it.

An alternative solution to youyour own answer could be to try and use SitecoreFieldSettings.DontLoadLazily on the properties in question. The items should then all be loaded and mapped inside the VersionCountDisabler.

// Attribute configuration
[SitecoreField(Setting = SitecoreFieldSettings.DontLoadLazily)]
public IList<MyLinkedItem> LinkedItems { get; set; }

// Fluent configuration
Map(x => x.Field(y => y.LinkedItems ).Setting(SitecoreFieldSettings.DontLoadLazily));

I believe linked items by default are loaded lazily, which is probably what is causing this.

If you first access the property outside the VersionCountDisabler then the items are loaded without it.

An alternative solution to you own answer could be to try and use SitecoreFieldSettings.DontLoadLazily on the properties in question. The items should then all be loaded and mapped inside the VersionCountDisabler.

// Attribute configuration
[SitecoreField(Setting = SitecoreFieldSettings.DontLoadLazily)]
public IList<MyLinkedItem> LinkedItems { get; set; }

// Fluent configuration
Map(x => x.Field(y => y.LinkedItems ).Setting(SitecoreFieldSettings.DontLoadLazily));

I believe linked items by default are loaded lazily, which is probably what is causing this.

If you first access the property outside the VersionCountDisabler then the items are loaded without it.

An alternative solution to your own answer could be to try and use SitecoreFieldSettings.DontLoadLazily on the properties in question. The items should then all be loaded and mapped inside the VersionCountDisabler.

// Attribute configuration
[SitecoreField(Setting = SitecoreFieldSettings.DontLoadLazily)]
public IList<MyLinkedItem> LinkedItems { get; set; }

// Fluent configuration
Map(x => x.Field(y => y.LinkedItems ).Setting(SitecoreFieldSettings.DontLoadLazily));
Source Link
Søren Kruse
  • 3.3k
  • 1
  • 17
  • 22

I believe linked items by default are loaded lazily, which is probably what is causing this.

If you first access the property outside the VersionCountDisabler then the items are loaded without it.

An alternative solution to you own answer could be to try and use SitecoreFieldSettings.DontLoadLazily on the properties in question. The items should then all be loaded and mapped inside the VersionCountDisabler.

// Attribute configuration
[SitecoreField(Setting = SitecoreFieldSettings.DontLoadLazily)]
public IList<MyLinkedItem> LinkedItems { get; set; }

// Fluent configuration
Map(x => x.Field(y => y.LinkedItems ).Setting(SitecoreFieldSettings.DontLoadLazily));