{"id":19740658,"url":"https://github.com/zzzprojects/nmemory","last_synced_at":"2025-04-09T11:06:50.724Z","repository":{"id":9068781,"uuid":"10839417","full_name":"zzzprojects/nmemory","owner":"zzzprojects","description":"NMemory is a lightweight non-persistent in-memory relational database engine that is purely written in C# and can be hosted by .NET applications.","archived":false,"fork":false,"pushed_at":"2024-03-19T14:22:31.000Z","size":4131,"stargazers_count":235,"open_issues_count":2,"forks_count":62,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-02T10:08:24.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nmemory.net/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzzprojects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["zzzprojects"],"custom":["https://zzzprojects.com/contribute"]}},"created_at":"2013-06-21T09:19:43.000Z","updated_at":"2025-01-21T08:28:09.000Z","dependencies_parsed_at":"2022-08-07T05:00:28.688Z","dependency_job_id":"4d39a2bd-b0b7-473a-adfe-d7a8c31414e2","html_url":"https://github.com/zzzprojects/nmemory","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzprojects%2Fnmemory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzprojects%2Fnmemory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzprojects%2Fnmemory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzprojects%2Fnmemory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzzprojects","download_url":"https://codeload.github.com/zzzprojects/nmemory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027407,"owners_count":21035594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T01:22:47.203Z","updated_at":"2025-04-09T11:06:50.699Z","avatar_url":"https://github.com/zzzprojects.png","language":"C#","funding_links":["https://github.com/sponsors/zzzprojects","https://zzzprojects.com/contribute"],"categories":[],"sub_categories":[],"readme":"## Library Powered By\r\n\r\nThis library is powered by [Entity Framework Extensions](https://entityframework-extensions.net/?z=github\u0026y=entityframework-plus)\r\n\r\n\u003ca href=\"https://entityframework-extensions.net/?z=github\u0026y=nmemory\"\u003e\r\n\u003ckbd\u003e\r\n\u003cimg src=\"https://zzzprojects.github.io/images/logo/entityframework-extensions-pub.jpg\" alt=\"Entity Framework Extensions\" /\u003e\r\n\u003c/kbd\u003e\r\n\u003c/a\u003e\r\n\r\n# What's NMemory?\r\nNMemory 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\r\ntraditional database features like indexes, foreign key relations, transaction handling and isolation, stored procedures, query optimization.\r\n\r\n## Getting started\r\n* Install [NuGet package](https://www.nuget.org/packages/NMemory)\r\n* Define the database\r\n\r\n```csharp\r\npublic class Person\r\n{\r\n    public int Id { get; set; }\r\n\r\n    public string Name { get; set; }\r\n}\r\n\r\npublic class Group\r\n{\r\n    public int Id { get; set; }\r\n\r\n    public string Name { get; set; }\r\n}\r\n\r\npublic class MyDatabase : Database\r\n{\r\n    public MyDatabase()\r\n    {\r\n        var peopleTable = base.Tables.Create\u003cPerson, int\u003e(p =\u003e p.Id);\r\n        var groupTable = base.Tables.Create\u003cGroup, int\u003e(g =\u003e g.Id);\r\n\r\n        var peopleGroupIdIndex = peopleTable.CreateIndex(\r\n            new RedBlackTreeIndexFactory\u003cPerson\u003e(), \r\n            p =\u003e p.GroupId);\r\n\r\n        this.Tables.CreateRelation(\r\n            groupTable.PrimaryKeyIndex, \r\n            peopleGroupIdIndex, \r\n            x =\u003e x, \r\n            x =\u003e x);\r\n\r\n        this.People = peopleTable;\r\n        this.Groups = groupTable;\r\n    }\r\n\r\n    public ITable\u003cPerson\u003e People { get; private set; }\r\n\r\n    public ITable\u003cGroup\u003e Groups { get; private set; }\r\n}\r\n```\r\n\r\n* Create a database instance and some data\r\n\r\n```csharp\r\nMyDatabase db = new MyDatabase();\r\n\r\ndb.Groups.Insert(new Group { \r\n    Id = 1, \r\n    Name = \"Alpha Group\" });\r\n\r\ndb.Groups.Insert(new Group { \r\n    Id = 2, \r\n    Name = \"Beta Group\" });\r\n\r\ndb.People.Insert(new Person { \r\n    Id = 1, \r\n    Name = \"John Doe\", \r\n    GroupId = 1, \r\n    BirthDay = new DateTime(1966, 4, 12) });\r\n```\r\n\r\n* Perform queries\r\n\r\n```csharp\r\nvar query =\r\n    from p in db.People\r\n    join g in db.Groups on p.GroupId equals g.Id\r\n    select new { Name = p.Name, Group = g.Name };\r\n    \r\nquery.ToList()\r\n```\r\n\r\n* Manipulate data\r\n\r\n```csharp\r\nvar q = db.Groups.Where(x =\u003e x.Name.StartsWith(\"B\"));\r\n\r\n// Update command\r\nq.Update(x =\u003e new Group { Name = x.Name + \" (taged)\" });\r\n\r\n// Delete command\r\nq.Delete();\r\n```\r\n\r\n## Useful links\r\n\r\n- [Website](https://nmemory.net/)\r\n- [Documentation](https://nmemory.net/overview)\r\n- [Online Examples](https://nmemory.net/online-examples) \r\n\r\n## Contribute\r\n\r\nThe best way to contribute is by **spreading the word** about the library:\r\n\r\n - Blog it\r\n - Comment it\r\n - Star it\r\n - Share it\r\n \r\nA **HUGE THANKS** for your help.\r\n\r\n## More Projects\r\n\r\n- Projects:\r\n   - [EntityFramework Extensions](https://entityframework-extensions.net/)\r\n   - [Dapper Plus](https://dapper-plus.net/)\r\n   - [C# Eval Expression](https://eval-expression.net/)\r\n- Learn Websites\r\n   - [Learn EF Core](https://www.learnentityframeworkcore.com/)\r\n   - [Learn Dapper](https://www.learndapper.com/)\r\n- Online Tools:\r\n   - [.NET Fiddle](https://dotnetfiddle.net/)\r\n   - [SQL Fiddle](https://sqlfiddle.com/)\r\n   - [ZZZ Code AI](https://zzzcode.ai/)\r\n- and much more!\r\n\r\nTo view all our free and paid projects, visit our website [ZZZ Projects](https://zzzprojects.com/).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzzprojects%2Fnmemory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzzprojects%2Fnmemory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzzprojects%2Fnmemory/lists"}