Skip to content

FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files instead of being limited to databases.

License

Notifications You must be signed in to change notification settings

chrkon/FileContextCore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileContextCore

FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files instead of being limited to databases. It enables fast developments because of the advantage of just copy, edit and delete files.

This framework bases on the idea of FileContext by DevMentor (https://github.com/pmizel/DevMentor.Context.FileContext)

Advantages

  • No database needed
  • easy configuration
  • rapid data-modelling, -modification
  • share data through version-control
  • supports all serializable .NET types
  • integrated seamlessly into EF Core
  • diferrent serializer supported (XML, JSON, CSV, Excel)
  • supports encryption
  • supports relations

!This extension is not intended to be used in production systems!

Install

https://www.nuget.org/packages/FileContextCore/

PM > Install-Package FileContextCore

Configure EF Core

optionsBuilder.UseFileContext();

or

services.AddEntityFramework().AddDbContext<Context>(options => options.UseFileContext());

Example

For an Example check out: Example

Configuration

By default the extension uses JSON-serialization and the DefaultFileManager

Available Serializer

XMLSerializer

Serializes data using System.XML

optionsBuilder.UseFileContext(new FileContextCore.Serializer.XMLSerializer());

//disable indent
optionsBuilder.UseFileContext(new FileContextCore.Serializer.XMLSerializer(false));

CSVSerializer

Serializes data using CsvHelper (https://joshclose.github.io/CsvHelper/)

optionsBuilder.UseFileContext(new FileContextCore.Serializer.CSVSerializer());

//change default delimiter (,)
optionsBuilder.UseFileContext(new FileContextCore.Serializer.CSVSerializer(";"));

JSONSerializer

Serializes data using Newtonsoft Json.NET (http://www.newtonsoft.com/json)

optionsBuilder.UseFileContext(new FileContextCore.Serializer.JSONSerializer());

//change formatting
optionsBuilder.UseFileContext(
    new FileContextCore.Serializer.JSONSerializer(Newtonsoft.Json.Formatting.None)
);

File Manager

DefaultFileManager

Saves the data into files

optionsBuilder.UseFileContext(fileManager: new FileContextCore.FileManager.DefaultFileManager());

EncryptedFileManager

Encrypts the data and saves them into files

optionsBuilder.UseFileContext(fileManager: new FileContextCore.FileManager.EncryptedFileManager());

//change key
optionsBuilder.UseFileContext(fileManager: new FileContextCore.FileManager.EncryptedFileManager("key"));

Combined Manager

Excel Manager

Saves files into an .xlsx-file and enables the quick editing of the data using Excel

Uses EEPlus implementation for .Net Core (https://github.com/VahidN/EPPlus.Core)

optionsBuilder.UseFileContext(new FileContextCore.CombinedManager.ExcelManager());

//use password
optionsBuilder.UseFileContext(new FileContextCore.CombinedManager.ExcelManager("password"));

To run on Linux-Systems

sudo apt-get update
sudo apt-get install libgdiplus

Custom implementation

For customization you can implement the Interfaces ISerializer, IFileManager and ICombinedManager

Author

Morris Janatzek (morrisjdev)

About

FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files instead of being limited to databases.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%