/// <summary> /// Save an instance into the database. /// </summary> /// <remarks> /// This method won't store the foreign collection values. It must be performed manually. /// </remarks> /// <param name="instance">Instance to save.</param> public static long Save(T instance) { // Check if is new object (ID <= 0) long id = ORMEntity <T> .GetPrimaryKeyValue(instance); if (id <= 0) { // Create the new instance into DB return(ORMEntity <T> .InsertDatabaseRecord(instance)); } else { // Update the instance into DB return(ORMEntity <T> .UpdateDatabaseRecord(instance)); } }