P
Peter K
Hi
I have an existing web-application, with some "backend" code which fetches
data from a database (and is used on a website).
Now I need to write a webservice which calls some of these backend
functions, and exposes data to clients.
But the backend code is written using interfaces, so I don't actually get
concrete types returned - so I can't return them via a webservice (as far as
I know).
For example, there is a backend function in a UserDataAccess class, like:
IUser GetUser(long id);
If I want to expose this via a webservice, do I need to write my own
concrete "User" object, which I instantiate in my webservice based on the
IUser instance I get from the backend, before returning it to the client?
Sometimes, I am getting lists/arrays from the backend:
IUser[] GetUserList();
So here, do I need to loop through the entire list, converting each object
to my own "concrete type", before returning?
Is there a better way?
Thanks,
Peter
I have an existing web-application, with some "backend" code which fetches
data from a database (and is used on a website).
Now I need to write a webservice which calls some of these backend
functions, and exposes data to clients.
But the backend code is written using interfaces, so I don't actually get
concrete types returned - so I can't return them via a webservice (as far as
I know).
For example, there is a backend function in a UserDataAccess class, like:
IUser GetUser(long id);
If I want to expose this via a webservice, do I need to write my own
concrete "User" object, which I instantiate in my webservice based on the
IUser instance I get from the backend, before returning it to the client?
Sometimes, I am getting lists/arrays from the backend:
IUser[] GetUserList();
So here, do I need to loop through the entire list, converting each object
to my own "concrete type", before returning?
Is there a better way?
Thanks,
Peter