Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

.Net Client constructor in 14.0, no fromconfig method?

Vote:
0

Hey all,

I'm finding that the CONSTRUCTOR for the .Net Client API in 14.0.4 no longer has a static method to build the client.

I can get my code like below to SEARCH, but when I then try a filter like below. I get a Null Reference before I even call out to HTTP

Any ideas? How do correctly construct the Client to THEN put it into DI?

            FindOptions options = new FindOptions
            {
                ServiceUrl = "https://es-us-api01.episerver.com/xxxxxx/",
                DefaultIndex = "yyyyyyyy"
            };

            IOptions<FindOptions> opts = new OptionsWrapper<FindOptions>(options);

            MemoryCacheOptions memoptns = new MemoryCacheOptions();
            IOptions<MemoryCacheOptions> memopts = new OptionsWrapper<MemoryCacheOptions>(memoptns);

            var find = new Client(opts, new RuntimeCacheAdapter(new MemoryCache(memopts)));

          var searchQuery = find.Search<RemoteHostedContentItem>()
                .Filter(x => x.SearchTitle.Match("miso"));

#272739
Edited, Feb 22, 2022 20:34
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.