简体   繁体   English

ADOMD.Net中的AdomdConnection类缺少ChangeEffectiveUser API(用于SSAS中的用户模拟)

[英]ChangeEffectiveUser API (for user impersonation in SSAS) missing from AdomdConnection Class in ADOMD.Net

I've been trying to check the access of a user on a SQL Server Analysis Services (SSAS) server using impersonation. 我一直在尝试使用模拟检查用户在SQL Server Analysis Services(SSAS)服务器上的访问权限。

AdomdConnection class has following instance method to accomplish the same: AdomdConnection类具有以下实例方法来实现相同目的:

public void ChangeEffectiveUser(string effectiveUserName)

Here is the MSDN documentation for the same. 是相同的MSDN文档。

I followed the NuGet package instructions here to add ADOMD.Net in my C# project but when I try to use the API then I don't see the API in intellisense at all. 我按照此处的NuGet软件包说明 C#项目中添加ADOMD.Net,但是当我尝试使用API​​时,我根本看不到intellisense中的API。

try
{
    Console.WriteLine("Going to open ADOMD connection.");
    myconnect.Open();
    //below line doesn't compile
    myconnect.ChangeEffectiveUser(@"mydomainname\otherUserIamTryingToImpersonate");
    adomdCommand.ExecuteNonQuery();
    Console.WriteLine("Query executed successfully");
    Console.ReadLine();
}
catch (Exception ex)
{

    MessageBox.Show("error in connection");
}

It is giving compilation failure: 它导致编译失败:

Error CS1061 'AdomdConnection' does not contain a definition for 'ChangeEffectiveUser' and no extension method 'ChangeEffectiveUser' accepting a first argument of type 'AdomdConnection' could be found (are you missing a using directive or an assembly reference?) 错误CS1061'AdomdConnection'不包含'ChangeEffectiveUser'的定义,并且找不到扩展方法'ChangeEffectiveUser'接受类型为'AdomdConnection'的第一个参数(您是否缺少using指令或程序集引用?)

Am I missing something? 我想念什么吗?

I was able to figure out that MS has changed the NuGet package for the latest ADOMD.Net release which came as part of SQL Server 2016. It is available on NuGet package here in the name of Unofficial.Microsoft.AnalysisServices.AdomdClient . 我能够弄清楚,MS已更改了SQL Server 2016附带的最新ADOMD.Net版本的NuGet程序包。 在此处的 NuGet程序包中可以使用Unofficial.Microsoft.AnalysisServices.AdomdClient的名称。 Not sure why MS has taken this strategy to introduce a new package instead when they should have simply added a new version in the already existing NuGet package here in the name of Microsoft.AnalysisServices.AdomdClient . 不知道MS为什么应采用此策略引入新软件包,而只是应该以Microsoft.AnalysisServices.AdomdClient的名义在此处已经存在的NuGet软件包中简单地添加新版本。

The moment I took reference of v13.x of Microsoft.AnalysisServices.AdomdClient.dll present in Unofficial.Microsoft.AnalysisServices.AdomdClient NuGet package my compilation error went away and I could see the API. 当我参考Unofficial.Microsoft.AnalysisServices.AdomdClient NuGet包中存在的Microsoft.AnalysisServices.AdomdClient.dll v13.x时,我的编译错误消失了,我可以看到API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM