A1VBCode Forums

The Object Dilemma


http://a1vbcode.com/vbforums/Topic28306.aspx

By maramusa - 10/20/2009

This must be a time old question to do with Modularisation, encapsulation and RE-USABILITY.



I have an asp.net 3.5 vb.net intranet application.



I have a Job class. i have a Client class and employee class etc etc

I am using the dataset designer, and formviews.



I have a formview for my Job object. A job has a clientID. But in my formview, when i display a job, I want to show the ClientName obviously. This can be done in the formview Edit Template, by linking the ClientID field to a datasource (or object datasource)that has the Client table, the a simple INNER JOIN to get the ClientName. Easy, no code, nice.

But I dont want to have to go to the data access layer to get the ClientName. I want to be able to call the Client object like Client.Name.



I guess I could do this with a Webservice (or WCF which i havent used yet). But this seems like a big overhead using SOAP and HTTP just to get a ClientName with an INNER JOIN. We have 100 users and the clientname will be getting accessed all the time.



I guess I could use a stored procedure, but how would I link this to my Formview to show the ClientName. When Editing or Inserting a JOB, I still want the user to be able to select the ClientName form a dropdown which is linked to ClientID. So I still need a datasource right.



LINQ ???, but



I want my Client object to be in a separate application, that any other application can access, so no need to redo the DAL everytime. Yes, Im trying to do a framework.

If the Client object has fucntion that require logic, these i would obviously use a webservice or WCF, but for simple INNER JOINs and stuff, I'm stuck at the best way to be able to call these form any other application in formviews or the like.



Thanks for any ideas