【发布时间】:2018-02-07 03:42:22
【问题描述】:
我想在 Visual Studio 中编写类似于此链接 (https://azure.microsoft.com/en-us/blog/automating-azure-analysis-services-processing-with-azure-functions/) 底部的代码并构建 DLL 文件的代码。但是,我不想使用连接字符串,而是想使用 Azure 门户中的现有链接服务。
我们的目标是创建一个刷新我的多维数据集的 DLL,同时使用我的 Azure 门户中已有的现有链接服务。
这可能吗?
谢谢。
#r "Microsoft.AnalysisServices.Tabular.DLL"
#r "Microsoft.AnalysisServices.Core.DLL"
#r "System.Configuration"
using System;
using System.Configuration;
using Microsoft.AnalysisServices.Tabular;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function started at: {DateTime.Now}");
try
{
Microsoft.AnalysisServices.Tabular.Server asSrv = new Microsoft.AnalysisServices.Tabular.Server();
var connStr = ConfigurationManager.ConnectionStrings["AzureASConnString"].ConnectionString; // Change this to a Linked Service connection
asSrv.Connect(connStr);
Database db = asSrv.Databases["AWInternetSales2"];
Model m = db.Model;
db.Model.RequestRefresh(RefreshType.Full); // Mark the model for refresh
//m.RequestRefresh(RefreshType.Full); // Mark the model for refresh
m.Tables["Date"].RequestRefresh(RefreshType.Full); // Mark only one table for refresh
db.Model.SaveChanges(); //commit which will execute the refresh
asSrv.Disconnect();
}
catch (Exception e)
{
log.Info($"C# Timer trigger function exception: {e.ToString()}");
}
log.Info($"C# Timer trigger function finished at: {DateTime.Now}");
}
【问题讨论】:
标签: c# .net azure azure-analysis-services