Ejemplo n.º 1
0
        // possiveis consultas
        // Listar todos os alunos de determinado professor
        // Listar alunos com nota abaixo de x
        // Listar disciplinas que um professor ministrou no semestre
        /// <exception cref="System.Exception"></exception>
        public virtual void Test1()
        {
            if (!isLocal)
            {
                return;
            }
            NeoDatis.Odb.ODB odb = Open("t-school.neodatis");
            // List students by name
            SchoolNativeQueryStudent natQuery = new SchoolNativeQueryStudent("Brenna", 23);

            NeoDatis.Odb.Objects <Student> students  = odb.GetObjects <Student>(natQuery);
            SchoolSimpleNativeQueryStudent sNatQuery = new SchoolSimpleNativeQueryStudent("Brenna");

            students = odb.GetObjects <Student>(sNatQuery);
            // list disciplines of one teacher by semester
            SchoolNativeQueryTeacher natQuery2 = new SchoolNativeQueryTeacher
                                                     ("Jeremias");

            NeoDatis.Odb.Objects <History> historys       = odb.GetObjects <History>(natQuery2);
            System.Collections.Hashtable   listDiscipline = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, Discipline>();
            for (System.Collections.IEnumerator iter = historys.GetEnumerator(); iter.MoveNext
                     ();)
            {
                History h = (History)iter
                            .Current;
                listDiscipline.Add(h.GetDiscipline().GetName(), h.GetDiscipline());
            }
            odb.Close();
        }
Ejemplo n.º 2
0
        public virtual void TestGetObects3()
        {
            string baseName = GetBaseName();

            NeoDatis.Odb.ODB odb = Open(baseName);
            odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("Test"));
            NeoDatis.Odb.Objects <NeoDatis.Odb.Test.VO.Login.Function> functions = odb.GetObjects
                                                                                       (typeof(NeoDatis.Odb.Test.VO.Login.Function));
            System.Collections.Generic.IEnumerator <NeoDatis.Odb.Test.VO.Login.Function> iterator
                = functions.GetEnumerator();
            NeoDatis.Odb.Test.VO.Login.Function f = iterator.Current;
            odb.Close();
            AssertEquals(1, functions.Count);
        }