Skip to content

Commit c5bdab8

Browse files
committed
updated docs
1 parent 7dd1989 commit c5bdab8

File tree

1 file changed

+54
-15
lines changed

1 file changed

+54
-15
lines changed

README.md

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 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)
22

3-
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.
3+
FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files.
4+
It enables fast developments because of the advantage of just copy, edit and delete files.
45

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

@@ -11,8 +12,8 @@ This framework bases on the idea of FileContext by DevMentor ([https://github.co
1112
- rapid data-modelling, -modification
1213
- share data through version-control
1314
- supports all serializable .NET types
14-
- integrated seamlessly into EF Core
15-
- diferrent serializer supported (XML, JSON, CSV, Excel)
15+
- integrates seamlessly into EF Core
16+
- different serializer supported (XML, JSON, CSV, Excel)
1617
- supports encryption
1718
- supports relations
1819
- supports multiple databases
@@ -27,26 +28,46 @@ This framework bases on the idea of FileContext by DevMentor ([https://github.co
2728
PM > Install-Package FileContextCore
2829
```
2930

30-
Configure EF Core
31+
### Configure EF Core
32+
33+
#### Configure in DI-Service configuration
34+
35+
In your `Startup.cs` use this:
3136

3237
```cs
33-
optionsBuilder.UseFileContext();
38+
public void ConfigureServices(IServiceCollection services)
39+
{
40+
...
41+
services.AddDbContext<Context>(options => options.UseFileContext());
42+
...
43+
}
3444
```
3545

36-
or
46+
#### or
47+
48+
#### Override `OnConfiguring` method
49+
50+
You can also override the `OnConfiguring` method of your DbContext to apply the settings:
3751

3852
```cs
39-
services.AddEntityFramework().AddDbContext<Context>(options => options.UseFileContext());
53+
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
54+
{
55+
optionsBuilder.UseFileContext();
56+
}
4057
```
4158

4259
## Example
4360

44-
For an Example check out: [Example](https://github.com/morrisjdev/FileContextCore/tree/master/src/Example)
61+
For a simple example check out: [Example](https://github.com/morrisjdev/FileContextCore/tree/master/Example)
62+
63+
You can also play around with this example on dotnetfiddle.net: [Demo](https://dotnetfiddle.net/jvFdaY)
4564

4665
## Configuration
4766

4867
By default the extension uses `JSON`-serialization and the `DefaultFileManager`
4968

69+
You can use a different serializer to support other serialization methods.
70+
5071
## Available Serializer
5172

5273
### XMLSerializer
@@ -72,6 +93,10 @@ Serializes data using Newtonsoft Json.NET ([http://www.newtonsoft.com/json](http
7293
```cs
7394
optionsBuilder.UseFileContext("json");
7495
```
96+
or just
97+
```
98+
optionsBuilder.UseFileContext();
99+
```
75100

76101
### BSONSerializer
77102

@@ -89,39 +114,53 @@ Uses [EEPlus](http://epplus.codeplex.com/documentation) implementation for .Net
89114

90115
```cs
91116
optionsBuilder.UseFileContext("excel");
117+
```
92118

93-
//use password
94-
optionsBuilder.UseFileContext("excel:password");
119+
If you want to secure the excel file with a password use:
120+
```cs
121+
optionsBuilder.UseFileContext("excel:<password>");
95122
```
96123

97124
To run on Linux-Systems
98-
99125
```
100126
sudo apt-get update
101127
sudo apt-get install libgdiplus
102128
```
103129

104130
## File Manager
105131

132+
The file manager controls how the files are stored.
133+
106134
### DefaultFileManager
107135

108-
Saves the data into files
136+
The default file manager just creates normal files.
109137

110138
```cs
111139
optionsBuilder.UseFileContext("json", "default");
112140
```
113141

114142
### EncryptedFileManager
115143

116-
Encrypts the data and saves them into files
144+
The encrypted file manager encrypts the files with a password.
145+
146+
```cs
147+
optionsBuilder.UseFileContext("json", "encrypted:<password>");
148+
```
149+
150+
## Custom file-location
151+
152+
By default the files are stored in a subfolder of your running application called `appdata`.
153+
If you want to control this behavior you can also use define a custom location.
117154

118155
```cs
119-
optionsBuilder.UseFileContext("json", "encrypted:password");
156+
optionsBuilder.UseFileContext(location: @"C:\Users\mjanatzek\Documents\Projects\test");
120157
```
121158

122159
## Multiple Databases
123160

124-
You can 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.
161+
If noting is configured all files of your application will be stored in a flat folder.
162+
You can optionally define a name for your database and all the corresponding data will saved in a subfolder.
163+
So you are able to use FileContext with multiple DbContext-configurations.
125164

126165
```cs
127166
optionsBuilder.UseFileContext(databasename: "database");

0 commit comments

Comments
 (0)