0
我們如何使用C#代碼 與天青funcation應用 問候創造天藍分析服務分區, 馬尼什C#創建一個Azure的分析服務表格模型分區使用AMO
我們如何使用C#代碼 與天青funcation應用 問候創造天藍分析服務分區, 馬尼什C#創建一個Azure的分析服務表格模型分區使用AMO
您可以添加分區就像列
var ds = myDatabaseObject.Model.DataSources.Find("DW Connection");
ds.Model.Tables.Add(new Table
{
Name = "tablename",
Columns =
{
new DataColumn
{
Name = "Id",
DataType = DataType.Int64,
SourceColumn = "Id",
SourceProviderType = "BigInt",
IsUnique = true,
IsKey = true
},
new DataColumn
{
Name = "DateId",
DataType = DataType.DateTime,
SourceColumn = "DateId",
FormatString = "General Date",
SourceProviderType = "Date"
}
[...]
},
Partitions =
{
new Partition
{
Name = "Main",
DataView = DataViewType.Full,
Source = new QueryPartitionSource
{
DataSource = ds,
Query = query
}
}
[...]
}
});
添加或刪除分區也不是問題。例如,這是(或多或少)我使用了新的數據添加分區
var partitionName = $"name of partition you want to add";
var newDataPartition = new Partition
{
Name = partitionName,
DataView = DataViewType.Full,
Source = new QueryPartitionSource
{
DataSource = ds,
Query = "sql query here"
}
};
if (!table.Partitions.ContainsName(partitionName))
{
table.Partitions.Add(newDataPartition);
}
db.Update(UpdateOptions.ExpandFull);
table.Partitions[partitionName].RequestRefresh(RefreshType.Full);
table.Partitions["Main"].RequestMerge(new List<Partition> { table.Partitions[partitionName] });
db.Model.SaveChanges();
由於代碼很多關於更新現在我們需要使用Azure的功能應用來實現 – user3843858
喜,請分享全碼名空間它不適合我 – user3843858
我不能分享完整的代碼。 Azure分析服務需要可以使用表格對象模型兼容性爲1200或更高的dll。基本上你需要SQL Server 2016或更高版本的dll。查找Microsoft.AnalysisServices.AdomdClient.dll,Microsoft.AnalysisServices.Core.dll和Microsoft.AnalysisServices.Tabular.dll。 – RassaR