예제 #1
0
        public void SimpleTransactionTest()
        {
            var store = new SqlCeDataStore("test_trans.sdf");

            store.AddType <LateAddItem>();

            if (store.StoreExists)
            {
                store.DeleteStore();
            }
            store.CreateStore();

            var testEntity = new LateAddItem()
            {
                ID = -1
            };

            store.Insert(testEntity);

            var id = testEntity.ID;

            store.BeginTransaction();
            store.Delete <LateAddItem>(id);
            // timeout here, at insert
            store.Insert(new LateAddItem()
            {
                ID = -1
            });
            store.Commit();
        }
예제 #2
0
        private SqlCeDataStore Initialize()
        {
            var store = new SqlCeDataStore("pubs.sdf");

            if (store.StoreExists)
            {
                store.DeleteStore();
            }

            store.ConnectionBehavior = ConnectionBehavior.Persistent;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            store.DiscoverTypes(Assembly.GetExecutingAssembly());
            sw.Stop();
            Debug.WriteLine(string.Format("SQL CE Store Discover:\t{0}s", sw.Elapsed.TotalSeconds));

            sw.Start();
            store.CreateStore();
            sw.Stop();
            Debug.WriteLine(string.Format("SQL CE Store Create:\t{0}", sw.Elapsed.TotalSeconds));

            CreateTestData(store);

            return(store);
        }
예제 #3
0
        public void BuildCleanDB()
        {
            m_store = new SqlCeDataStore("testDB.sdf");

            if (m_store.StoreExists)
            {
                m_store.DeleteStore();
            }
            m_store.CreateStore();

            m_store.AddType <TestItem>();
        }
예제 #4
0
        public DataService()
        {
            m_store = new SqlCeDataStore("MyData.sdf");

            m_store.DeleteStore();

            if (!m_store.StoreExists)
            {
                m_store.CreateStore();
            }

            m_store.AddType <Customer>();
            m_store.AddType <ProductOrder>();
            m_store.AddType <ShipAddress>();
            m_store.AddType <State>();

            m_store.EnsureCompatibility();
        }
예제 #5
0
        public void Initialize()
        {
            Store = new SqlCeDataStore("pubs.sdf");
            if (Store.StoreExists)
            {
                Store.DeleteStore();
            }

            Store.ConnectionBehavior = ConnectionBehavior.Persistent;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            Store.DiscoverTypes(Assembly.GetExecutingAssembly());
            sw.Stop();
            Debug.WriteLine(string.Format("SQL CE Store Discover:\t{0}s", sw.Elapsed.TotalSeconds));

            sw.Start();
            Store.CreateStore();
            sw.Stop();
            Debug.WriteLine(string.Format("SQL CE Store Create:\t{0}", sw.Elapsed.TotalSeconds));

            CreateTestData();
        }