public virtual void Test1() { NeoDatis.Tool.IOUtil.DeleteFile("base1.neodatis"); NeoDatis.Odb.ODB odb = NeoDatis.Odb.ODBFactory.Open("base1.neodatis"); string[] fields = new string[] { "int1" }; odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).AddUniqueIndexOn ("index1", fields, true); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); int size = 50; for (int i = 0; i < size; i++) { NeoDatis.Odb.Test.VO.Attribute.TestClass testClass = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); testClass.SetBigDecimal1(new System.Decimal(i)); testClass.SetBoolean1(i % 3 == 0); testClass.SetChar1((char)(i % 5)); testClass.SetDate1(new System.DateTime(start + i)); testClass.SetDouble1(((double)(i % 10)) / size); testClass.SetInt1(size - i); testClass.SetString1("test class " + i); odb.Store(testClass); } // println(testClass.getDouble1() + " | " + testClass.getString1() + // " | " + testClass.getInt1()); odb.Close(); }
public virtual void Test1() { NeoDatis.Tool.IOUtil.DeleteFile("base1.neodatis"); NeoDatis.Odb.ODB odb = NeoDatis.Odb.ODBFactory.Open("base1.neodatis"); string[] fields = new string[] { "int1" }; odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).AddUniqueIndexOn ("index1", fields, true); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); int size = 50; for (int i = 0; i < size; i++) { NeoDatis.Odb.Test.VO.Attribute.TestClass testClass = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); testClass.SetBigDecimal1(new System.Decimal(i)); testClass.SetBoolean1(i % 3 == 0); testClass.SetChar1((char)(i % 5)); testClass.SetDate1(new System.DateTime(start + i)); testClass.SetDouble1(((double)(i % 10)) / size); testClass.SetInt1(size - i); testClass.SetString1("test class " + i); odb.Store(testClass); } // println(testClass.getDouble1() + " | " + testClass.getString1() + // " | " + testClass.getInt1()); odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void TestDatePersistence() { NeoDatis.Odb.ODB odb = null; DeleteBase("date.neodatis"); try { odb = Open("date.neodatis"); NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc1.SetDate1(new System.DateTime()); long t1 = tc1.GetDate1().Millisecond; odb.Store(tc1); odb.Close(); odb = Open("date.neodatis"); NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass )); AssertEquals(1, l.Count); NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass )l.GetFirst(); AssertEquals(t1, tc2.GetDate1().Millisecond); AssertEquals(tc1.GetDate1(), tc2.GetDate1()); } finally { if (odb != null) { odb.Close(); } } DeleteBase("date.neodatis"); }
private NeoDatis.Odb.Test.VO.Attribute.TestClass GetTestClassInstance() { NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc.SetBigDecimal1(new System.Decimal(1.123456789)); tc.SetBoolean1(true); tc.SetChar1('d'); tc.SetDouble1(154.78998989); tc.SetInt1(78964); tc.SetString1("Ola chico como vc est√° ???"); tc.SetDate1(new System.DateTime()); return tc; }
private NeoDatis.Odb.Test.VO.Attribute.TestClass GetTestClassInstance() { NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc.SetBigDecimal1(new System.Decimal(1.123456789)); tc.SetBoolean1(true); tc.SetChar1('d'); tc.SetDouble1(154.78998989); tc.SetInt1(78964); tc.SetString1("Ola chico como vc est√° ???"); tc.SetDate1(new System.DateTime()); return(tc); }
/// <exception cref="System.Exception"></exception> public virtual void TestDatePersistence() { NeoDatis.Odb.ODB odb = null; DeleteBase("date.neodatis"); try { odb = Open("date.neodatis"); NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc1.SetDate1(new System.DateTime()); long t1 = tc1.GetDate1().Millisecond; odb.Store(tc1); odb.Close(); odb = Open("date.neodatis"); NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass )); AssertEquals(1, l.Count); NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass )l.GetFirst(); AssertEquals(t1, tc2.GetDate1().Millisecond); AssertEquals(tc1.GetDate1(), tc2.GetDate1()); } finally { if (odb != null) { odb.Close(); } } DeleteBase("date.neodatis"); }