Inheritance: Newtonsoft.Json.JsonSerializerSettings
示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public DataStore(SerializerSettings serializerSettings)
 {
     this.SerializerSettings = serializerSettings;
     _objects = new Dictionary<string, StoredObject>();
 }
示例#4
0
 public DataStore(SerializerSettings serializerSettings)
 {
     this.SerializerSettings = serializerSettings;
     _objects = new Dictionary <string, StoredObject>();
 }