1
votes

I have found that my glass model works not correctly with Fallback module, not read fallback language values in some cases for example next case: At some template with EN language (EN context language as well), I have shared droplink field, this field also has checked fallback checkbox, that link to some other item (i2), i2 have only one language that is different from context language. Glass Mapper can't map this fields correctly. (return null) How to resolve it ? Maybe it would be good to have some attribute for notify glass mapper about it

I know about VersionCountDisabler, but it is good for programmatic item getting, what about glass mapper intreface or class (SitecoreType) when glass do it at background

1

1 Answers

1
votes

In your example, you say that you have a template with a shared droplink field that has fallback enabled. You have an item (i1) based on that template that is pointing at another item (i2), but the fields of i2 are returning null. Correct?

It doesn't make sense to enable fallback on a shared droplink field. Instead, I think you want to enable fallback on the template fields for item i2.

Your question about using VersionCountDisabler "at background" isn't entirely clear, but I'm guessing you just want to have it used throughout your application. See the documentation on that here: http://glass.lu/Mapper/Sc/Documentation/VersionCountDisabler.

Essentially, you can create an instance at the beginning of a request and dispose of it at the end of the request. This can be either in the Global.asax as shown in the documentation or you could create processors for the httpRequestBegin and httpRequestEnd pipelines. If you need it in a background task that does not have a request context (e.g. event handler, scheduled agent), you can just use the using statement method.