Ignite Quick Start Guide for .NET/C# | Ignite Documentation

Ignite Summit 2024 — Call For Speakers Now Open — Learn more

Edit

Ignite Quick Start Guide for .NET/C#

This chapter explains how to use .NET Core to build and run a simple Hello World example in .NET that starts a node, puts a value into the node and then gets the value.

Prerequisites

Ignite.NET was officially tested on:

JDK

Oracle JDK 8, 11 or 17, Open JDK 8, 11 or 17, IBM JDK 8, 11 or 17

.NET Framework

.NET 4.0+, .NET Core 2.0+

Running a Simple .NET Example

Note

Ignite for .NET supports a thick client and a thin client. Because this guide focuses on the thick client, you can run the example below after adding the Ignite library package. You do not need to download and install the Ignite distribution to run the example.

For information about the .NET thin client, see .NET Thin Client.

  1. Install .NET Core SDK (version 2+): https://dotnet.microsoft.com/download

  2. Use the CLI (unix shell, Windows CMD or PowerShell, etc.) to run the following two commands:

    > dotnet new console

    This creates an empty project, which includes a project file with metadata and a .cs file with code.

    And:

    > dotnet add package Apache.Ignite

    This modifies the project file - .csproj - to add dependencies.

  3. Open Program.cs in any text editor and replace the contents with the following:

    using System;
    using Apache.Ignite.Core;
    
    namespace  IgniteTest
    {
        class Program
        {
            static void Main(string[] args)
            {
              var ignite = Ignition.Start();
              var cache = ignite.GetOrCreateCache<int, string>("my-cache");
              cache.Put(1, "Hello, World");
              Console.WriteLine(cache.Get(1));
            }
        }
    }
  4. Save and then run the program:

    > dotnet run

And that’s it! You should see a node launch and then display "Hello, World".

Next Steps

From here, you may want to:

  • Check out the .NET thin client that provides a lightweight form of connectivity to Ignite clusters

  • Explore the additional examples included with Ignite

  • Refer to the NET-specific section of the documentation to learn more about capabilities that are available for C# and .NET applications.