public PieDatabase(TransactionStore store, SerializerSettings settings = null, Func<DataStore> createDataStore = null) { settings = settings ?? new SerializerSettings(); createDataStore = createDataStore ?? (() => new DataStore(settings)); var writeTransaction = new Func<GenericTransaction<DataStore>, string>( tran => JsonConvert.SerializeObject(tran, settings)) .Then(Funcs.AppendStringToStream); var readTransactions = Funcs.StreamToStreamReader.Then(Funcs.ReadStringsFromStreamReader) .ThenForEach( str => JsonConvert.DeserializeObject<GenericTransaction<DataStore>>(str, settings)); _transactionLog = new TransactionLog<DataStore>(createDataStore, writeTransaction, readTransactions, store); DataStore = new Lazy<DataStore>(() => _transactionLog.Value); }
public PieDatabase(TransactionStore store, SerializerSettings settings = null, Func <DataStore> createDataStore = null) { settings = settings ?? new SerializerSettings(); createDataStore = createDataStore ?? (() => new DataStore(settings)); var writeTransaction = new Func <GenericTransaction <DataStore>, string>( tran => JsonConvert.SerializeObject(tran, settings)) .Then(Funcs.AppendStringToStream); var readTransactions = Funcs.StreamToStreamReader.Then(Funcs.ReadStringsFromStreamReader) .ThenForEach( str => JsonConvert.DeserializeObject <GenericTransaction <DataStore> >(str, settings)); _transactionLog = new TransactionLog <DataStore>(createDataStore, writeTransaction, readTransactions, store); DataStore = new Lazy <DataStore>(() => _transactionLog.Value); }
public DataStore(SerializerSettings serializerSettings) { this.SerializerSettings = serializerSettings; _objects = new Dictionary<string, StoredObject>(); }
public DataStore(SerializerSettings serializerSettings) { this.SerializerSettings = serializerSettings; _objects = new Dictionary <string, StoredObject>(); }