C#: Partial Classes & Web Services: Separating form and functionality -
i dabbling in world of web services , i've been making simple web service mimics mathematical operations. firstly simple, passing in 2 integers , binary operator applied these (plus, minus etc) depending on method called.
then decided make things little more complex , started passing objects around, discovered web service exposes data side of class , not functional side.
i told way deal make class on service side partial class (this side of class encapsulating form) , on client side have partial class (where side of class encapsulates functionality). seems elegant way of doing things..
so, have set 2 classes described above, doesn't seem working told.
is attempting possible? if so, going wrong?
partial classes tool separate auto-generated code developer code.
a example windows forms designer in vs, or new dbml linq datacontext generated code.
there's argument using them vss style source control providers 1 user can edit file @ 1 time.
it's not idea use them logical separation of functionality - division exists pre-compilation. compile 1 class, not 1 it's easy debug or track operations inside.
what you've described sounds situation using wcf contracts. in case both client , server share interface (or interfaces).
your complex code go there , unit tested separately - i.e. outside of connected application. when bugs found can eliminate code issues , move investigating connection related ones instead.
Comments
Post a Comment