Beispiel #1
0
        public void Save(LoggedEvent newEvent)
        {
            using (var db = new LiteDatabase(_databaseConnectionStrings.LiteDbConnection()))
            {
                // Get a collection (or create, if doesn't exist)
                var col = db.GetCollection <LoggedEvent>("UserEvents");

                // Insert new customer document (Id will be auto-incremented)
                col.Insert(newEvent);

                col.EnsureIndex(x => x.AggregateId);

                //// Use LINQ to query documents (filter, sort, transform)
                //var results = col.Query()
                //    .Where(x => x.Name.StartsWith("J"))
                //    .OrderBy(x => x.Name)
                //    .Select(x => new { x.Name, NameUpper = x.Name.ToUpper() })
                //    .Limit(10)
                //    .ToList();
            }
        }
        public void Save(LoggedEvent newEvent)
        {
            newEvent.Id = Guid.NewGuid();

            _events.Add(newEvent);
        }