public void TestJoin() { using (IDatabaseAdapter adapter = new DatabaseAdapter(m_Connection)) { CountryEntity country = new CountryEntity(); country.Name = "Switzerland"; EntityUpdater insert = new EntityUpdater(country, UpdateAction.Insert); adapter.CommitEntity <CountryEntity>(ref insert); CheeseEntity emental = new CheeseEntity(); emental.Name = "Emmental"; emental.CountryID = country.CountryID; insert = new EntityUpdater(emental, UpdateAction.Insert); adapter.CommitEntity <CheeseEntity>(ref insert); adapter.CommitEntity <CheeseEntity>(ref insert); adapter.CommitEntity <CheeseEntity>(ref insert); CheeseEntity[] swissCheese = adapter.FetchEntities <CheeseEntity>( new EntityFetcher <CheeseEntity>(CountryEntity.CountryEntityFields.CountryID == country.CountryID) .AddJoinPath(CheeseEntity.CheeseEntityFields.CountryID.Join(JoinType.Inner, CountryEntity.CountryEntityFields.CountryID))); Assert.GreaterOrEqual(swissCheese.Length, 3); } }
public void TestInsert() { CheeseEntity entity = new CheeseEntity(); entity.Name = "Emental"; using (IDatabaseAdapter adapter = new DatabaseAdapter(m_Connection)) { EntityUpdater insert = new EntityUpdater(entity, UpdateAction.Insert); adapter.CommitEntity <CheeseEntity>(ref insert); } Assert.Greater(entity.CheeseID, 0); }