{"id":23924526,"url":"https://github.com/dbpprt/mobiledb","last_synced_at":"2025-04-12T02:26:02.772Z","repository":{"id":20562226,"uuid":"23842331","full_name":"dbpprt/mobiledb","owner":"dbpprt","description":"You like EntityFramework and use it frequently but sometimes you need just a simple embedded database for an app or a small application, then MobileDB ist just right for you. It's a lightweight, fast and simple JSON database with an EntityFramework inspired API. ","archived":false,"fork":false,"pushed_at":"2015-01-17T13:53:22.000Z","size":339,"stargazers_count":18,"open_issues_count":5,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T02:25:57.077Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dbpprt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-09T16:50:09.000Z","updated_at":"2023-07-25T15:44:33.000Z","dependencies_parsed_at":"2022-08-31T14:02:15.262Z","dependency_job_id":null,"html_url":"https://github.com/dbpprt/mobiledb","commit_stats":null,"previous_names":["flumbee/mobiledb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbpprt%2Fmobiledb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbpprt%2Fmobiledb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbpprt%2Fmobiledb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbpprt%2Fmobiledb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbpprt","download_url":"https://codeload.github.com/dbpprt/mobiledb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248506483,"owners_count":21115435,"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":"2025-01-05T19:15:09.674Z","updated_at":"2025-04-12T02:26:02.736Z","avatar_url":"https://github.com/dbpprt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MobileDB - a lightweight, fast and embeddable database engine \n\nYou like **EntityFramework's** API and the way of accessing tables and save data? You asked your self why there is no simple json file database to use in small projects, apps, etc where you don't need a full database engine? **Then try out MobileDB**\n\n### Features ###\n\n- **Full LINQ support**\n- (**new**) async support\n- Super-Fast data-access with a **Json**-Store (in-memory dataset synchronized with your underlaying filesystem)\n- A **Bson**-Store for saving files with metadata (not kept in-memory - loaded on demand)\n- EntityFramework inspired DbContext and EntitySets\n- It relies on JSON.NET so it will serialize nearly any types \n- Primary keys for entities\n- Extensive entity validation powered by [MobileDB](https://github.com/JaroslawWaliszko/ExpressiveAnnotations \"MobileDB\") (see Examples)\n- It is **blazing fast**! Adding 100.000 items and reloading them from the filesystem takes about ~1sec\n- **A friendly license for developers! (MIT licensed)**\n- ......\n\n### Supported Platforms ###\n\n- PCL version for supported platforms \n- .NET 4.5+, \n- **(soon)** Windows Phone 8.0+, \n- Mono 4.5+\n- Android (via Xamarin/Mono) (**untested**)\n- iOS (via Xamarin/Mono) (**untested**)\n\n### Why should i use a embedded database for my application?\n\nYou might also wonder about storing data in memory. Let's think about a blog with dozens of posts, comments and attached files?\n\nThe answer is really simple: think about the size of your data? Is it really more than some megabytes of data? Probably not. MobileDB comes with a BSON store who doesn't keep data in memory. So it's perfect to save your files (pictures, attachments) there and just reference it your other entities. \n\n**I created MobileDB because im to lazy to install a SQL-Server Express on every small application i use and i want a EntityFramework like experience when working with desktop and mobile applications.**\n\n### How to install\n\nJust grab the MobileDB package from nuget and install it\n\n```\nInstall-Package MobileDB\n```\n\n### A simple sample ###\n\nSo let's get started with a simple example\n\n```csharp\n\n// a simple movie entity containing some validation rules\n// just for database consistency\n\npublic class Movie\n{\n\t// we only want imdb ids here\n\t[AssertThat(\"StartsWith(MovieId, 'tt') == true\")]\n    [Identity]\n\tpublic string MovieId { get; set; }\n\t\n\t[AssertThat(\"Length(Name) \u003e= 1\")] \n    public string Name { get; set; }\n\n    public string[] Genres { get; set; }\n\t\n    public int Year { get; set; }\n\n    // and some other properties\n}\n\n\npublic class MovieContext : DbContext\n{\n    public MovieContext(string connectionString)\n        : base(connectionString)\n    {\n    }\n\n\t// it's not required to define Json store, it's the default store\n\t//[Json]\n    public IEntitySet\u003cMovie\u003e Movies { get; set; }\n}\n\n\n// so that's all... let's use our context :)\n\nvar context = ContextFactory.Create\u003cMovieContext\u003e()\n    .WithPhysicalFilesystem(\"C:\\\\database\\\\\")\n    .Build();\n\nvar movies = context.Movies;\n\nmovies.Add(new Movie\n{\n    Genres = new[] { \"Action\" },\n    MovieId = \"tt0468569\",\n    Name = \"The Dark Knight\",\n    Year = 2008\n});\n\ncontext.SaveChanges();\n\n```\n\n### Some other things you should know ###\n\n- MobileDB is like EntityFramework, that means: 1 context per Thread (this is really handy in small webapplications with Unity or any other dependency injection framework\n- Multiple contextes are safe to be accessed at the same time\n- Entites are not bound to a schema =\u003e you can change it whenever you want\n- The first time when you initialize a DbContext it takes about ~100ms to analyze the schema and to cache it but after the first load it's blazing fast\n- MobileDB is under heavy development that means it i don't garantee that there won't be any API changes\n\n### Other cool features ###\n\n- You can plug-in any FileSystem or Store you want, everything is built on top of interfaces. The connection string specifies which components are used\n\n```\n// sample connection string generated for the example above by the ContextFactory\nfilesystem=MobileDB.FileSystem.PhysicalFileSystem;path=C:\\\\database\\\\\n```\n\n- This allows you to write your own filesystems if you need them. For example a zip-filesystem with zip-file encryption would be really easy\n- You can define stores and MobileDB is able to load them for specific EntitySets\n\n```csharp\n[Store(typeof (JsonStore))]\npublic IEntitySet\u003cSimpleEntityWithIdentity\u003e Movies { get; set; }\n```\n\n- Adding your own validation attributes, etc\n- More docs to come\n\n### Known bugs :( ###\n\n- FileSystem implementation for Windows Phone (LocalStorage) is missing\n- Test coverage is about 1%\n\n### Roadmap ###\n\n- See issues\n\n### **Important:** I'm searching for contributors or other members who like to help me to make MobileDB even better \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbpprt%2Fmobiledb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbpprt%2Fmobiledb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbpprt%2Fmobiledb/lists"}