Skip to content

Commit

Permalink
Adds XMLA client using
Browse files Browse the repository at this point in the history
  • Loading branch information
stepurich committed Mar 19, 2019
1 parent 19f49ef commit 1e40cfe
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 12 deletions.
83 changes: 80 additions & 3 deletions README.md
@@ -1,13 +1,90 @@
# XMLA provider for a .NET Core OLAP client #
# XMLA provider for a .NET Core OLAP client

Provides data access to any OLAP servers that support XMLA protocol and can be accessed over an HTTP connection.
It is designed for development of an OLAP client in .NET Core applications that are completely independent of .NET Framework and therefore cannot use ADOMD.NET.

### Approved OLAP servers ###
## Connection
```csharp
var connection = new XmlaConnection("Data Source=http://localhost/OLAP/msmdpump.dll;Initial Catalog=AdventureWorksDW2012Multidimensional-SE");
```
### Open Connection
```csharp
connection.Open();
var sessionId = connection.SessionID;
```
### Close Connection
```csharp
connection.Close();
```
### Open Connection with SessionId
```csharp
var connection = new XmlaConnection("Data Source=http://localhost/OLAP/msmdpump.dll;Initial Catalog=AdventureWorksDW2012Multidimensional-SE");

connection.SessionID = sessionId;
connection.Open();
```
### Close Connection with SessionId

```csharp
var connection = new XmlaConnection("Data Source=http://localhost/OLAP/msmdpump.dll;Initial Catalog=AdventureWorksDW2012Multidimensional-SE");

connection.SessionID = sessionId;
connection.Close();
```
## Descover
```csharp
connection.Open();
var command = new XmlaCommand("MDSCHEMA_CUBES", connection);
SoapEnvelope result = command.Execute() as SoapEnvelope;
connection.Close();
```

### Cube Metadata
```csharp
connection.Open();
CubeDef cube = connection.Cubes.Find("Adventure Works");

KpiCollection kpis = cube.Kpis;
Property prop = kpis[0].Properties.Find("KPI_PARENT_KPI_NAME");

NamedSetCollection nsets = cube.NamedSets;

MeasureGroupCollection mgroups = cube.MeasureGroups;

MeasureCollection meas = cube.Measures;
prop = meas[0].Properties.Find("DEFAULT_FORMAT_STRING");

DimensionCollection dims = cube.Dimensions;
prop = dims[0].Properties.Find("DIMENSION_CARDINALITY");

HierarchyCollection hiers = dims[0].Hierarchies;
Hierarchy hier = cube.Dimensions.FindHierarchy("[Customer].[Customer Geography]");
prop = hier.Properties.Find("HIERARCHY_CARDINALITY");

LevelCollection levels = hiers[0].Levels;
prop = levels[0].Properties.Find("LEVEL_NUMBER");

MemberCollection members = levels[1].GetMembers();
MemberProperty prop = members[0].MemberProperties.Find("PARENT_UNIQUE_NAME");

ActionCollection acts = connection.GetActions("Adventure Works", "([Measures].[Internet Sales-Unit Price])", CoordinateType.Cell);

connection.Close();
```
## Execute CellSet
```csharp
connection.Open();
var mdx = "SELECT FROM [Analysis Services Tutorial] WHERE [Measures].[Internet Sales Count]";
var command = new XmlaCommand(mdx, connection);
CellSet cellset = null;
cellset = command.ExecuteCellSet();
connection.Close();
```
## Approved OLAP servers

* Microsoft Analysis Services (MD semantic model)
* Mondrian

### Requirements ###
## Requirements

* .NET Core 2.2
19 changes: 10 additions & 9 deletions tests/DiscoverTest.cs
Expand Up @@ -19,7 +19,7 @@ public void GetNamedSets()

CubeDef cube = TestHelper.GetCube(connection);

var nsets = cube.NamedSets;
NamedSetCollection nsets = cube.NamedSets;

connection.Close();

Expand Down Expand Up @@ -49,19 +49,20 @@ public void FindMemberProperty()

CubeDef cube = TestHelper.GetCube(connection);

var kpis = cube.Kpis;
KpiCollection kpis = cube.Kpis;

var meas = cube.Measures;
MeasureCollection meas = cube.Measures;

DimensionCollection dims = cube.Dimensions;

var dims = cube.Dimensions;
HierarchyCollection hiers = dims[0].Hierarchies;

var hiers = dims[0].Hierarchies;
LevelCollection levels = hiers[0].Levels;

var levels = hiers[0].Levels;
MemberCollection members = levels[1].GetMembers();

MemberProperty prop = members[0].MemberProperties.Find("PARENT_UNIQUE_NAME");

var members = levels[1].GetMembers();
var prop = members[0].MemberProperties.Find("PARENT_UNIQUE_NAME");
Assert.IsTrue(!string.IsNullOrEmpty(prop.Value.ToString()));

connection.Close();
Expand Down Expand Up @@ -128,7 +129,7 @@ public void GetMeasureGroups()

CubeDef cube = TestHelper.GetCube(connection);

var mgroups = cube.MeasureGroups;
MeasureGroupCollection mgroups = cube.MeasureGroups;

connection.Close();

Expand Down
4 changes: 4 additions & 0 deletions tests/UnitTest.XmlaClient.NetCore.csproj
Expand Up @@ -12,6 +12,10 @@
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\XmlaClient.NetCore.csproj" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
Expand Down

0 comments on commit 1e40cfe

Please sign in to comment.