c# - DTO and bindingsource -
c# - DTO and bindingsource -
i have dto class, , in winforms client i'm creating datasource it. in form design, bind bindingsource datasource controls bound automatically.
in code next bind bindingsource empty object:
public void clear() { var dto = new mydto(); bindingsource.datasource = dto; }
to item db , display similar:
public void load(int id) { var dto = dtorequest.get(id); bindingsource.datasource = dto; }
however want know if info has changed after datasource has been set. need implement inotifypropertychanged in dto classes? because if case, defeat purpose of having dto's in first place.
are there other solutions?
i develop you, using dto side view. never used inotifypropertychanged. if want know when info has changed have utilize events of bindingsource or build properties in dto.
in add-on see reply post
how set values in cells of row in datagridview when alter field value?
and famous question
implementing inotifypropertychanged - improve way exist?
i hope i've given directions. if have questions please inquire me here.
remember lot depends on how construction our "framework" development.
with strategy i've ever completed work, not mean it's bad thought utilize inotifypropertychanged.
c# winforms dto
Comments
Post a Comment