@@ -8,15 +8,15 @@ This framework bases on the idea of FileContext by DevMentor ([https://github.co
88## Advantages
99
1010- No database needed
11- - easy configuration
12- - rapid data-modelling, -modification
13- - share data through version-control
14- - supports all serializable .NET types
15- - integrates seamlessly into EF Core
16- - different serializer supported (XML, JSON, CSV, Excel)
17- - supports encryption
18- - supports relations
19- - supports multiple databases
11+ - Easy configuration
12+ - Rapid data-modelling, -modification
13+ - Share data through version-control
14+ - Supports all serializable .NET types
15+ - Integrates seamlessly into EF Core
16+ - Different serializer supported (XML, JSON, CSV, Excel)
17+ - Supports encryption
18+ - Supports relations
19+ - Supports multiple databases
2020
2121!This extension is not intended to be used in production systems!
2222
@@ -75,23 +75,23 @@ You can use a different serializer to support other serialization methods.
7575Serializes data using System.XML
7676
7777``` cs
78- optionsBuilder .UseFileContextDatabase ( " xml " );
78+ optionsBuilder .UseFileContextDatabase < XMLSerializer , DefaultFileManager >( );
7979```
8080
8181### CSVSerializer
8282
8383Serializes data using CsvHelper ([ https://joshclose.github.io/CsvHelper/ ] ( https://joshclose.github.io/CsvHelper/ ) )
8484
8585``` cs
86- optionsBuilder .UseFileContextDatabase ( " csv " );
86+ optionsBuilder .UseFileContextDatabase < CSVSerializer , DefaultFileManager >( );
8787```
8888
8989### JSONSerializer
9090
9191Serializes data using Newtonsoft Json.NET ([ http://www.newtonsoft.com/json ] ( http://www.newtonsoft.com/json ) )
9292
9393``` cs
94- optionsBuilder .UseFileContextDatabase ( " json " );
94+ optionsBuilder .UseFileContextDatabase < JSONSerializer , DefaultFileManager >( );
9595```
9696or just
9797```
@@ -103,7 +103,7 @@ optionsBuilder.UseFileContextDatabase();
103103Serializes data to bson using Newtonsoft Json.NET ([ http://www.newtonsoft.com/json ] ( http://www.newtonsoft.com/json ) )
104104
105105``` cs
106- optionsBuilder .UseFileContextDatabase ( " bson " );
106+ optionsBuilder .UseFileContextDatabase < BSONSerializer , DefaultFileManager >( );
107107```
108108
109109### EXCELSerializer
@@ -113,12 +113,12 @@ Saves files into an .xlsx-file and enables the quick editing of the data using E
113113Uses [ EEPlus] ( http://epplus.codeplex.com/documentation ) implementation for .Net Core ([ https://github.com/VahidN/EPPlus.Core ] ( https://github.com/VahidN/EPPlus.Core ) )
114114
115115``` cs
116- optionsBuilder .UseFileContextDatabase ( " excel " );
116+ optionsBuilder .UseFileContextDatabase < EXCELStoreManager >( );
117117```
118118
119119If you want to secure the excel file with a password use:
120120``` cs
121- optionsBuilder .UseFileContextDatabase ( " excel: <password>" );
121+ optionsBuilder .UseFileContextDatabase < EXCELStoreManager >( password : " <password>" );
122122```
123123
124124To run on Linux-Systems
@@ -136,26 +136,17 @@ The file manager controls how the files are stored.
136136The default file manager just creates normal files.
137137
138138``` cs
139- optionsBuilder .UseFileContextDatabase ( " json " , " default " );
139+ optionsBuilder .UseFileContextDatabase < JSONSerializer , DefaultFileManager >( );
140140```
141141
142142### EncryptedFileManager
143143
144144The encrypted file manager encrypts the files with a password.
145145
146146``` cs
147- optionsBuilder .UseFileContextDatabase ( " json " , " encrypted: <password>" );
147+ optionsBuilder .UseFileContextDatabase < JSONSerializer , EncryptedFileManager >( password : " <password>" );
148148```
149149
150- ## Configuration string
151-
152- If you want to define the options of file context in a single string you can use the default connection string syntax of databases.
153-
154- ``` css
155- optionsBuilder.UseFileContextDatabaseConnectionString("serializer=xml;databasename=Test;location:test;filemanager:default ");
156- ```
157-
158-
159150## Custom file-location
160151
161152By default the files are stored in a subfolder of your running application called ` appdata ` .
@@ -175,14 +166,42 @@ So you are able to use FileContext with multiple DbContext-configurations.
175166optionsBuilder .UseFileContextDatabase (databasename : " database" );
176167```
177168
169+ ## Custom provider
170+
171+ You can create custom serializer, file manager and store manager if you want.
172+
173+ If you want to create a custom serializer implement the interface ` ISerializer ` .
174+
175+ If you want to control storing of data implement interface ` IFileManager ` .
176+
177+ If you want to create a store manager that does both implement ` IStoreManager ` .
178+
179+ Feel free to create a PR with your new provider and I'll add it to FileContextCore.
180+
178181## Version compability
179182
180183| FileContext Version | EF Core Version |
181184| ---------------------| -----------------|
185+ | 3.3.* | 3.0.0 |
182186| 3.2.* | 3.0.0 |
183187| 3.0.1/3.0.0/2.2.6 | 2.2.6 |
184188| 2.2.0 | 2.2.0 |
185189
190+ ## Custom table/file name
191+
192+ It seems that EF Core currently does not support to define a custom table name using annotations on models.
193+ Use the ` OnModelCreating ` -method to define a custom table name.
194+
195+ ```` c#
196+ protected override void OnModelCreating (ModelBuilder modelBuilder )
197+ {
198+ modelBuilder .Entity <User >()
199+ .ToTable (" custom_user_table" );
200+ }
201+ ````
202+
203+ This will store the data in a file called ` custom_user_table.json ` for example.
204+
186205## Author
187206
188207[ Morris Janatzek] ( http://morrisj.net ) ([ morrisjdev] ( https://github.com/morrisjdev ) )
0 commit comments