1. Aaron D'Hooghe
  2. SnapObjects
  3. Tuesday, 17 October 2023 08:00 AM UTC

Hello,

 

I am using the SqlModelMapper of snapobject to retrieve/create/update/delete records in my database. My database is a sybase sql anywhere 17 using a odbc connection.

 

The retrieve/create/delete methodes work just fine, but the update (TrackUpdate) doesn't seem to work. When i open the profiler on my database, no update statement is received when i execute the TrackUpdate() methode. Only a commit statement is received but no acual update statement. When i use the TrackCreate() or TrackDelete() methode the database does recieve a insert and delete statement.

If i look at the output window, it just says "Database transaction has been committed".

Is it possible that the TrackUpdate methode doesn't work, or does it nog work with odbc?

 

This is my update methode:

public async Task<int> UpdateProductAsync(Product product)
{
     _dataContext.SqlModelMapper.TrackUpdate(product);

     return (await _dataContext.SqlModelMapper.SaveChangesAsync()).ModifiedCount;
}

 

This is my product class:

[FromTable("products", Schema = "dba")]
[SqlOrderBy("product_id")]
public class DosDossier
{
   [Key]
   [SqlColumn("product_id")]
   public int Id { get; set; }


   [SqlColumn("product_nbr ")]
   public decimal ProductNbr { get; set; }


   [SqlColumn(product_name ")]
   public string ProductName { get; set; }

}

Kind regards.

Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 17 October 2023 14:45 PM UTC
  2. SnapObjects
  3. # 1

Hi Aaron,

 

Could it be that you're not actually making any changes to the model between TrackUpdate() and SaveChanges()?

TrackUpdate should be called before you start making changes to the model, so that it can track the chances to save.

 

Regards,
Francisco

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.