Autor Beitrag
GeraldVonRiva
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19
Erhaltene Danke: 2



BeitragVerfasst: Do 28.07.16 11:10 
Hallo,

ich versuche gerade über die Microsoft.AnalysisServices.dll einem exeistierenden Measure eine Partition hinzuzufügen. Der Code läuft auch fehlerfrei durch aber leider erscheint die Partition nicht im SQL-Management-Studio. Hat jemand einen Tipp woran es liegen könnte. Nachfolgend mein Code zur Erstellung der Partition.

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
using ssas = Microsoft.AnalysisServices;

ssas.Partition AsPartition = null;

try
{

 ssas.QueryBinding sql_source_query = new Microsoft.AnalysisServices.QueryBinding(datasoure, xmla_query);

 ssas.ProactiveCaching as_pr_caching = new Microsoft.AnalysisServices.ProactiveCaching();

 as_pr_caching.SilenceInterval = TimeSpan.FromSeconds(-1);

 as_pr_caching.Latency = TimeSpan.FromSeconds(-1);

 as_pr_caching.SilenceOverrideInterval = TimeSpan.FromSeconds(-1);

 as_pr_caching.ForceRebuildInterval = TimeSpan.FromSeconds(-1);

 as_pr_caching.Source = new ssas.ProactiveCachingInheritedBinding();

 AsPartition = new Microsoft.AnalysisServices.Partition(partition_name);

 AsPartition.ID = partition_name;

 AsPartition.DataSource.Name = datasoure;

 AsPartition.DataSource.ID = datasoure;

 AsPartition.Source = sql_source_query;

 AsPartition.StorageMode = Microsoft.AnalysisServices.StorageMode.Molap;

 AsPartition.ProcessingMode = Microsoft.AnalysisServices.ProcessingMode.Regular;

 AsPartition.ProactiveCaching = as_pr_caching;

 AsPartition.Update(ssas.UpdateOptions.ExpandFull);

}


Code zum einfügen der erstellten Partition in die DB

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
ssas.Server AsServer = null;
ssas.MeasureGroup AsMeasure = null;

try
{

 AsServer = new Microsoft.AnalysisServices.Server();

 AsServer.Connect(this.OlapConnectionString);
 
 AsMeasure = AsServer.Databases.Find(olap_db).Cubes.Find(cube_id).MeasureGroups.Find(measure_id);

 AsMeasure.Partitions.Add(AsPartition);

}


Es gibt keinen Fehler, nur leider taucht die Partition nicht nach einer Aktualisierung im SQL-Management-Studio auf. Die Datenbank, Cube, Measure sowie DataSource sind vorhanden.

mfg

Gerald
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 28.07.16 12:56 
Hallo,

ich tippe darauf, daß dir noch
ausblenden C#-Quelltext
1:
AsMeasure.Submit();					

fehlt.

Für diesen Beitrag haben gedankt: GeraldVonRiva
GeraldVonRiva Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19
Erhaltene Danke: 2



BeitragVerfasst: Do 28.07.16 13:51 
Hallo,

Danke erstmal das hab ich völlig vergessen. Hatte schon mit Update getestet aber Submit völlig vergessen. Leider bekomme ich jetzt eine Fehlermeldung

"error with XMLA-Query or DB-Connection System.InvalidOperationException: In der Microsoft.AnalysisServices.MeasureGroup-Auflistung können keine neuen Elemente erstellt werden."

wo ich gerade etwas verwirrt drüber bin und nicht wirklich verstehe was ich ändern müsste.
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 28.07.16 15:32 
Ich fange zwar nicht viel mit dem Source-Code an, aber vllt. kannst du dich da mal durchwühlen: How to partition Cube – using C# (Stichwort: CreatePartition)

Für diesen Beitrag haben gedankt: GeraldVonRiva
GeraldVonRiva Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19
Erhaltene Danke: 2



BeitragVerfasst: Fr 29.07.16 07:05 
Hallo

user profile iconTh69 hat folgendes geschrieben Zum zitierten Posting springen:
Ich fange zwar nicht viel mit dem Source-Code an, aber vllt. kannst du dich da mal durchwühlen: How to partition Cube – using C# (Stichwort: CreatePartition)


Das Codebeispiel habe ich gestern auch gefunden und werde es mir bei Zeit zur Gemüte führen. Da jedoch eine schnelle Lösung benötigt wurde, wird die Partition nun erstmal über eine Query im "XMLA-Format", welche über den "Microsoft AdomdClient an die Datenbank geschickt wird, erzeugt. Dies Funktioniert problemlos.

Sollte ich die erste Herangehensweise zu einer Lösung führen, werde ich diese hier Mitteilen.

Vielen Dank für die Tipps.

Gerald