FileContextCore 3.2.0

File provider for Entity Framework Core (to be used for development purposes)

There is a newer version of this package available.
See the version list below for details.
Install-Package FileContextCore -Version 3.2.0
dotnet add package FileContextCore --version 3.2.0
<PackageReference Include="FileContextCore" Version="3.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FileContextCore --version 3.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FileContextCore Build Status Maintainability

FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files.
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
  • integrates seamlessly into EF Core
  • different serializer supported (XML, JSON, CSV, Excel)
  • supports encryption
  • supports relations
  • supports multiple databases

!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

Configure in DI-Service configuration

In your Startup.cs use this:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddDbContext<Context>(options => options.UseFileContextDatabase());
    ...
}
or
Override OnConfiguring method

You can also override the OnConfiguring method of your DbContext to apply the settings:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseFileContextDatabase();
}

Example

For a simple example check out: Example

You can also play around with this example on dotnetfiddle.net: Demo

Configuration

By default the extension uses JSON-serialization and the DefaultFileManager

You can use a different serializer to support other serialization methods.

Available Serializer

XMLSerializer

Serializes data using System.XML

optionsBuilder.UseFileContextDatabase("xml");

CSVSerializer

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

optionsBuilder.UseFileContextDatabase("csv");

JSONSerializer

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

optionsBuilder.UseFileContextDatabase("json");

or just

optionsBuilder.UseFileContextDatabase();

BSONSerializer

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

optionsBuilder.UseFileContextDatabase("bson");

EXCELSerializer

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.UseFileContextDatabase("excel");

If you want to secure the excel file with a password use:

optionsBuilder.UseFileContextDatabase("excel:<password>");

To run on Linux-Systems

sudo apt-get update
sudo apt-get install libgdiplus

File Manager

The file manager controls how the files are stored.

DefaultFileManager

The default file manager just creates normal files.

optionsBuilder.UseFileContextDatabase("json", "default");

EncryptedFileManager

The encrypted file manager encrypts the files with a password.

optionsBuilder.UseFileContextDatabase("json", "encrypted:<password>");

Custom file-location

By default the files are stored in a subfolder of your running application called appdata.
If you want to control this behavior you can also use define a custom location.

optionsBuilder.UseFileContextDatabase(location: @"C:\Users\mjanatzek\Documents\Projects\test");

Multiple Databases

If noting is configured all files of your application will be stored in a flat folder.
You can optionally define a name for your database and all the corresponding data will saved in a subfolder.
So you are able to use FileContext with multiple DbContext-configurations.

optionsBuilder.UseFileContextDatabase(databasename: "database");

Version compability

| FileContext Version | EF Core Version |
|---------------------|-----------------|
| 3.2.0 | 3.0.0 |
| 3.0.1/3.0.0/2.2.6 | 2.2.6 |
| 2.2.0 | 2.2.0 |

Author

Morris Janatzek (morrisjdev)

FileContextCore Build Status Maintainability

FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files.
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
  • integrates seamlessly into EF Core
  • different serializer supported (XML, JSON, CSV, Excel)
  • supports encryption
  • supports relations
  • supports multiple databases

!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

Configure in DI-Service configuration

In your Startup.cs use this:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddDbContext<Context>(options => options.UseFileContextDatabase());
    ...
}
or
Override OnConfiguring method

You can also override the OnConfiguring method of your DbContext to apply the settings:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseFileContextDatabase();
}

Example

For a simple example check out: Example

You can also play around with this example on dotnetfiddle.net: Demo

Configuration

By default the extension uses JSON-serialization and the DefaultFileManager

You can use a different serializer to support other serialization methods.

Available Serializer

XMLSerializer

Serializes data using System.XML

optionsBuilder.UseFileContextDatabase("xml");

CSVSerializer

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

optionsBuilder.UseFileContextDatabase("csv");

JSONSerializer

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

optionsBuilder.UseFileContextDatabase("json");

or just

optionsBuilder.UseFileContextDatabase();

BSONSerializer

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

optionsBuilder.UseFileContextDatabase("bson");

EXCELSerializer

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.UseFileContextDatabase("excel");

If you want to secure the excel file with a password use:

optionsBuilder.UseFileContextDatabase("excel:<password>");

To run on Linux-Systems

sudo apt-get update
sudo apt-get install libgdiplus

File Manager

The file manager controls how the files are stored.

DefaultFileManager

The default file manager just creates normal files.

optionsBuilder.UseFileContextDatabase("json", "default");

EncryptedFileManager

The encrypted file manager encrypts the files with a password.

optionsBuilder.UseFileContextDatabase("json", "encrypted:<password>");

Custom file-location

By default the files are stored in a subfolder of your running application called appdata.
If you want to control this behavior you can also use define a custom location.

optionsBuilder.UseFileContextDatabase(location: @"C:\Users\mjanatzek\Documents\Projects\test");

Multiple Databases

If noting is configured all files of your application will be stored in a flat folder.
You can optionally define a name for your database and all the corresponding data will saved in a subfolder.
So you are able to use FileContext with multiple DbContext-configurations.

optionsBuilder.UseFileContextDatabase(databasename: "database");

Version compability

| FileContext Version | EF Core Version |
|---------------------|-----------------|
| 3.2.0 | 3.0.0 |
| 3.0.1/3.0.0/2.2.6 | 2.2.6 |
| 2.2.0 | 2.2.0 |

Author

Morris Janatzek (morrisjdev)

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on FileContextCore:

Repository Stars
SapphireDb/SapphireDb
SapphireDb Server, a self-hosted, easy to use realtime database for Asp.Net Core and EF Core

Version History

Version Downloads Last updated
3.4.0 428 6/7/2020
3.3.0 433 3/19/2020
3.2.3 90 3/18/2020
3.2.2 2,117 11/1/2019
3.2.1 107 11/1/2019
3.2.0 107 10/30/2019
3.0.1 152 10/29/2019
3.0.0 359 8/23/2019
2.2.6 227 8/7/2019
2.2.0 355 1/3/2019
2.1.4 268 10/26/2018
2.1.0 452 6/22/2018
2.0.1 580 1/13/2018
1.0.9 502 7/2/2017
1.0.8 440 5/27/2017
1.0.7 464 3/28/2017
1.0.6 455 3/25/2017
1.0.5 537 3/25/2017
1.0.4 476 3/24/2017
1.0.3 505 3/24/2017
1.0.2 477 3/24/2017
1.0.1 503 3/24/2017
1.0.0 469 3/23/2017
Show less