How to Set Up a Connection to Apache Ignite in FastReport .NET

2025-04-08

How to Set Up a Connection to Apache Ignite in FastReport .NET

 

Apache Ignite is a distributed in-memory computing platform that enables the processing and storage of large volumes of data in memory to achieve high performance and scalability.

In this article, we will explore how to configure a connection to Apache Ignite in FastReport .NET. You will learn the necessary steps to connect the plugin via code and the report designer. By following our recommendations, you will be able to effectively use Apache Ignite as a data source for your reports in FastReport .NET.

The implemented plugin for connecting to Apache Ignite is a lightweight solution based on the Ignite.NET Thin Client.

 


 

Apache Ignite Plugin Features

  • Connection to Apache Ignite clusters: The plugin allows you to connect to one or more nodes in the cluster. The node addresses are specified in the host:port format, separated by commas.
  • Working with caches: It supports interaction with caches in both key-value mode and as SQL tables.
  • Authentication: The plugin supports authentication if the authenticationEnabled option is enabled in the cluster configuration.
  • Handling various data types: The plugin ensures proper handling of different data types, including custom objects.

 


 

Features of Apache Ignite Implementation

Ignite offers two ways to logically represent data: key-value caches and SQL tables (schemas). Despite the differences, these representations are equivalent and can reflect the same data.

In Ignite, an SQL table and a key-value cache are two equivalent ways of representing the same internal data structure. Access to the data can be obtained through the key-value API, SQL operators, or both methods.

A cache is a collection of key-value pairs, accessed through the key-value API. An SQL table in Ignite is similar to tables in traditional database management systems, but with some additional constraints. For example, each SQL table must have a primary key.

A table with a primary key can be represented as a key-value cache, where the primary key column acts as the key, and the other columns in the table are the fields of the object (value).

Features of Apache Ignite Implementation

 

The main difference between these two data representations lies in the method of accessing them. With a key-value cache, you can work with objects using supported programming languages. SQL tables, on the other hand, support standard SQL syntax, which can be beneficial, for example, when migrating data from an existing database.

 


 

How to Connect the Plugin in Your Project

To use the plugin, you must first build the project located at:  ..\Extras\Core\FastReport.Data\FastReport.Data.Ignite. After that, the plugin needs to be registered. This can be done in two ways.

Method 1. Using Code.

Copy the following code and paste it into your project. This needs to be done only once when starting the application.

FastReport.Utils.RegisteredObjects.AddConnection(typeof(IgniteDataConnection));


Method 2. Using the Report Designer.
 
To connect the connector in the designer, go to the "File|Settings..." menu in the Ribbon interface (or "View|Settings..." in the standard interface). In the opened window, select the "Plugins" tab and add the built .dll of the plugin as shown below.

Window for Plugin Connection Through the Report Designer

 

After adding the plugin, it is necessary to restart the FastReport .NET designer.

 


 

How to Connect a Data Source in the Designer

To create a connection to Apache Ignite, go to the "Data" menu and select "Add Data Source."  

Add Data Source

 

In the opened window, click on the "New Connection" button, then from the dropdown list of connection types, select the option " Apache Ignite Connection." In the window that appears, specify the address(es) of the nodes, as well as the username and password (if required).

Configuring the Apache Ignite Connection

 

If the connection is successful, the next step will display a list of tables (caches) contained in the nodes specified in the previous step:

Data Connection Wizard

 


 

Differences When Working with Caches in the Plugin

The plugin supports working with caches that are created both as key-value pairs and as SQL tables.

The method of creating and configuring a cache in Apache Ignite directly impacts the composition of fields and the representation of data types. Depending on the chosen method (for example, using classes with the [QuerySqlField] attributes, programmatic definition via QueryEntity, or working with dynamic data), the result may vary. This concerns both the list of available fields and their data types.

The following code examples will use snippets from the official Apache Ignite functionality examples. These examples can be downloaded from this link in the BINARY RELEASES section:  https://ignite.apache.org/download.cgi

Let’s open the downloaded archive and navigate to the following folder:

..\apache-ignite-2.17.0-bin\platforms\dotnet\examples\Thin

From these examples, we will use the custom class Organization, which represents the data model of an organization. This class contains the following properties:

  • Name: The name of the organization. It is marked with the [QuerySqlField(IsIndexed = true)] attribute, which allows it to be used in SQL queries and creates an index to speed up searches.
  • Address: The address of the organization, represented as a nested object of type Address. This is also available for SQL queries due to the [QuerySqlField] attribute.
  • Type: The type of organization (e.g., commercial or non-profit), represented by the enumeration OrganizationType.
  • LastUpdated: A timestamp indicating when the organization's data was last updated.

