【发布时间】:2020-03-12 15:31:23
【问题描述】:
我试图在没有依赖注入的 Kentico Portal 项目中使用他们的DeliveryClient 调用 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 的blog post 中所述新建我自己的交付客户
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 Framework 4.6.1
【问题讨论】:
标签: c# kentico kentico-kontent