Hi listers.
I've developmented some web application using nettiers and was very useful and fast the typed datasource controls. Now I'm beginning with the use of nettiers on winforms ... but there aren´t any control with the same functionality on Windows.
any suggestion to implement it?do use bindingsources with custom code to set Datasource property (using nettiers/services) but what about insert/delete/update methods?
any comment will be welcome.
rduque,
I've only used NetTiers for use with winforms projects, and only for a few months now (I'm still learning).
One of the first things I worked out was that the generated windows controls arnt much good - very inflexible. I dont bother generating them now. I use Infragistics controls, and bind the data to it. The basic steps for creating a form (Detail form):
1) declare and instance the service (EntitySource entitySource = new EntitySource; )
2) Populate the binding source (entityBindingSource.DataSource = entitySource.GetAll(); )
3) Bind the data to the controls (control.DataBindings.Add("Text", this.entityBindingSource, "FieldName", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation); )
To delete a record, I use something like:
Entity entity = SelectedEntity; if (EntityService.Delete(entity)) { entityBindingSource.RemoveCurrent(); }
To insert I use something like:
entityBindingSource.AddNew()
And to Update I use something like:
EntityService.Save(entity); (I have a stack of other code around this to ensure it is valid).
I'm not sure if this is what you were after - hope it helps.