The complete code for the class can be found in the folder:

..\apache-ignite-2.17.0-bin\platforms\dotnet\examples\Shared\Models

 


 

Creating a Cache Using QueryEntity

QueryEntity is an Apache Ignite component that allows you to programmatically define the data structure (schema) for a cache and manually specify the fields along with their types.

For caches with metadata (QueryEntity), operations for retrieving the list of fields and their data types are supported. Custom data types are handled in the following manner:

  • The list of fields displays only the fields marked with the [QuerySqlField] attribute.
  • Fields are presented in the format data_type.field_name. 

For example, if the cache is created during the setup as follows:

var organizationCache = ignite.GetOrCreateCache<int, Organization>( new CacheClientConfiguration("dotnet_cache_query_organization", new QueryEntity(typeof(int), typeof(Organization))));

Then, when connecting to an already prepared instance of Apache Ignite in FastReport, the list of fields will include only those fields from the Organization class that are marked with the  [QuerySqlField] attribute.

Fields With the [QuerySqlField] Attribute

 

However, when viewing the data, all fields from the cache will be displayed:

Displaying All Fields

 


Creating a Cache Without QueryEntity  

If the cache is created during the setup without using QueryEntity, then the data types of all fields will be defined as string. Example code:  

ICacheClient<int, Organization> cache = ignite.GetCache<int, Organization>("dotnet_cache_put_get");

In the list of fields, all available fields will be displayed, regardless of the presence of the [QuerySqlField] attribute. This is the second method of creating a cache.

Displaying All Available Fields Even Without the [QuerySqlField] Attribute

 


 

Working with Caches Created as SQL Tables

Finally, let's consider the third method of working with caches. Here is an example of creating and populating a cache as an SQL table:

cache.Query(new SqlFieldsQuery(
 "CREATE TABLE IF NOT EXISTS city (id LONG PRIMARY KEY, name VARCHAR)  
WITH \"template=replicated\"")).GetAll();
  const string addCity = "INSERT INTO city (id, name) VALUES (?, ?)"; cache.Query(new SqlFieldsQuery(addCity, 1L, "Forest Hill")); cache.Query(new SqlFieldsQuery(addCity, 2L, "Denver")); cache.Query(new SqlFieldsQuery(addCity, 3L, "St. Petersburg"));

For such caches, the metadata (QueryEntity) contains information about the data types for each field.

List of Fields in the City Cache

Displaying Data from the City Cache

 

In an Apache Ignite cache, data may be stored without explicitly defined field names. For example:

 var cache = ignite.GetOrCreateCache<int, object>("put-get-example");
 
 int key = 1;
 var val = new Address("1545 Jackson Street", 94612);
 cache.Put(key, val);
 
 int key1 = 2;
 var val1 = 942.28956;
 cache.Put(key1, val1);
 
 int key2 = 3;
 var val2 = "test String";
 cache.Put(key2, val2);

When connecting to an instance of Apache Ignite in FastReport (with the code from the example above), you will see the following result.

List of Fields in The Cache Created as Key-value.

In this example:

  • The fields Street and Zip from the custom class Address have names, as they are defined in the structure of the class.
  • Values such as the number 942.28956 or the string "test String" do not have names, as they are added to the cache as simple key-value objects.

For fields that lack a name, unique identifiers are generated.

Unique Field Name

 


 

Conclusion

We’ve covered how to set up a connection to Apache Ignite in FastReport .NET. By following the steps outlined, you’ll be able to integrate these systems and take full advantage of Apache Ignite as a data source for your reports.

Apache Ignite provides fast data access and processing, while FastReport .NET enables the creation of powerful reports. Their integration opens up new opportunities for data analysis and visualization.

We hope this article has been helpful and will assist you in effectively using Apache Ignite in your projects with FastReport .NET.

.NET FastReport Data Source SQL Report Plugin
April 08, 2025

Converter from Microsoft Word (.docx) format to FastReport .NET (.frx) file

A converter from Microsoft Word (.docx) format to a file FastReport .NET (.frx): description and instructions for using the tool.
March 25, 2025

How to Merge Multiple Reports into One in FastReport .NET

FastReport .NET is a powerful tool for creating and managing reports. In this article, we will look at how to combine multiple reports into one in FastReport .NET.
February 20, 2025

Using Dot Matrix Printers for Printing Receipts

This article will explore how to integrate a dot matrix printer into the process of creating and outputting reports using FastReport .NET.
Fast Reports
  • 800-985-8986 (English, US)
  • +31 97 01025-8466 (English, EU)
  • +49 30 56837-3928 (German, DE)
  • +55 19 98147-8148 (Portuguese, BR)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2025 Fast Reports Inc.