Presentation is loading. Please wait.

Presentation is loading. Please wait.

2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI1. 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI2 ( Hyporhamphus sajori) 3 5 Wikipedia.

Similar presentations


Presentation on theme: "2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI1. 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI2 ( Hyporhamphus sajori) 3 5 Wikipedia."— Presentation transcript:

1 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI1

2 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI2 ( Hyporhamphus sajori) 3 5 Wikipedia

3 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI3 Sajori.NET (Cookbook of Simple Attribute-based Jokey OR-mapper Implementation for.NET) Sajori.NET (Cookbook of Simple Attribute-based Jokey OR-mapper Implementation for.NET)

4 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI4 Sajori.NET.NET Sajori.NET CLR (Base Classes, Data Provider) Database (e.g. SQL Server, PostgreSQL, …).NET Application

5 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI5 Motivation - Requirement OR Web.config Spring.NET PONO

6 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI6 Motivation - Current Situation.NET OR NHibernate iBatis.NET Spring.NET1.1 Gentle.NET Persistent S2Dao.NET … C# w

7 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI7 Sajori.NET Easy to Use PONO Easy to Embed IDbConnection or AdoDaoSupport Web.config - connectionStrings Easy to Test

8 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI8 PONO DAO

9 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI9 [Mapping(Table = "SAJORI_1")] public class Entity1 { public readonly static Type type = typeof(Entity1); private String id; [Mapping(Column = "ID_STR, UniqueKey = true)] public String Id { get { return this.id; } set { this.id = value; } } [Mapping(Column = "VALUE_STR")] public String value; } ID_STRVALUE_STR 0000Simple 1111Attribute-based 2222Jokey Table : SAJORI_1 bool NotNull SqlDbType Type int Length double Precision String Description bool Validate Relation : public field public property protected field protected property

10 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI10 [TestFixture] public class Entity1DaoTest : TransactionalTestCase { private Entity1Dao dao = new Entity1Dao(); [Test] public void FindByValue() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); Entity1 e1 = new Entity1(); e1.id = 0000; e1.value = test; this.dao.Save(e1, this.dao.CreateCommand(this.tran)); IList list = this.dao.FindByValue(test); Assert.AreEqual(1, list.Count); Assert.AreEqual(0000, list[0].Id); } DAO public class Entity1Dao : SajoriDaoTemplate { public IList FindByValue(String value, IDbCommand command) { return null; }

11 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI11 [TestFixture] public class Entity1DaoTest : TransactionalTestCase { private Entity1Dao dao = new Entity1Dao(); [Test] public void FindByValue() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); Entity1 e1 = new Entity1(); e1.id = 0000; e1.value = test; this.dao.Save(e1, this.dao.CreateCommand(this.tran)); IList list = this.dao.FindByValue(test); Assert.AreEqual(1, list.Count); Assert.AreEqual(0000, list[0].Id); } public class Entity1Dao : SajoriDaoTemplate { public IList FindByValue(String value, IDbCommand command) { return null; } DAO public class Entity1Dao : SajoriDaoTemplate { public IList FindByValue(String value, IDbCommand command) { IList list = new List (); String soql = from Entity1 t; this.FindObjects(soql, command, list); return list; }

12 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI12 public class Entity1Dao : SajoriDaoTemplate { public IList FindByValue(String value, IDbCommand command) { IList list = new List (); String soql = from Entity1 t; this.FindObjects(soql, command, list); return list; } [TestFixture] public class Entity1DaoTest : TransactionalTestCase { private Entity1Dao dao = new Entity1Dao(); [Test] public void FindByValue() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); Entity1 e1 = new Entity1(); e1.id = 0000; e1.value = test; this.dao.Save(e1, this.dao.CreateCommand(this.tran)); IList list = this.dao.FindByValue(test); Assert.AreEqual(1, list.Count); Assert.AreEqual(0000, list[0].Id); } DAO [TestFixture] public class Entity1DaoTest : TransactionalTestCase { private Entity1Dao dao = new Entity1Dao(); [Test] public void FindByValue_Old() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); Entity1 e1 = new Entity1(); e1.id = 0000; e1.value = test; this.dao.Save(e1, this.dao.CreateCommand(this.tran)); IList list = this.dao.FindByValue(test); Assert.AreEqual(1, list.Count); Assert.AreEqual(0000, list[0].Id); } [Test] public void FindByValue() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); this.PrepareData(Entity1.type); IList list = this.dao.FindByValue(test); Assert.AreEqual(2, list.Count); Assert.AreEqual(test, list[0].value); Assert.AreEqual(test, list[1].value); } EntityDaoTest- FindByValue.xls

13 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI13 [TestFixture] public class Entity1DaoTest : TransactionalTestCase { private Entity1Dao dao = new Entity1Dao(); [Test] public void FindByValue_Old() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); Entity1 e1 = new Entity1(); e1.id = 0000; e1.value = test; this.dao.Save(e1, this.dao.CreateCommand(this.tran)); IList list = this.dao.FindByValue(test); Assert.AreEqual(1, list.Count); Assert.AreEqual(0000, list[0].Id); } [Test] public void FindByValue() { this.dao.CreateTable(Entity1.type, this.dao.CreateCommand(this.tran)); this.PrepareData(Entity1.type); IList list = this.dao.FindByValue(test); Assert.AreEqual(2, list.Count); Assert.AreEqual(test, list[0].value); Assert.AreEqual(test, list[3].value); } DAO public class Entity1Dao : SajoriDaoTemplate { public IList FindByValue(String value, IDbCommand command) { IList list = new List (); String soql = from Entity1 t; this.FindObjects(soql, command, list); return list; } public class Entity1Dao : SajoriDaoTemplate { public IList FindByValue(String value, IDbCommand command) { IList list = new List (); String soql = from Entity1 t where t.value Param[] pa = { new Param(value, value); }; this.FindObjects(soql, pa, command, list); return list; }

14 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI14 [TestFixture] public class SampleModelTest : TransactionalTestCase { private Entity1Dao dao = new Entity1Dao(); [Test] public void CreateEntity1() { SampleModel model = new SampleModel(); Entity1Dao dao = new DummyEntity1Dao(); model.dao = dao; model.CreateEntity1(0000, xxxx, this.tran); Entity1 e1 = dao.SavedEntities[0] as Entity1; Assert.AreEqual(0000, e1.Id); Assert.AreEqual(xxxx, e1.value); } [IsDummy] private class DummyEntity1Dao : Entity1Dao { } public class SampleModel { public Entity1Dao dao = new Entity1Dao(); public void CreateEntity1( String id, String value, IDbTransaction tran) { } public class SampleModel { public Entity1Dao dao = new Entity1Dao(); public void CreateEntity1( String id, String value, IDbTransaction tran) { Entity1 e1 = new Entity1(); e1.Id = id; e1.value = value; this.dao.Save(e1, this.dao.CreateCommand(tran)); }

15 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI15 Miscellaneous.NET Framework 2.0 C# Spring1.1 SQL Server 2005, PostgreSQL VB, Oracle, DB2 SOQL

16 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI16 Download Sajori.NET from If you have any questions or opinions, please contact Thanks! Download Sajori.NET from If you have any questions or opinions, please contact Thanks! designed by yukinko


Download ppt "2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI1. 2007/09/01(Sat)Copyright 2007 yuichi TAKAHASHI2 ( Hyporhamphus sajori) 3 5 Wikipedia."

Similar presentations


Ads by Google