Pregunta

Is Anybody having petapoco source code with partial update? According to the petapoco document, this feature should be there.

http://www.toptensoftware.com/Articles/116/PetaPoco-Partial-Record-Updates

But I've downloaded the source code from github but the partial update is missing. If someone has the source code with partial update, please share with me.

¿Fue útil?

Solución

There are two "versions" of the partial update method in the current version on Github (maybe you need to pull the changes). One is on the Database class:

public int Update(object poco, IEnumerable<string> columns)

Github: https://github.com/CollaboratingPlatypus/PetaPoco/blob/adfbde3207a94d0de5c74188d8d1b5801a8be0b9/PetaPoco/PetaPoco.cs#L1433 line number 1443

Usage: db.Update(u, new string[] { "last_login" }); where db is an instance of Database

And the the another one is in the TT generated Record class:

public int Update(IEnumerable<string> columns) { return repo.Update(this, columns); }

Github: https://github.com/CollaboratingPlatypus/PetaPoco/blob/adfbde3207a94d0de5c74188d8d1b5801a8be0b9/PetaPoco/Models/Generated/PetaPoco.Generator.ttinclude#L73 line number 73

Usage : u.Update(new string[] { "last_login" }); where u is a TT generated Record<T>

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top