welsonjs/WelsonJS.Augmented/WelsonJS.Esent
Namhyeon, Go fdabeab54f Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented
Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented
2025-12-14 18:54:32 +09:00
..
assets Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
Column.cs Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
EsentDatabase.cs Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
ICompatibleLogger.cs Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
LICENSE Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
README.md Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
Schema.cs Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
TraceLogger.cs Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00
WelsonJS.Esent.csproj Change the project name to WelsonJS.Toolkit to WelsonJS.Augmented 2025-12-14 18:54:32 +09:00

WelsonJS.Esent

WelsonJS.Esent is a library that enables the use of the ESENT database (also known as the Extensible Storage Engine or JET Blue).

Although it was developed to support the WelsonJS framework, it can be used in any .NET-based project.

For more details, refer to the WelsonJS Documentation.

Example code

using WelsonJS.Esent;

// connect the database to manage instances
Schema schema = new Schema("Instances", new List<Column>
{
    new Column("InstanceId", typeof(string), 255),
    new Column("FirstDeployTime", typeof(DateTime), 1)
});
schema.SetPrimaryKey("InstanceId");
_db = new EsentDatabase(schema, Path.GetTempPath());

// Insert row
try
{
    _db.Insert(new Dictionary<string, object>
    {
        ["InstanceId"] = instanceId,
        ["FirstDeployTime"] = now
    }, out _);
}
catch (Exception ex)
{
    // Handle exception
}

// find all
var instances = _db.FindAll();
foreach (var instance in instances)
{
    try
    {
        string instanceId = instance["InstanceId"].ToString();
        string firstDeployTime = instance.ContainsKey("FirstDeployTime")
            ? ((DateTime)instance["FirstDeployTime"]).ToString("yyyy-MM-dd HH:mm:ss")
            : "Unknown";

        Console.WriteLine($"{firstDeployTime}, {instanceId}");
    }
    catch (Exception ex)
    {
        // Handle exception
    }
}

Source code available: https://github.com/gnh1201/welsonjs