如何从EF Core(SQL Server数据库)中返回一些选择?
我尝试了下一个示例,但出现错误:
找不到CLR类型'Test1'到关系类型的映射
此行发生错误:
lineCanvas.onclick = function (e) {
var firstPoint = window.chartLineObject.getElementsAtEvent(e);
if (typeof firstPoint[0] == "undefined") {
popupAlert("Select one of visible dots to get detailed results !", 'danger')
return;
}
以下是相关代码:
var valueBufferFactory = set
.GetService<IRelationalValueBufferFactoryFactory>()
.Create(new[] { typeof(T) }, null);
答案 0 :(得分:2)
您正在使用很多EF Core内部内容,因此请记住,该代码的任何部分都可能(并且可能会)在将来的EF Core版本中中断(即使现在我也警告{{1} }使用的方法已过时)。
无论如何,现在的问题是Create
的第一个参数-您正在传递Create
(实体的类型),而它期望一个包含CLR类型的数组。阅读器要映射的属性。
因此,以下方法应该起作用:
new[] { typeof(T) }