All Projects → morrisjdev → Filecontextcore

morrisjdev / Filecontextcore

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

Projects that are alternatives of or similar to Filecontextcore

Sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Stars: ✭ 28,479 (+31195.6%)
Mutual labels:  excel, json, xml, csv, xlsx, database
Dbwebapi
(Migrated from CodePlex) DbWebApi is a .Net library that implement an entirely generic Web API (RESTful) for HTTP clients to call database (Oracle & SQL Server) stored procedures or functions in a managed way out-of-the-box without any configuration or coding.
Stars: ✭ 84 (-7.69%)
Mutual labels:  excel, json, xml, csv, xlsx, database
Sq
swiss-army knife for data
Stars: ✭ 275 (+202.2%)
Mutual labels:  excel, json, xml, csv, xlsx
Magento2 Import Export Sample Files
Default Magento 2 CE import / export CSV files & sample files for Firebear Improved Import / Export extension
Stars: ✭ 68 (-25.27%)
Mutual labels:  excel, json, xml, csv
Xresloader
跨平台Excel导表工具(Excel=>protobuf/msgpack/lua/javascript/json/xml)
Stars: ✭ 161 (+76.92%)
Mutual labels:  excel, json, xml, xlsx
Tabtoy
高性能表格数据导出器
Stars: ✭ 1,302 (+1330.77%)
Mutual labels:  excel, json, csv, xlsx
Tableexport
tableExport(table导出文件,支持json、csv、txt、xml、word、excel、image、pdf)
Stars: ✭ 261 (+186.81%)
Mutual labels:  json, xml, csv, file
Meza
A Python toolkit for processing tabular data
Stars: ✭ 374 (+310.99%)
Mutual labels:  excel, xml, csv, xlsx
Servicestack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
Stars: ✭ 4,976 (+5368.13%)
Mutual labels:  json, xml, csv, netcore
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (+687.91%)
Mutual labels:  json, csv, database
Rows
A common, beautiful interface to tabular data, no matter the format
Stars: ✭ 739 (+712.09%)
Mutual labels:  excel, csv, xlsx
Tableexport
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Stars: ✭ 781 (+758.24%)
Mutual labels:  excel, csv, xlsx
Epplus
EPPlus 5-Excel spreadsheets for .NET
Stars: ✭ 693 (+661.54%)
Mutual labels:  excel, netcore, net
Structured Text Tools
A list of command line tools for manipulating structured text data
Stars: ✭ 6,180 (+6691.21%)
Mutual labels:  json, xml, csv
Js2excel
😌 😃 👿 A simple module for excel and json converts each other, which works in the browser.
Stars: ✭ 83 (-8.79%)
Mutual labels:  excel, json, xlsx
Ps Webapi
(Migrated from CodePlex) Let PowerShell Script serve or command-line process as WebAPI. PSWebApi is a simple library for building ASP.NET Web APIs (RESTful Services) by PowerShell Scripts or batch/executable files out of the box.
Stars: ✭ 24 (-73.63%)
Mutual labels:  json, xml, csv
Fsharp.data
F# Data: Library for Data Access
Stars: ✭ 631 (+593.41%)
Mutual labels:  json, xml, csv
Pyexcel
Single API for reading, manipulating and writing data in csv, ods, xls, xlsx and xlsm files
Stars: ✭ 902 (+891.21%)
Mutual labels:  excel, csv, xlsx
Myexcel
MyExcel, a new way to operate excel!
Stars: ✭ 1,198 (+1216.48%)
Mutual labels:  excel, csv, xlsx
Parsrs
CSV, JSON, XML text parsers and generators written in pure POSIX shellscript
Stars: ✭ 56 (-38.46%)
Mutual labels:  json, xml, csv

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<XMLSerializer, DefaultFileManager>();

CSVSerializer

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

optionsBuilder.UseFileContextDatabase<CSVSerializer, DefaultFileManager>();

JSONSerializer

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

optionsBuilder.UseFileContextDatabase<JSONSerializer, DefaultFileManager>();

or just

optionsBuilder.UseFileContextDatabase();

BSONSerializer

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

optionsBuilder.UseFileContextDatabase<BSONSerializer, DefaultFileManager>();

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<EXCELStoreManager>();

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

optionsBuilder.UseFileContextDatabase<EXCELStoreManager>(password: "<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<JSONSerializer, DefaultFileManager>();

EncryptedFileManager

The encrypted file manager encrypts the files with a password.

optionsBuilder.UseFileContextDatabase<JSONSerializer, EncryptedFileManager>(password: "<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 nothing 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");

Custom provider

You can create custom serializer, file manager and store manager if you want.

If you want to create a custom serializer implement the interface ISerializer.

If you want to control storing of data implement interface IFileManager.

If you want to create a store manager that does both implement IStoreManager.

After adding a custom provider you have to add it as a transient dependency in the dependency injection.

Feel free to create a PR with your new provider and I'll add it to FileContextCore.

Version compability

FileContext Version EF Core Version
3.4.* 3.1.0
3.3.* 3.0.0
3.2.* 3.0.0
3.0.1/3.0.0/2.2.6 2.2.6
2.2.0 2.2.0

Custom table/file name

It seems that EF Core currently does not support to define a custom table name using annotations on models. Use the OnModelCreating-method to define a custom table name.

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<User>()
        .ToTable("custom_user_table");
}

This will store the data in a file called custom_user_table.json for example.

Author

Morris Janatzek (morrisjdev)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].