【问题标题】:Exception when referencing SSAS Tabular model in C#在 C# 中引用 SSAS 表格模型时出现异常
【发布时间】:2017-06-01 01:10:32
【问题描述】:

我正在尝试通过 C# 在 Azure Analysis Services 中自动刷新分区。我已经安装并引用了最新的“Microsoft.AnalysisServices”。 ..' 在这里找到的程序集:

https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers.

然后我有以下代码:

使用系统; 使用 Microsoft.AnalysisServices.Tabular;

    public void Run()
    {
        Server asSrv = new Server();

        try
        {

            asSrv.Connect(ASConnectionString);
            Database db = asSrv.Databases.FindByName("HospoIQTabular");
            Model m = db.Model;

            // only refresh 2017 partitions

            m.Tables["Sales"].Partitions["Sales - Post 2017"].RequestRefresh(RefreshType.Full);
            m.Tables["Payments"].Partitions["Payments - Post 2017"].RequestRefresh(RefreshType.Full);

            db.Model.SaveChanges();     // commit which will execute the refresh

        }
        catch (Exception e)
        {
            OnEventLog(e.Message);
        }
        finally
        {
            asSrv.Disconnect();
            asSrv = null;
        }

    }

连接到服务器和数据库本身工作正常。但是,尝试引用“db.Model”会引发以下异常:

类型“DataSourceType”的值“2”是意外的。

我已经看过,但在任何地方都找不到任何帮助。有什么想法吗??

【问题讨论】:

  • 我想通了。需要从这里直接使用程序集:C:\Program Files\Microsoft SQL Server\140\SDK\Assemblies。不是一些在线博客中指出的 130 个版本。
  • 你的评论对我有帮助,你能把它发布为这个问题的答案吗?

标签: c# azure ssas ssas-tabular azure-analysis-services


【解决方案1】:

对我来说,有效的路径是C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies 但只有在阅读了 Andrae 的评论后,我才朝着正确的方向前进

【讨论】:

  • 我无法与路径相关联。我应该在路径中更改什么?你能更具体地回答这个问题吗?
  • 嗨。你能分享你尝试使用atm的路径吗?谢谢
【解决方案2】:

问题与 NuGet 包 Microsoft.AnalysisServices.Tabular (v13) 类似

幸运的是,您可以使用此处列出的 NuGet 包:https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers

在 Visual Studio 中,NuGet 将此包列为 Microsoft.AnalysisServices.retail.amd64

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多