views:

41

answers:

0

I have a basic object for saving to SQLite using SubSonic, the Save method is shown below...

Adding and Updating the repository works, I then gave a Get Method that returns then gets the object back out the repository using its ID, however the ID at that point (on "this") has changed.

Note: the ID type is a string representing a Guid. A Guid gets saved and this case the ID returned is always 1 (on a new database)

The ID in th class is defined as:

[SubSonicPrimaryKey()]
public string ID { get; set; }

SAVE METHOD

public MyObject Save()
        {
            var repository = Made4Print.SQLite.Repository;

            if (_IsNew)
            {
                repository.Add(this);
            }
            else
            {
                repository.Update(this);
            }

            return Get(this.ID);
        }