Last post Mar 14, 2010 02:41 PM by DigiMortal
Mar 13, 2010 11:31 AM|studotnet|LINK
Here is the scenario.
Every project has a Supervisor.
When I select the supervisor for a particular project, I'm using a dropdownlist.Table is like this
ProjectId | SupervisorId | ......
1 | 1
In my application, I'm binding a Collection of Supervisor type, which I'm feeling that it is an additional overhead. Becuase I only want his ID. So binding an object collection to the dropdown which seems no worth.
Am I correct..? or are there any other better way to do this..?
Mar 13, 2010 01:24 PM|DigiMortal|LINK
If you business layer gives you supervisors list then you should use it. I don't know how your DAL works and therefore I really cannot say if there is some overhead or not. If your business layer is able to ask Id-Title pairs for objects from DAL then you
can use this functionality. If it doesn't then you should be happy with list of supervisors.
To get supervisor objects or to get objects with their ID-s requires basically the same code. The difference is only in object type and in the cound of properties you have to assign. If you have a l ot of supervisors then this may be the issue but in this
case you don't use dropdown anymore because it is hard to use with many options in it.
Mar 13, 2010 11:18 PM|studotnet|LINK
Thanks for replying.
I can customize the DAL as I want.
What is the best method to do this..? Use a Hashtable ????
Mar 14, 2010 04:21 AM|DigiMortal|LINK
I think the best idea is to create Supervisor objects and use them. Don't start trashing your DAL and making something very smart there if it is not provided by DAL (one point from my little survival guide :)). To get better idea about your toolset I want
to ask do you use some O/R-mapper (NHibernate, Entity Framework) for DAL or do you have manually written DAL?
Mar 14, 2010 01:20 PM|studotnet|LINK
No I have a custom DAL.
One of issue in my mind is, what is the use of load all the properties of Supervisor objects. I mean, I surely know I only use two properties, SupervisorID (get the value) and Name (to display). To me, it seems a wastage. Even I would like to use some dictionary
type read-only collection.
I want to know the best way to handle this.
Mar 14, 2010 02:41 PM|DigiMortal|LINK
You can cache objects created for current request (first level cache) or for all requests (second level cache) so you don't have to worry about performance right now. In the real world you start optimizing so narrow things after you have implemented at least
first level cache. As it comes to this point you should this way or other solve the much wider problem - how to decrease the load of database.