You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/storage/sql-storage/index.md
+47-57Lines changed: 47 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -5,67 +5,57 @@ layout: submenu
5
5
## {{page.title}}
6
6
7
7
8
-
By default, journal files and snapshots are written to the file system. Storage is configurable and supports writing the journal to a relational database taking advantage of existing infrastructure and operations. Also, the journal can be queried/manipulated using regular SQL.
8
+
Storage is configurable. By default, journal files and snapshots are written to the file system. Using Sql Storage, The journal can be stored in a relational database, allowing you to take advantage of existing infrastructure and operations. Also, the journal can be queried/manipulated using regular SQL.
9
9
10
-
The first step is to set the storage type:
10
+
Sql Storage uses the DbProviderFactories of NET.
11
+
The built-in providers are MsSqlProvider and OleDbProvider.
12
+
13
+
Sql storage is flexible, you can supply custom statements for initializing, reading and writing entries.
14
+
15
+
The default table has these columns:
16
+
17
+
Name | Type | Description
18
+
---- | ---- | -----
19
+
Id | ulong | The unique sequential id of the journal entry
20
+
Created | DateTime | When the command was executed
21
+
Type | String | The type name of the command executed
22
+
Data | Binary or string | The serialized command
23
+
24
+
To enable sql storage set the storage type for journaling to Sql:
11
25
12
26
```csharp
13
27
varconfig=newEngineConfiguration();
14
28
config.JournalStorage=StorageType.Sql;
29
+
varengine=Engine.For<MyDb>(config);
30
+
```
31
+
32
+
The default settings assume a connection string entry in the application configuration file named 'origo':
The providerName must be one the following supported providers or a custom provider. See Custom Providers below.
41
+
42
+
* System.Data.SqlClient
43
+
* System.Data.OleDbClient
44
+
* System.Data.OdbcClient
45
+
46
+
Here are the default settings, which can be assigned new values. The `ConnectionString` property can be assigned either a connection string name in the application configuration file or an actual connection string.
Providers derive from SqlProvider and supply the vendor specific sql statements for reading and writing the journal. Custom providers need to be registered using the name and a constructor function taking a SqlSettings as input:
0 commit comments