我试图DeliveryClient
在没有依赖注入的 Kentico Portal 项目中使用他们调用 Kentico Kontent。此项目希望迁移到 Kontent,但希望现有项目中的一个新功能在转换之前与 Kontent 一起实施。
安装 Kontent Delivery SDK 后,这是我的代码
var clientTest = DeliveryClientBuilder.WithProjectId("MyProjectId").Build();
我收到运行时错误
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.DependencyInjection, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'
显然,这个项目没有依赖注入,我听说在门户项目中设置它是很困难的,如果不是不可能的话。因此,我决定按照 Kentico 的博客文章中所述新建自己的交付客户端
var test = new DeliveryClient(options);
但DeliveryClient
标记为内部:'DeliveryClient' is inaccessible due to its protection level
我该如何进行?
细节
- Kentico.Kontent.Delivery 12.3.0
- Kentico 版本 12.0.22
- .Net 框架 4.6.1