Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking changes #608

Open
fairking opened this issue May 12, 2021 · 0 comments
Open

Tracking changes #608

fairking opened this issue May 12, 2021 · 0 comments

Comments

@fairking
Copy link

fairking commented May 12, 2021

Would be cool if PetaPoco could track changes and update only columns which have been changed.
There is a nice example how to acheve it: https://gist.github.com/fairking/7c07a5af6af49d5da8ccd285020a66ec
In the same way how nhibernate is doing it, but in much simple way.
Example:

public class Article
{
    public virtual int Id { get; set; }
    public virtual string Name { get; set; }
    public virtual string Description { get; set; }
}

var article = db.Single<Article>(123); // Returns proxy

article.Name = "Other name";

Db.Update(article); // Produces: update article set name = 'Other name' where id = 123;
// No description included into the query
// All article's changes are flushed after the update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant