I am setting up a custom Examine index in which I'm going to index IMember objects. I have a custom Member Type which have a few properties defined, and from which a ModelsBuilder class is available. Is there any way to get the ModelsBuilder version of the IMember (IPublishedContent) within the IValueSetBuilder? The UmbracoContextAccessor returns null.
a
Anders Bjerner
07/05/2023, 12:23 PM
IMember is the database type. If you need to access the Umbraco context during indexing, you need to inject IUmbracoContextFactory.
m
Maarten
07/05/2023, 12:27 PM
Amazing, thank you so much. I tried the IUmbracoContextAccessor which returned null, but now I just generate a new context! Are there any downsides on creating a UmbracoContext (and disposing it) manually?
a
Anders Bjerner
07/05/2023, 2:08 PM
I think there may be a small cost, but not sure. We're doing this during indexing, which should be fine