public void CreateManyRecordsAndRetrieveWithAutoGen() { var keys = new List <uint>(); _db = new JellyDatabase(_connectionString); _db.RegisterIdentityProperty <TestEntity, uint>(e => e.Id, true); for (int i = 0; i < 500; i++) { using (var session = _db.CreateSession()) { var entity = TestEntity.CreateTestEntity(i); session.Store <TestEntity>(entity); keys.Add(entity.Id); } } _db.Dispose(); _db = new JellyDatabase(_connectionString); _db.RegisterIdentityProperty <TestEntity, uint>(e => e.Id, true); foreach (var key in keys) { using (var session = _db.CreateSession()) { var retrieved = session.Load <uint, TestEntity>(key); Assert.AreEqual(key, retrieved.Id); } } }
public void CreateDatabaseClientSaveAndRetrieve() { uint key; _db = new JellyDatabase(_connectionString); using (var session = _db.CreateSession()) { _db.RegisterIdentityProperty <TestEntity, uint>(entity => entity.Id, true); var created = TestEntity.CreateTestEntity(2); session.Store(created); key = created.Id; } using (JellyDatabase db = new JellyDatabase(@"c:\temp\jelly\jelly.db")) using (var session = db.CreateSession()) { db.RegisterIdentityProperty <TestEntity, uint>(entity => entity.Id, true); var retrieved = session.Load <uint, TestEntity>(key); } }
public void CreateDataBaseAndRegisterIdentityGenerator() { var db = new JellyDatabase(_connectionString); db.RegisterIdentityProperty <TestEntity, uint>(e => e.Id, true); }