Assembly of FastCube.Core for .NET 5.0

2021-05-10

Today, such analytical tools as OLAP cubes are extremely demanded. Fast Report possesses such a system and allows displaying data cubes with slices in .NET applications, for example in NET 5.0. Now we will discuss how to use it in your reports.

To use the FastCube.Core libraries, one has to preliminarily assemble them from the source codes. To assemble FastCube.Core for .NET 5.0, use the FastCube.Core.sln solution.

After starting this solution, change the target operating environment for .NET 5.0. Then assemble the project; you will see FastCube.Core.2020.2.1.nupkg in our work directory. Place this package to the folder which you will use as a local source of packages.

Now we can start creating the .NET Core project.

First of all, add the FastCube.Core library to the created project. To do that, use the NuGet package manager. As the packages of libraries are placed on the local disc, we will have to add the local source of packages. Click a gear icon in the upper right corner of the package manager and add a new source, which will refer to the local folder with your nupkg packages:

Adding a new source

At this stage, you may select the added source in a dropdown list and set the packages:

Setting the packages

We have added a library to the project, now it should be connected by writing in the file .cs:

using FastReport.Olap

To check how it works, use the following code:

class Program
 {
 private static string FindDataFolder()
 {
 string dataFolder = "";
 string thisFolder = Config.ApplicationFolder;
 
 for (int i = 0; i < 6; i++)
 {
 string dir = Path.Combine(thisFolder, "Data");
 if (Directory.Exists(dir))
 {
 string data_dir = Path.GetFullPath(dir);
 if (File.Exists(Path.Combine(data_dir, "config.xml")))
 {
 dataFolder = data_dir;
 break;
 }
 }
 thisFolder += ".." + Path.DirectorySeparatorChar;
 }
 
 if (dataFolder == "")
 {
 thisFolder = Config.ApplicationFolder;
 for (int i = 0; i < 6; i++)
 {
 string dir = Path.Combine(thisFolder, "Demos", "Data");
 if (Directory.Exists(dir))
 {
 string data_dir = Path.GetFullPath(dir);
 if (File.Exists(Path.Combine(data_dir, "config.xml")))
 {
 dataFolder = data_dir;
 break;
 }
 }
 thisFolder += ".." + Path.DirectorySeparatorChar;
 }
 }
 
 if (dataFolder == "")
 throw new Exception("Could not locate the Data folder.");
 return dataFolder;
 }
 
 static void Main(string[] args)
 {
 string dataFolder = FindDataFolder();
 // create cube and slice
 Cube cube = new Cube();
 Slice cubeSlice = new Slice();
 cubeSlice.Cube = cube;
 // load cube
 cube.Load(Path.Combine(dataFolder, "Cubes", "2_0_sample_en1.mdc"));
 // open cube
 cube.Active = true;
 // export slice
 HTMLExport export = new HTMLExport();
 export.Slice = cubeSlice;
 export.Export(Path.Combine(Config.ApplicationFolder, "export.html"));
 }
 }
}

After that, in the directory of our application we will see a file of .html format. Open it in any editor and get the following:

Export to .html

Thus, we have viewed using the FastCube.Core library in a console application. As one can see, the library works perfectly with NET 5.0. Now you can use data cubes in your applications.

October 28, 2024

How to Set Up WSL 2 for Working with FastReport and FastCube

In this article, we will explore how to set up WSL 2 for working with FastReport and FastCube components in Lazarus for Linux.
October 04, 2023

How to generate a report from an ASP.NET Core application using FastReport.Core.Skia

We tell you how to generate a report on Windows and Linux using FastReport.Core.Skia and a private NuGet server.
September 26, 2023

Installing FastReport and FastCube components in Lazarus

Instructions for installing FastReport in Lazarus for various operating systems with a comparison of Trial, Professional editions.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2024 Fast Reports Inc.