• Stars
    star
    228
  • Rank 169,512 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 11 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NMemory is a lightweight non-persistent in-memory relational database engine that is purely written in C# and can be hosted by .NET applications.

Library Powered By

This library is powered by Entity Framework Extensions

Entity Framework Extensions

What's NMemory?

NMemory is a lightweight non-persistent in-memory relational database engine that is purely written in C# and can be hosted by .NET applications. It supports traditional database features like indexes, foreign key relations, transaction handling and isolation, stored procedures, query optimization.

Getting started

public class Person
{
    public int Id { get; set; }

    public string Name { get; set; }
}

public class Group
{
    public int Id { get; set; }

    public string Name { get; set; }
}

public class MyDatabase : Database
{
    public MyDatabase()
    {
        var peopleTable = base.Tables.Create<Person, int>(p => p.Id);
        var groupTable = base.Tables.Create<Group, int>(g => g.Id);

        var peopleGroupIdIndex = peopleTable.CreateIndex(
            new RedBlackTreeIndexFactory<Person>(), 
            p => p.GroupId);

        this.Tables.CreateRelation(
            groupTable.PrimaryKeyIndex, 
            peopleGroupIdIndex, 
            x => x, 
            x => x);

        this.People = peopleTable;
        this.Groups = groupTable;
    }

    public ITable<Person> People { get; private set; }

    public ITable<Group> Groups { get; private set; }
}
  • Create a database instance and some data
MyDatabase db = new MyDatabase();

db.Groups.Insert(new Group { 
    Id = 1, 
    Name = "Alpha Group" });

db.Groups.Insert(new Group { 
    Id = 2, 
    Name = "Beta Group" });

db.People.Insert(new Person { 
    Id = 1, 
    Name = "John Doe", 
    GroupId = 1, 
    BirthDay = new DateTime(1966, 4, 12) });
  • Perform queries
var query =
    from p in db.People
    join g in db.Groups on p.GroupId equals g.Id
    select new { Name = p.Name, Group = g.Name };
    
query.ToList()
  • Manipulate data
var q = db.Groups.Where(x => x.Name.StartsWith("B"));

// Update command
q.Update(x => new Group { Name = x.Name + " (taged)" });

// Delete command
q.Delete();

Useful links

Contribute

Want to help us? Your donation directly helps us maintain and grow ZZZ Free Projects.

We can't thank you enough for your support 🙏.

👍 One-time donation

❤️ Become a sponsor

Why should I contribute to this free & open-source library?

We all love free and open-source libraries! But there is a catch... nothing is free in this world.

We NEED your help. Last year alone, we spent over 3000 hours maintaining all our open source libraries.

Contributions allow us to spend more of our time on: Bug Fix, Development, Documentation, and Support.

How much should I contribute?

Any amount is much appreciated. All our free libraries together have more than 100 million downloads.

If everyone could contribute a tiny amount, it would help us make the .NET community a better place to code!

Another great free way to contribute is spreading the word about the library.

A HUGE THANKS for your help!

More Projects

To view all our free and paid projects, visit our website.

More Repositories

1

html-agility-pack

Html Agility Pack (HAP) is a free and open-source HTML parser written in C# to read/write DOM and supports plain XPATH or XSLT. It is a .NET code library that allows you to parse "out of the web" HTML files.
C#
2,548
star
2

EntityFramework-Plus

Entity Framework Plus extends your DbContext with must-haves features: Include Filter, Auditing, Caching, Query Future, Batch Delete, Batch Update, and more
C#
2,187
star
3

System.Linq.Dynamic.Core

The .NET Standard / .NET Core version from the System Linq Dynamic functionality.
HTML
1,500
star
4

Z.ExtensionMethods

C# Extension Methods | Over 1000 extension methods:
C#
1,350
star
5

EntityFramework.Extended

Add-on feature for Entity Framework
C#
1,339
star
6

EntityFramework.DynamicFilters

Global filtering for Entity Framework.
C#
501
star
7

EntityFramework-Effort

Entity Framework Effort is a powerful tool that enables a convenient way to create automated tests for Entity Framework based applications.
C#
431
star
8

Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
C#
424
star
9

System.Linq.Dynamic

[Deprecated] This is the Microsoft assembly for the .Net 4.0 Dynamic language functionality.
424
star
10

Dapper-Plus

Dapper Plus - High-Efficient Bulk Actions (Insert, Update, Delete, and Merge) for .NET
C#
367
star
11

EntityFramework-Extensions

Entity Framework Bulk Operations | Improve Entity Framework performance with Bulk SaveChanges, Insert, update, delete and merge for SQL Server, SQL Azure, SQL Compact, MySQL and SQLite.
C#
335
star
12

GraphDiff

GraphDiff is a library that allows the automatic update of a detached graph using Entity Framework code first.
C#
333
star
13

sqlfiddle3

New version based on vert.x and docker
JavaScript
324
star
14

sqlfiddle

JavaScript
275
star
15

findandreplace

fnr.exe - Find and Replace (FNR) is an open source tool to find and replace text in multiple files. It can quickly search through large numbers of files and also find the information using regular expressions specifying the form of what you want, instead of literal text.
C#
233
star
16

sqlfiddle2

New version of SQL Fiddle based on OpenIDM
JavaScript
194
star
17

Bulk-Operations

C# SQL Bulk Operations | High-performance C# bulk insert, update, delete and merge for SQL Server, SQL Azure, SQL Compact, MySQL, and SQLite.
C#
139
star
18

EntityFramework-Classic

Entity Framework Classic is a supported version of the latest EF6 codebase. It supports .NET Framework and .NET Core and overcomes some EF limitations by adding tons of must-haves built-in features.
C#
102
star
19

LINQ-Async

C# LINQ Async extension methods library for async/await task.
C#
100
star
20

Eval-SQL.NET

SQL Eval Function | Dynamically Evaluate Expression in SQL Server using C# Syntax.
C#
95
star
21

zzzcode.ai

AI Website for developers. Use ChatGPT to answer questions, write code, and more.
94
star
22

EntityFrameworkExtras

EntityFrameworkExtras provides some useful additions to EntityFramework such as executing Stored Procedures with User-Defined Table Types and Output Parameters.
C#
78
star
23

awesome-entity-framework-core

Awesome EF Core third party-libraries, documentation, and tutorials!
53
star
24

Dapper.Transaction

IDbTransaction extension methods for Dapper: A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc..
C#
28
star
25

awesome-dapper

Awesome Dapper third party-libraries, documentation, and tutorials!
15
star
26

awesome-entity-framework-6

Awesome EF6 third party-libraries, documentation, and tutorials!
12
star
27

EntityFramework6-DotNetStandard

The support has been moved here: https://github.com/zzzprojects/EntityFramework-Classic
C#
12
star
28

Compiler-Expression.NET

C# Code Compiler | Code Analysis and Code Compiler for Eval-Expression.NET and Eval-SQL.NET
11
star
29

awesome-csharp-expression-evaluator

Awesome C#/.NET Expression Evaluator third party-libraries, documentation, and tutorials!
8
star
30

LinqToSql-Plus

LinqToSql Plus is a library that dramatically improves LinqToSql performances by using bulk and batch operations.
6
star
31

docs

4
star
32

learn-orm

learn-orm
C#
4
star
33

sqlite-provider

sqlite-provider
C
2
star
34

tutorial4.net

1
star