实体框架3限制了sql原始查询,并且新选项正在使用数据库视图。我有一个键值类类型,可以使用不同类型的视图。
public class ChartData {
public string Label { get; set; }
public string Value { get; set; }
}
数据类型为无密钥。
因此,新的实体框架核心3.0要求我使用视图。
modelBuilder.Entity<ChartData>().HasnoKey();
但是我有很多视图返回相同类型的查询结果:
例如:
View1: (View_BestSellerProducts)
View2: (View_BestSellesPersons)
View2: (View_BestSelledCities)
...
…
所有这些都发送相同类型的结果:
Label Value
x 100
y 50
z 95
我应该为所有视图创建相同的类型类吗?