/// <summary> /// Actually gets the next id Gets the object of type ID from the database /// with the specific name. /// </summary> /// <remarks> /// Actually gets the next id Gets the object of type ID from the database /// with the specific name. Then increment the id value and returns. If /// object does not exist, creates t. /// </remarks> /// <param name="idName"></param> /// <returns></returns> private long GetNextId(string idName) { NeoDatis.Odb.ODB odb = GetOdb(); NeoDatis.Odb.Objects objects = odb.GetObjects(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.Trigger.ID), NeoDatis.Odb.Core.Query.Criteria.Where.Equal ("idName", idName))); if (objects.IsEmpty()) { NeoDatis.Odb.Test.Trigger.ID id1 = new NeoDatis.Odb.Test.Trigger.ID(idName, 1); odb.Store(id1); return 1; } NeoDatis.Odb.Test.Trigger.ID id = (NeoDatis.Odb.Test.Trigger.ID)objects.GetFirst( ); long lid = id.GetNext(); odb.Store(id); return lid; }
/// <summary> /// Actually gets the next id Gets the object of type ID from the database /// with the specific name. /// </summary> /// <remarks> /// Actually gets the next id Gets the object of type ID from the database /// with the specific name. Then increment the id value and returns. If /// object does not exist, creates t. /// </remarks> /// <param name="idName"></param> /// <returns></returns> private long GetNextId(string idName) { NeoDatis.Odb.ODB odb = GetOdb(); NeoDatis.Odb.Objects objects = odb.GetObjects(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.Trigger.ID), NeoDatis.Odb.Core.Query.Criteria.Where.Equal ("idName", idName))); if (objects.IsEmpty()) { NeoDatis.Odb.Test.Trigger.ID id1 = new NeoDatis.Odb.Test.Trigger.ID(idName, 1); odb.Store(id1); return(1); } NeoDatis.Odb.Test.Trigger.ID id = (NeoDatis.Odb.Test.Trigger.ID)objects.GetFirst( ); long lid = id.GetNext(); odb.Store(id); return(lid); }