{"id":26243571,"url":"https://github.com/morrisjdev/filecontextcore","last_synced_at":"2025-04-04T16:17:12.613Z","repository":{"id":19195789,"uuid":"85997066","full_name":"morrisjdev/FileContextCore","owner":"morrisjdev","description":"FileContextCore is a \"Database\"-Provider for Entity Framework Core and adds the ability to store information in files instead of being limited to databases.","archived":false,"fork":false,"pushed_at":"2023-01-19T19:05:26.000Z","size":1436,"stargazers_count":172,"open_issues_count":15,"forks_count":44,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-28T15:11:24.193Z","etag":null,"topics":["csv","database","dbcontext","entity-framework","excel","file","filedb","json","net","netcore","xlsx","xml"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morrisjdev.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":"2017-03-23T20:59:48.000Z","updated_at":"2025-02-28T13:58:56.000Z","dependencies_parsed_at":"2023-02-11T17:15:49.306Z","dependency_job_id":null,"html_url":"https://github.com/morrisjdev/FileContextCore","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/morrisjdev%2FFileContextCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrisjdev%2FFileContextCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrisjdev%2FFileContextCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrisjdev%2FFileContextCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morrisjdev","download_url":"https://codeload.github.com/morrisjdev/FileContextCore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208190,"owners_count":20901570,"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":["csv","database","dbcontext","entity-framework","excel","file","filedb","json","net","netcore","xlsx","xml"],"created_at":"2025-03-13T10:28:43.340Z","updated_at":"2025-04-04T16:17:12.592Z","avatar_url":"https://github.com/morrisjdev.png","language":"C#","readme":"# FileContextCore [![Build Status](https://travis-ci.org/morrisjdev/FileContextCore.svg?branch=master)](https://travis-ci.org/morrisjdev/FileContextCore) [![Maintainability](https://api.codeclimate.com/v1/badges/72cbed89392efad4c743/maintainability)](https://codeclimate.com/github/morrisjdev/FileContextCore/maintainability)\n\nFileContextCore is a \"Database\"-Provider for Entity Framework Core and adds the ability to store information in files.\nIt enables fast developments because of the advantage of just copy, edit and delete files.\n\nThis framework bases on the idea of FileContext by DevMentor ([https://github.com/pmizel/DevMentor.Context.FileContext](https://github.com/pmizel/DevMentor.Context.FileContext))\n\n## Advantages\n\n- No database needed\n- Easy configuration\n- Rapid data-modelling, -modification\n- Share data through version-control\n- Supports all serializable .NET types\n- Integrates seamlessly into EF Core\n- Different serializer supported (XML, JSON, CSV, Excel)\n- Supports encryption\n- Supports relations\n- Supports multiple databases\n\n!This extension is not intended to be used in production systems!\n\n## Install\n\n[https://www.nuget.org/packages/FileContextCore/](https://www.nuget.org/packages/FileContextCore/)\n\n```\nPM \u003e Install-Package FileContextCore\n```\n\n### Configure EF Core\n\n#### Configure in DI-Service configuration\n\nIn your `Startup.cs` use this:\n\n```cs\npublic void ConfigureServices(IServiceCollection services)\n{\n    ...\n    services.AddDbContext\u003cContext\u003e(options =\u003e options.UseFileContextDatabase());\n    ...\n}\n```\n\n#### or\n\n#### Override `OnConfiguring` method \n\nYou can also override the `OnConfiguring` method of your DbContext to apply the settings:\n\n```cs\nprotected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n{\n    optionsBuilder.UseFileContextDatabase();\n}\n```\n\n## Example\n\nFor a simple example check out: [Example](https://github.com/morrisjdev/FileContextCore/tree/master/Example)\n\nYou can also play around with this example on dotnetfiddle.net: [Demo](https://dotnetfiddle.net/jvFdaY)\n\n## Configuration\n\nBy default the extension uses `JSON`-serialization and the `DefaultFileManager`\n\nYou can use a different serializer to support other serialization methods.\n\n## Available Serializer\n\n### XMLSerializer\n\nSerializes data using System.XML\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cXMLSerializer, DefaultFileManager\u003e();\n```\n\n### CSVSerializer\n\nSerializes data using CsvHelper ([https://joshclose.github.io/CsvHelper/](https://joshclose.github.io/CsvHelper/))\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cCSVSerializer, DefaultFileManager\u003e();\n```\n\n### JSONSerializer\n\nSerializes data using Newtonsoft Json.NET ([http://www.newtonsoft.com/json](http://www.newtonsoft.com/json))\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cJSONSerializer, DefaultFileManager\u003e();\n```\nor just\n```\noptionsBuilder.UseFileContextDatabase();\n```\n\n### BSONSerializer\n\nSerializes data to bson using Newtonsoft Json.NET ([http://www.newtonsoft.com/json](http://www.newtonsoft.com/json))\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cBSONSerializer, DefaultFileManager\u003e();\n```\n\n### EXCELSerializer\n\nSaves files into an .xlsx-file and enables the quick editing of the data using Excel\n\nUses [EEPlus](http://epplus.codeplex.com/documentation) implementation for .Net Core ([https://github.com/VahidN/EPPlus.Core](https://github.com/VahidN/EPPlus.Core))\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cEXCELStoreManager\u003e();\n```\n\nIf you want to secure the excel file with a password use:\n```cs\noptionsBuilder.UseFileContextDatabase\u003cEXCELStoreManager\u003e(password: \"\u003cpassword\u003e\");\n```\n\nTo run on Linux-Systems\n```\nsudo apt-get update\nsudo apt-get install libgdiplus\n```\n\n## File Manager\n\nThe file manager controls how the files are stored.\n\n### DefaultFileManager\n\nThe default file manager just creates normal files.\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cJSONSerializer, DefaultFileManager\u003e();\n```\n\n### EncryptedFileManager\n\nThe encrypted file manager encrypts the files with a password.\n\n```cs\noptionsBuilder.UseFileContextDatabase\u003cJSONSerializer, EncryptedFileManager\u003e(password: \"\u003cpassword\u003e\");\n```\n\n## Custom file-location\n\nBy default the files are stored in a subfolder of your running application called `appdata`.\nIf you want to control this behavior you can also use define a custom location.\n\n```cs\noptionsBuilder.UseFileContextDatabase(location: @\"C:\\Users\\mjanatzek\\Documents\\Projects\\test\");\n```\n\n## Multiple Databases\n\nIf nothing is configured all files of your application will be stored in a flat folder.\nYou can optionally define a name for your database and all the corresponding data will saved in a subfolder.\nSo you are able to use FileContext with multiple DbContext-configurations.\n\n```cs\noptionsBuilder.UseFileContextDatabase(databasename: \"database\");\n```\n\n## Custom provider\n\nYou can create custom serializer, file manager and store manager if you want.\n\nIf you want to create a custom serializer implement the interface `ISerializer`.\n\nIf you want to control storing of data implement interface `IFileManager`.\n\nIf you want to create a store manager that does both implement `IStoreManager`.\n\nAfter adding a custom provider you have to add it as a transient dependency in the dependency injection.\n\nFeel free to create a PR with your new provider and I'll add it to FileContextCore.\n\n## Version compability\n\n| FileContext Version | EF Core Version |\n|---------------------|-----------------|\n| 3.4.*              | 3.1.0           |\n| 3.3.*              | 3.0.0           |\n| 3.2.*              | 3.0.0           |\n| 3.0.1/3.0.0/2.2.6   | 2.2.6           |\n| 2.2.0               | 2.2.0           |\n\n## Custom table/file name\n\nIt seems that EF Core currently does not support to define a custom table name using annotations on models.\nUse the `OnModelCreating`-method to define a custom table name.\n\n````c#\nprotected override void OnModelCreating(ModelBuilder modelBuilder)\n{\n    modelBuilder.Entity\u003cUser\u003e()\n        .ToTable(\"custom_user_table\");\n}\n````\n\nThis will store the data in a file called `custom_user_table.json` for example.\n\n## Author\n\n[Morris Janatzek](http://morrisj.net) ([morrisjdev](https://github.com/morrisjdev))\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorrisjdev%2Ffilecontextcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorrisjdev%2Ffilecontextcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorrisjdev%2Ffilecontextcore/lists"}