查找

文章
· 十二月 9 阅读大约需 4 分钟

Scripting com .Net Core 10 e IRIS SDK

Um dos recursos mais recentes do .Net Core 10 com C# 14 são os aplicativos baseados em arquivo. Este recurso permite que você execute código C# em um arquivo .cs simples, sem a necessidade de criar uma solution, um projeto ou qualquer uma das estruturas relacionadas.

Por exemplo, você pode criar um arquivo script.cs usando o bloco de notas com o seguinte conteúdo:

Console.WriteLine(“This is a script in c#.”);

Então, na linha de comando ou no terminal, você executa o comando:

dotnet run script.cs

Há muitas informações sobre este novo recurso do .Net 10. Para trabalhar com o IRIS, podemos usar a opção de adicionar referências de pacotes NuGet diretamente dentro do arquivo. Por exemplo, para adicionar o nuget para InterSystems IRIS, você inclui as seguintes linhas no topo:

#:package InterSystems.Data.IRISClient@2.5.0 

using InterSystems.Data.IRISClient;
using InterSystems.Data.IRISClient.ADO;

Isso permite que o arquivo inclua o pacote NuGet do IRIS e use o IRIS SDK. Por exemplo, abaixo está um arquivo .cs com um script para verificar o status de uma produção de Interoperabilidade do InterSystems:

#:package InterSystems.Data.IRISClient@2.5.0

using InterSystems.Data.IRISClient;
using InterSystems.Data.IRISClient.ADO;

// Este script espera o namespace para conectar
string irisNamespace = string.Empty;
if (args.Length > 0)
{
    irisNamespace = args[0];
}

if (string.IsNullOrEmpty(irisNamespace))
{
    Console.WriteLine("Please indicate the namespace to connect");
    return;
}

// Abre uma conexão com o InterSystems IRIS
IRISConnection conn;
IRIS iris;

try
{
    conn = new IRISConnection();
    conn.ConnectionString = $"Server = 127.0.0.1;Port = 1972; Namespace = {irisNamespace.ToUpper()}; Password = SYS; User ID = _system;";
    conn.Open();
    iris = IRIS.CreateIRIS(conn);
}
catch (Exception ex)
{
    Console.WriteLine($"Cannot connect to the interoperability server. Error message: {ex.Message} ");
    return;
}

try
{

    bool? isInteroperabilityEnabledNamespace = iris.ClassMethodBool("%Library.EnsembleMgr", "IsEnsembleNamespace");
    if (isInteroperabilityEnabledNamespace ?? false)
    {
        // Os valores válidos são especificados na documentação
        //https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=ENSLIB&CLASSNAME=Ens.Director#METHOD_GetProductionStatus
        // E os valores numéricos podem ser encontrados no arquivo de inclusão EnsConstants.inc
        Func<decimal, string> GetStateDescription = state => state switch
        {
            0 => "Unknown",
            1 => "Running",
            2 => "Stopped",
            3 => "Suspended",
            4 => "Troubled",
            5 => "Network stopped",
            _ => "Unknown state"
        };
        string currentInteroperabilityProduction = string.Empty;
        decimal currentInteroperabilityProductionState = 0;

        IRISReference currentProductionName = new IRISReference("");
        IRISReference currentProductionState = new IRISReference("");

        var status = iris.ClassMethodObject("Ens.Director", "GetProductionStatus", currentProductionName, currentProductionState, 2, 1);

        if (status.ToString() == "1")
        {
            currentInteroperabilityProduction = currentProductionName.GetValue()?.ToString() ?? "";
            currentInteroperabilityProductionState = currentProductionState.GetDecimal() ?? 0;
        }
        if (string.IsNullOrEmpty(currentInteroperabilityProduction))
        {
            // Caso a produção esteja parada, a chamada a GetProductionStatus não retorna o nome da produção
            // neste caso tentamos obter o nome da produção ativa
            currentInteroperabilityProduction = iris.ClassMethodString("Ens.Director", "GetActiveProductionName");
        }

        Console.WriteLine($"Produção ativa neste namespace: {currentInteroperabilityProduction}");

        Console.WriteLine($"Estado da Produção: {GetStateDescription(currentInteroperabilityProductionState)}");

    }
    else
    {
        Console.WriteLine("O namespace não está habilitado para interoperabilidade");
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Erro ao verificar o estado da produção no namespace{irisNamespace}:{ex.Message}");
}
finally
{
    iris.Dispose();
    conn.Close();
    conn.Dispose();
}

A execução deste arquivo com o parâmetro indicando o namespace no qual você deseja verificar o status da produção irá verificar se há alguma produção no namespace e seu status atual:

PS C:\IrisScripting> dotnet run ScriptTest.cs INTBUS
Produção ativa neste namespace: Integrations BUS
Estado da produção: Running
PS C:\IrisScripting>

Este novo recurso abre uma maneira nova e interessante de executar scripts ou pequenos programas para automatizar tarefas a partir da linha de comando.

讨论 (0)1
登录或注册以继续
摘要
· 十二月 9

Happy 10th Anniversary to the Developer Community

Dear Developer Community Member,

We'd like to congratulate you on the

🎉 10th Anniversary of the Developer Community! 🎉

This milestone marks ten incredible years of growth, collaboration, and shared discovery. And you have been an important part of that journey. Whether you’ve been part of the Community from the beginning or joined along the way, your presence has helped shape what the Developer Community is today.

Your articles, answers, ideas, projects, and conversations have created a dynamic space where developers learn from each other, tackle challenges together, and explore what can be achieved with InterSystems technologies. Your enthusiasm, expertise, and willingness to support others are what make this community truly special.

Here’s to the past decade and to many more years of building, learning, and innovating together. Thank you for being an essential part of this journey.

Visit the anniversary announcement to celebrate with your fellow members and share your birthday wishes for the Developer Community!

Warmest wishes,
The Developer Community Team

问题
· 十二月 9

Buy Ozempic Online -Safe Shipping Guaranteed Worldwide

Buy Ozempic For Weight Loss Online USA,UK,CA - Safe Shipping Guaranteed USA,UK,CA- WhatsApp:+49163 0405954 - Website: www.eazmeds.com - Email: info@eazmeds.com

Eaz Meds USA,UK,CA is a trusted USA,UK,CA-based provider of high-quality wellness, personal care, and lifestyle products. We offer a wide range of solutions including pain relief, focus support, sleep aids, weight-management items, skincare essentials, and more.
We provide fast, discreet delivery across the United Kingdom and Europe, with customer satisfaction as our top priority. Browse our collection today and experience professional service, reliable shipping, and premium products from a supplier you can trust.
Treatments for Pain, ADD / ADHD , Erectile Dysfunction, Sleeping, Weight Loss, Urinary Tract Infection, STI Treatment, Hair loss Treatment, Low Fertility Treatment, Benzodiazepines & Skin Care Product all available at www.eazmeds.com

讨论 (0)1
登录或注册以继续
文章
· 十二月 9 阅读大约需 4 分钟

IRIS IO Utility: A Complete Guide to Smart Importing in VS Code

Hello Community! 👋
Welcome to the second part of the IRIS IO Utility series. This extension represents my submission for the InterSystems "Bringing Ideas to Reality" Contest 2025 and offers you an intuitive and powerful interface for importing and exporting data directly inside VS Code.

If you find this extension useful, please consider voting for me at the contest!


In the previous article, we covered:

  • Extension overview
  • ODBC driver configuration
  • Export capabilities

Now it’s time to dive into the Import Engine — designed to support:

  • CSV
  • TXT (with any delimiter)
  • JSON
  • XLSX

The extension features a smart inference layer that analyzes the input file and automatically suggests the optimal IRIS table data formats, providing guided, assisted data modeling.


Import Modes — Two Distinct Workflows

The extension supports two distinct scenarios:

  • Create New Table
  • Load into Existing Table

Option A — Import to New Table

This is ideal when:

  • You’re loading a new dataset
  • You want a clean start, with a fresh table and schema
  • You’re in a prototyping or exploratory phase

What happens:

  • The extension reads the file’s data and infers column types automatically
  • You can customize the types if needed
  • You choose a schema and table name
  • You optionally define indexes
  • Then data gets imported — all in a safe, atomic operation

Option B — Import into Existing Table

Perfect for:

  • Updating a table
  • Adding new rows
  • Replacing outdated data

Two actions are available:

  • Append — simply adds new rows from the file
  • Replace — clears the current table data and replaces it with the new data

Before importing, the extension validates that the file’s columns match the target table’s structure. If there are mismatches, it will notify you and abort — protecting you from schema drift or data corruption.


Creating a new table by the IRIS IO utility

Step 1 — Open the Import View and select a file

After connecting to an IRIS instance:

  1. Click the cloud-up arrow icon
  2. Click on the "Create New Table" tab
  3. Choose the file to import

Supported formats are CSV, JSON, TXT and XLSX.

Step 2 — File Analysis & Type Inference

After loading a file, the import engine automatically:

  • Samples the file’s values to guess column types
  • Determines the most likely SQL types
  • Converts them to valid IRIS SQL types
  • Shows sample data beneath each column 
  • Lets you manually override the type if needed

Detected types include:

  • INTEGER
  • BIGINT
  • NUMERIC
  • DOUBLE
  • VARCHAR (255 or 4000 characters)
  • CLOB
  • DATE
  • TIMESTAMP
  • BIT

The result of the analysis is shown in the "Column Type Mapping" section at the bottom of the import webview.

You can change the data type and look at a sample of the data:

Step 3 — Create custom indexes

The extension supports index creation while creating a new table. 

For each column, you can:

  • Check an “Index” checkbox if you know you’ll often query or filter by that column
  • Select index type. Available types are:
    • INDEX
    • BITSLICE
    • BITMAP
    • COLUMNAR (IRIS Analytics)
  • You can edit the index name — if left empty, the extension auto-generates one
  • You can specify if index is unique
  • You can specify if a field should act as a primary key for the new table

Step 4 — Select Schema

When selecting a schema for the new table, you can choose to use a previously existing schema or to create a new schema.

When using a previously existing schema:

  • You can either specify a schema filter (optional) or just hitting the "Load Schemas" button to load all the available schemas within the selected namespace. 

When creating a new schema:

  • You can specify a new schema name in the format MySchemaName_SubSchemaName

Step 5 — Select Table Name

Once schema has been selected, you can specify a new table name. If a table with the same schema and table name already exists, the import will be aborted to prevent accidental overwriting.

Step 6 — Create Table & Import

Click on the Create button to create a new table and import data. 

The extension logs progress in the Output panel, and shows a popup notification when done. 


Loading data into an existing table by the IRIS IO utility

To inject new data into an existing table:

  1. Switch to the “Load into Existing Table” tab
  2. Select your file
  3. Choose target schema and table name
  4. Select import action: Append or Replace

The extension validates that the file’s columns align with the existing table schema and aborts if there are mismatches — safeguarding your data integrity.


Special case of TXT files: define the correct delimiter

When importing TXT files, the extension allows you to specify a custom delimiter to ensure the file is parsed correctly. This is especially useful when working with unconventional separators such as pipes (|), semicolons (;), tabs, or multi-character delimiters. Selecting the correct delimiter guarantees proper column detection and prevents misaligned or corrupted data during the import process.


Final Thoughts

The Import engine transforms IRIS IO Utility from a simple helper into a real data engineering tool.

It handles:

  • Type inference
  • Schema building
  • Index creation
  • Data loading
  • Diagnostic logging

All inside VS Code — clean, discoverable, and convenient.

Together with the Export engine, IRIS IO Utility provides a complete, modern, developer-friendly IO workflow for InterSystems IRIS.

If you enjoyed this feature and find IRIS IO Utility useful, please vote for it in the InterSystems Contest!🚀

2 条新评论
讨论 (2)2
登录或注册以继续
公告
· 十二月 9

¡La Comunidad de Desarrolladores cumple 10 años!

Hola Comunidad:

El 7 de diciembre de 2025, la Comunidad de Desarrolladores de InterSystems celebró oficialmente su décimo aniversario. 🥳🎉

Y ahora rendimos homenaje a esta década de aprendizaje, colaboración, resolución de problemas y avance de las tecnologías de InterSystems. Tanto si habéis estado aquí desde el principio como si os habéis unido recientemente, gracias por vuestras contribuciones, preguntas, ideas y apoyo. Este logro os pertenece a todos vosotros 💖. Habéis construido esta comunidad hasta lo que es hoy, y estamos realmente agradecidos.

Como parte de la celebración, os invitamos a participar en un vídeo especial de aniversario. Y vaya si cumplisteis. Gracias a todos los que dedicasteis tiempo a compartir vuestros saludos, recuerdos y palabras amables.

¡Por otros 10 años más de innovación y colaboración! 💙

PD: Dejad un comentario si os habéis visto en los vídeos de recurso 😉


Permaneced atentos: esto es solo el comienzo. Muy pronto llegarán más momentos destacados y sorpresas del aniversario.

讨论 (0)1
登录或注册以继续