LumDbEngine 1.3.1.1

dotnet add package LumDbEngine --version 1.3.1.1
                    
NuGet\Install-Package LumDbEngine -Version 1.3.1.1
                    
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="LumDbEngine" Version="1.3.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LumDbEngine" Version="1.3.1.1" />
                    
Directory.Packages.props
<PackageReference Include="LumDbEngine" />
                    
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 LumDbEngine --version 1.3.1.1
                    
#r "nuget: LumDbEngine, 1.3.1.1"
                    
#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.
#:package LumDbEngine@1.3.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LumDbEngine&version=1.3.1.1
                    
Install as a Cake Addin
#tool nuget:?package=LumDbEngine&version=1.3.1.1
                    
Install as a Cake Tool

LumDb V1.3.1

Demo

using LumDb;

class Program
{
  public class StudentInfo
  {
      public StudentInfo(){}

      public StudentInfo(string name, int age)
      {
          Name = name;
          Age = age;
      }

      [Id]
      public uint Id { get; set; }

      [Key]
      [Str32B]
      public string Name { get; set; } = "";

      public int Age { get; set; } = 0;
   }

    public class Student
    {
        public Student(){}

        public Student(string name, int age)
        {
            Name = name;
            Age = age;
        }

        public string Name { get; set; } = "";
        public int Age { get; set; } = 0;
    }

    static void Main()
    {
          // 1. Create database file and tables
        
           using (DbEngine engineCreate = new DbEngine("d:\\xxxxReflectorInsert.db", true))
            {
                engineCreate.TimeoutMilliseconds = 10000; // set timeout to 10 seconds

                using (var tsCreate = engineCreate.StartTransaction(0, false))
                {
                    tsCreate.Create<Student>(TableNameFirst);
                    tsCreate.Create<StudentInfo>(TableNameSecond);
                }
            }

            // 2. Open existing database and insert 100 records
            using DbEngine engine = new DbEngine("d:\\xxxxReflectorInsert.db");
            using (ITransaction transaction = engine.StartTransaction())
            {
                for (int index = 0; index < 100; index++)
                {
                    transaction.Insert(TableNameFirst, new Student("lj" + index.ToString(), index));
                    transaction.Insert(TableNameSecond, new StudentInfo(index.ToString() + "lj", index));
                }

                // ts.Dispose();  // manually committed.
                    // ts.Discard();
            } // transaction will be auto committed

            // 3. Query data
            using (ITransaction transactionQuery = engine.StartTransaction())
            {
                var result1 = transactionQuery.Find<Student>(TableNameFirst, o => o.Age > 98);

                foreach (var value in result1.Values)
                {
                    Console.WriteLine(value.Name + " " + value.Age.ToString());
                }

                var result2 = transactionQuery.Find(TableNameFirst, ("Age", o => ((int)o) < 2));

                foreach (var value in result2.Values)
                {
                    Console.WriteLine(value[0].ToString() + " " + value[1].ToString());
                }

                var result3 = transactionQuery.Find<StudentInfo>(TableNameSecond, o => o.Age % 17 == 0);

                foreach (var value in result3.Values)
                {
                    Console.WriteLine($"{value.Id}, {value.Name},{value.Age}");
                }
            }

            engine.SetDestoryOnDisposed();

            Console.WriteLine("All complete");
     }
}


Outputs:
lj99 99
lj0 0
lj1 1
1, 0lj,0
18, 17lj,17
35, 34lj,34
52, 51lj,51
69, 68lj,68
86, 85lj,85
All complete

Features

  • Performance**: LumDb delivers high performance with its efficient design.
  • Language**: 100% C# language, ensuring consistency and ease of integration with other C# projects.
  • Dependencies**: No external component libraries are required, making it lightweight and easy to deploy.
  • AOT Support**: Perfectly supports Ahead-of-Time compilation, enhancing startup performance and reducing runtime overhead.
  • Database Structure**: LumDb is a relational database that allows for custom multi-key patterns.
  • Data Types**: Supports various data types including int, double, long, bool, decimal, datetime, fixed-length string, variable-length string, fixed-length bytes, and variable-length bytes.
  • KV Database Simulation**: Can simulate a KV database and handle file operations based on byte values within tables.
  • Thread Safety**: Ensures safe read and write operations across threads.
  • Memory-based Transaction Model**: Supports early storage and discard/rollback operations.
  • Platform Support**: Currently supports .NET 8 and has been tested on Windows. It is theoretically cross-platform capable.

Getting Started

To get started with LumDb, please follow these simple steps:

  1. Installation: Since LumDb is a single-file database, there is no installation process. Simply reference the LumDb library in your .NET 8 project.
  2. Configuration: Configure your database schema according to your application's needs.
  3. Usage: Start using LumDb to manage your data with the provided API.

Contribution

We welcome contributions to LumDb. If you find any issues or have feature requests, please submit them through our issue tracker.

License

LumDb is licensed under the MIT License. See the LICENSE file for more information.


Please enjoy using LumDb and help us make it even better by providing feedback and contributions!

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.1.1 117 7/17/2025
1.3.1 116 7/17/2025
1.2.1 142 7/8/2025
1.1.4 214 3/7/2025
1.1.2 132 1/26/2025
1.1.1 107 1/22/2025
1.0.6 97 1/14/2025
1.0.5 102 1/13/2025
1.0.1 117 11/21/2024
1.0.0 107 11/16/2024

Add method for common class as entity.