如何访问MicrosoftAnalysisServices的抽象服务器class?

How to access abstract Server class of MicrosoftAnalysisServices?

我正在尝试在脚本任务组件中使用 SSAS 和 Visual Studio 实现动态立方体分区。我正在尝试实现以下代码片段:

Server srv = new Server();

但是,它一直给我错误提示无法创建抽象 class obj。因此,我创建了一个 Servertest class 并实现了 Server class。 错误示例如下:

    Error   CS0534  'Servertest' does not implement inherited abstract member
    Error   CS0534  'Servertest' does not implement inherited abstract member 'Server.CreateSessionTrace()' 
 and so on for very method inside Server class

我的整个代码如下:

using System;
using System.Data;
using System.IO;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.AnalysisServices.Core;
namespace ST_f9f3ba4b76c64ba5bbe76f4be0e05d3c
{


    public class Servertest : Server {
        public void Connect(String s) {
            throw new NotImplementedException();

        }
    }

    [Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    {
        Byte[] dataByte;
        int IsPartitionExists = 0;

        public void Main()
        {
            // TODO: Add your code here

            try
            {
                String  Database_Name = Dts.Variables["User::Database_Name"].Value.ToString();
                String  Cube_Name = Dts.Variables["User::Cube_Name"].Value.ToString();
                String  Measure_Group_Name = Dts.Variables["User::Measure_Group_Name"].Value.ToString();
                String PartitionName = Dts.Variables["User::PartitionName"].Value.ToString();

                ConnectionManager ConnManager = Dts.Connections[Database_Name];
                String ServerName = ConnManager.Properties["ServerName"].GetValue(ConnManager).ToString();
                String DatabaseName = ConnManager.Properties["InitialCatalog"].GetValue(ConnManager).ToString();
                String CubeName = Cube_Name;
                String MeasureGroupName = Measure_Group_Name;

                IsPartitionExists = VerifyPartition(ServerName, DatabaseName, CubeName, MeasureGroupName, PartitionName);
                if (IsPartitionExists == -1)
                {
                    Dts.TaskResult = (int)ScriptResults.Failure;
                }
                else 
                {
                    Dts.Variables["User::IsPartitionExists"].Value = IsPartitionExists;
                    Dts.TaskResult = (int)ScriptResults.Success;
                }
            }
            catch (Exception ex) 
            {
                //Dts.Log("Error Message: "+ ex.Message,0);
                Dts.TaskResult = (int)ScriptResults.Failure;
            }
            Dts.TaskResult = (int)ScriptResults.Success;
        }



        public int VerifyPartition(String ServerName, String DatabaseName, String CubeName, String MeasureGroupName,String ParitionName) 
        {

            string ConnectionString = "Data Source=" + ServerName + ";Catalog=" + DatabaseName + ";";

            string ConnectionString = "Data Source=" + ServerName + ";Catalog=" + DatabaseName + ";";
            Servertest t = new Servertest();
            t.Connect(ConnectionString);
                ................
            return 1;
        }



    }
}

要求我实现服务器的所有方法class。请帮我找到解决这个问题的办法 谢谢!!

在使用不同的在线教程进行了数小时的研究之后,我认为我需要导入 Microsoft.AnalysisServices 而不是 Microsoft.AnalysisServices.Core。通过更改我的导入语句,我能够使用 Server.Connect 方法。 感谢您花时间查看我的问题