InterSystems.Data.IRISClient 2.5.0

Prefix Reserved
dotnet add package InterSystems.Data.IRISClient --version 2.5.0
                    
NuGet\Install-Package InterSystems.Data.IRISClient -Version 2.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InterSystems.Data.IRISClient" Version="2.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InterSystems.Data.IRISClient" Version="2.5.0" />
                    
Directory.Packages.props
<PackageReference Include="InterSystems.Data.IRISClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InterSystems.Data.IRISClient --version 2.5.0
                    
#r "nuget: InterSystems.Data.IRISClient, 2.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=InterSystems.Data.IRISClient&version=2.5.0
                    
Install InterSystems.Data.IRISClient as a Cake Addin
#tool nuget:?package=InterSystems.Data.IRISClient&version=2.5.0
                    
Install InterSystems.Data.IRISClient as a Cake Tool

IRISClient

IRISClient includes an ADO.NET driver that provides relational access to InterSystems IRIS. It also includes IRIS Native SDK that can be used to call ObjectScript classmethods and functions, manipulate ObjectScript class instances, and access globals.

Getting started

Install the package

Install the IRISClient library for .NET with NuGet

dotnet add package InterSystems.Data.IRISClient

The .nupkg file is distributed with IRIS under <IRIS install location>/dev/dotnet/bin/. Alternatively, the DLL files are also available under their corresponding versions and can be added as dependencies directly.

Prerequisites

You need an IRIS instance to interact with while using this package. The IRIS instance does not need to be on the same machine as the project using this package, but the project must be able to connect to the IRIS instance.

Examples

ADO.NET Driver

This is an example of code to connect to IRIS and execute SQL statements. Make sure to replace the connection information with values relevant to your system.

using InterSystems.Data.IRISClient;

string host = "localhost";
string port = "1972";
string username = "admin";
string password = "password";
string namespace = "USER";

string connectionString = $"Server = {host}; Port = {port}; Namespace = {nsp}; User ID = {username}; Password = {password}";
// Connect to IRIS 
using IRISConnection connection = new IRISConnection(connectionString);
connection.Open();

string statement1 = "CREATE TABLE People(ID int, FirstName varchar(255), LastName varchar(255))";
string statement2 = "INSERT INTO People VALUES (1, 'John', 'Smith')";
string statement3 = "INSERT INTO People VALUES (2, 'Jane', 'Doe')";
string queryText = "SELECT * FROM People";

using IRISCommand cmd1 = new IRISCommand(statement1, connection);
using IRISCommand cmd2 = new IRISCommand(statement2, connection);
using IRISCommand cmd3 = new IRISCommand(statement3, connection);
using IRISCommand cmd4 = new IRISCommand(queryText, connection);

// ExecuteNonQuery() is used for CREATE, INSERT, UPDATE, and DELETE
cmd1.ExecuteNonQuery();
cmd2.ExecuteNonQuery();
cmd3.ExecuteNonQuery();

// ExecuteReader() is used for SELECT
using IRISDataReader reader = cmd4.ExecuteReader();
Console.WriteLine("SELECT query results: ");
while (reader.Read())
{
    Console.WriteLine($"{reader.GetValue(0)}: {reader.GetValue(1)}, {reader.GetValue(2)}");
}

reader.Close();

Use Native SDK with ObjectScript Classes

This is an example of code to connect to IRIS and call ObjectScript class methods. This assumes the IRIS instance has a class, User.NativeTest, with a class method AreEqual and an instance method HaveBirthday.

string host = "localhost";
string port = "1972";
string username = "_SYSTEM";
string password = "SYS";
string nsp = "USER";

string connectionString = $"Server = {host}; Port = {port}; Namespace = {nsp}; User ID = {username}; Password = {password}";
// Establish a connection to IRIS
using IRISConnection connection = new IRISConnection(connectionString);
connection.Open();

// Use the connection to create an instance of the Native SDK
using IRIS iris = IRIS.CreateIRIS(connection);

// call a class method that tests if two values are equal
bool? areEqual = iris.ClassMethodBool("User.NativeTest", "AreEqual", 5, 7);
Console.WriteLine(areEqual);

// create a proxy object
using IRISObject obj = (IRISObject)iris.ClassMethodObject("User.NativeTest", "%New");

// set and get property values
obj.Set("name", "John Smith");
obj.Set("age", 30);

string name = obj.GetString("name");

// call instance method
obj.InvokeVoid("HaveBirthday");
long? age = obj.GetLong("age");

Console.WriteLine($"{name} is now {age} years old");

Use Native SDK with Globals

This is an example of interacting with globals in IRIS.

string host = "localhost";
string port = "1972";
string username = "_SYSTEM";
string password = "SYS";
string nsp = "USER";

string connectionString = $"Server = {host}; Port = {port}; Namespace = {nsp}; User ID = {username}; Password = {password}";
// Establish a connection to IRIS
using IRISConnection connection = new IRISConnection(connectionString);
connection.Open();

// Use the connection to create an instance of the Native SDK
using IRIS iris = IRIS.CreateIRIS(connection);

// set value of myGlobal to be myValue
iris.Set("myValue", "myGlobal");
// sets value of myGlobal at subscript to be 10
iris.Set(10, "myGlobal", "subscript");
// you can use an arbitrary number of subscripts, and they can be a string or number
iris.Set("abc", "myGlobal", 1, 2, 3);
iris.Set("xyz", "myGlobal", 1, 2, 3.5);
// modify a global value
iris.Set(15, "myGlobal", "subscript");

// get global values
string val1 = iris.GetString("myGlobal");
int? val2 = iris.GetInt32("myGlobal", "subscript");
string val3 = iris.GetString("myGlobal", 1, 2, 3);
string val4 = iris.GetString("myGlobal", 1, 2, 3.5);

Console.WriteLine($"^myGlobal = {val1}");
Console.WriteLine($"^myGlobal(\"subscript\") = {val2}");
Console.WriteLine($"^myGlobal(1, 2, 3) = {val3}");
Console.WriteLine($"^myGlobal(1, 2, 3.5) = {val4}");

// delete the global
iris.Kill("myGlobal");

Additional documentation

More information can be found in InterSystems ADO.NET Documentation and InterSystems Native SDK Documentation

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Framework net35 is compatible.  net40 was computed.  net403 is compatible.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0.30319

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on InterSystems.Data.IRISClient:

Package Downloads
ErpToolkit

Core functionalities for the ErpToolkit application.

InterSystems.Data.Document

InterSystems IRIS .NET Document

InterSystems.EntityFrameworkCore.Iris

InterSystems IRIS database provider for Entity Framework Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.0 291 2/20/2025
2.4.0 390 1/22/2025