c# - c# 中的 SSAS 自动化 - 实用地重命名 c# 中的 AAS 属性
问题描述
我需要 C# 中的 SSAS 自动化方面的帮助。我想自动重命名 AAS 属性的显示名称。使用 c# 自动化重命名的整个过程。请帮忙。请分享有关此的任何链接或文章
解决方案
AMO 的 MS 文档在这里
将AMO nuget 包添加到您的 Visual Studio 项目中
然后,您可以从代码连接到 SSAS 服务器并更改维度属性。
例如,
private static void UpdateAttribute()
{
var serverName = ConfigurationManager.AppSettings["ServerName"];
var databaseName = ConfigurationManager.AppSettings["DatabaseName"];
var cubeName = ConfigurationManager.AppSettings["CubeName"];
var dimensionName = ConfigurationManager.AppSettings["DimensionName"];
var attributeName = ConfigurationManager.AppSettings["AttributeName"];
//Server
var server = new Server();
server.Connect(serverName);
//Database
var db = server.Databases.FindByName(databaseName);
//Cube
var cube = db.Cubes.FindByName(cubeName);
//dim
var dim = db.Dimensions.FindByName(dimensionName);
//attribute
var attribute = dim.Attributes.FindByName(attributeName);
var newAttributeName = $"{attribute.Name}_New";
attribute.Name = newAttributeName;
//this will update the dimension in the Server
dim.Update();
}
结果
原来的属性名称是“Category”,现在在 Product 维度中更改为“Category_New”
推荐阅读
- php - 一个 laravel 应用程序上的多个网站
- reactjs - React Context API + withRouter - 我们可以一起使用它们吗?
- angular - 在变量ionic3中分配html内容
- python - 想要在使用 lxml 移除元素时移除所有子元素
- ruby - 如何在 JRuby 中包含类依赖 jar?
- kotlin - 围绕 Kotlin 挂起功能的方面
- python - scikit-learn 中的神经网络 epoch 和 max_iter
- django - Django Media URL 未将字符串返回到 Media 文件夹
- python - 如何生成我用 jose.jwt.decode 解码的 RS256 签名令牌
- javascript - 如何从一系列数组中搜索输入标签值