示例#1
0
        /// <summary>
        ///   Open a persistence session.
        /// </summary>
        public virtual void OpenSession()
        {
            if (IsSessionOpened)
            {
                throw new InvalidOperationException("MemoDb session already open");
            }

            var session = Memo.CreateSession();

            CurrentSession = session;
        }
示例#2
0
        static DataWrapper()
        {
            Db = new Memo();
            Db.Map <SampleEntity>();

            // populate in-memory database
            using (var s = Db.CreateSession())
            {
                Array.ForEach(SampleEntity.GetSampleEntities().ToArray(), e => s.Insert(e));
                s.Flush();
            }
        }