File tree Expand file tree Collapse file tree 3 files changed +32
-14
lines changed Expand file tree Collapse file tree 3 files changed +32
-14
lines changed Original file line number Diff line number Diff line change 66
77namespace Memstate . Configuration
88{
9+
910 public sealed class Config
1011 {
1112 /// <summary>
@@ -154,12 +155,9 @@ public void SetStorageProvider(StorageProvider storageProvider)
154155 }
155156
156157 /// <summary>
157- /// Name of a well known storage provider OR resolvable type name
158- /// OR the literal "Auto" (which is default) for automatic resolution.
159- /// Automatic resolution will take the first available of eventstore,
160- /// postgres or filestorage.
158+ /// Name of a well known storage provider OR resolvable type name.
161159 /// </summary>
162- public string StorageProviderName { get ; set ; } = "Auto" ;
160+ public string StorageProviderName { get ; set ; } = StorageProviders . FILE ;
163161
164162 public StorageProvider GetStorageProvider ( )
165163 {
@@ -181,7 +179,7 @@ public StorageProvider GetStorageProvider()
181179 /// Name of a well known serializer or resolvable type name OR the value Auto (default)
182180 /// </summary>
183181 /// <value>The name of the serializer.</value>
184- public string SerializerName { get ; set ; } = "Auto" ;
182+ public string SerializerName { get ; set ; } = Serializers . AUTO ;
185183
186184 private object Convert ( string value , Type type )
187185 {
Original file line number Diff line number Diff line change @@ -4,8 +4,25 @@ namespace Memstate
44{
55 internal class Serializers : Providers < ISerializer >
66 {
7- public const string Wire = "Memstate.Wire.WireSerializerAdapter, Memstate.Wire" ;
8- public const string NewtonSoftJson = "Memstate.JsonNet.JsonSerializerAdapter, Memstate.JsonNet" ;
7+
8+
9+ /// <summary>
10+ /// Take the first available serializer in the order: Newtonsoft.Json, Wire.
11+ /// </summary>
12+ public const string AUTO = "Auto" ;
13+
14+ /// <summary>
15+ /// Wire binary serializer
16+ /// </summary>
17+ public const string WIRE = "Wire" ;
18+
19+ /// <summary>
20+ /// NewtonSoft JSON serializer
21+ /// </summary>
22+ public const string NEWTONSOFT_JSON = "Newtonsoft.Json" ;
23+
24+ private const string Wire = "Memstate.Wire.WireSerializerAdapter, Memstate.Wire" ;
25+ private const string NewtonSoftJson = "Memstate.JsonNet.JsonSerializerAdapter, Memstate.JsonNet" ;
926
1027 public Serializers ( )
1128 {
Original file line number Diff line number Diff line change @@ -5,22 +5,25 @@ namespace Memstate
55{
66 internal class StorageProviders : Providers < StorageProvider >
77 {
8+ //well known storage provider names
9+ public const string EVENTSTORE = "EventStore" ;
10+ public const string FILE = "File" ;
11+ public const string POSTGRES = "Postgres" ;
12+
13+
814 private const string EventStoreProviderType = "Memstate.EventStore.EventStoreProvider, Memstate.EventStore" ;
915
1016 private const string PostgresProviderType = "Memstate.Postgres.PostgresProvider, Memstate.Postgres" ;
1117
1218 public StorageProviders ( )
1319 {
14- Register ( "auto" , AutoResolve ) ;
15- Register ( "file" , ( ) => new FileStorageProvider ( ) ) ;
16- Register ( "EventStore" , ( ) => InstanceFromTypeName ( EventStoreProviderType ) ) ;
17- Register ( "Postgres" , ( ) => InstanceFromTypeName ( PostgresProviderType ) ) ;
20+ Register ( FILE , ( ) => new FileStorageProvider ( ) ) ;
21+ Register ( EVENTSTORE , ( ) => InstanceFromTypeName ( EventStoreProviderType ) ) ;
22+ Register ( POSTGRES , ( ) => InstanceFromTypeName ( PostgresProviderType ) ) ;
1823 }
1924
2025 protected override IEnumerable < string > AutoResolutionCandidates ( )
2126 {
22- yield return "eventstore" ;
23- yield return "postgres" ;
2427 yield return "file" ;
2528 }
2629 }
You can’t perform that action at this time.
0 commit comments