我在 .net 中使用 EntityFrameworkProvider 来查询名为“NorthwindEF”的 ssas 多维数据集
我在名为“ProductCount”的 ssas 多维数据集中有一个度量。
当我运行此 MDX 查询 SQL Server 时:
SELECT {[Measures].ProductCount]} ON COLUMNS FROM [NorthwindEF]
输出是:123
我创建了一个自定义类,如下所示
[MeasureGroup]
Public partial class Product
{
Public int ProductCount { get ; set; }
}
同样,我想使用 .net 在 .net 中检索它。
static void Main()
{
var context = NorthwindEFEntities.CreateForOlap();
var result = context. ProductCount.Select(o => o.Quantity);
}
但是当我执行下面的查询时,我得到的错误是:
{"Query (2, 1) The '[Product Count]' member was not found in the cube when the string, [Measures].[ Product Count], was parsed."} The querybuilder is automatically assuming ProductCount as Product Count ,which is generating the error.
有什么办法可以避免这种情况吗?
这是我点击的链接:
最佳答案
使用这个:
Mdx.NamingConvention = new PreserveSpecifiedNameConvention();
在创建自定义类的类中,类似于从 EF 生成的实体类。 就是这样。
关于c# - 使用 entityframeworkprovider 在 .net 中查询立方体的度量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19830721/