Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey Everyone,

I am trying to get some information/best practices for querying multiple complex objects from a database to my c# objects. I feel that my current process is not performing as well as it could be.

I have a custom written DataAccess class that opens a connection, gets a DataSet and then closes the connection. So when I query 100 complex objects like this I am essentially iterating over the IDs that I need to get and making a database call for each. Any ideas/methodologies to get me going? Thanks!

ATCSharp
Posted
Comments
Sergey Alexandrovich Kryukov 12-May-14 16:33pm    
The question is too vague. People query complex objects all the time. Are you talking about object-relational mapping? Object-relational databases? Anything else?
Also, "not performing as well as it could be" is not informative. Maybe it is not — we have no idea what is your "current process" is.
So far, there is nothing to talk about. You need to be way more certain in your questions.

This is not yet a question, only a prolog to some questions; but this is not how the forum works.

—SA
Prasad Avunoori 12-May-14 23:03pm    
What's your problem?

1 solution

What I usually do is set each object of the dataset into a class and make a Dictionary.

eg. You select a bunch of persons from the person table. You create a Person class and each row is a new instance added to a Dictionary that has the tables primary key value as Dictionary key and the Person class instance as value.

But I agree with the comments that your question is a bit vague. However the solution I mentioned is pretty common.

If you're working with SQL Server, consider LINQ to SQL.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900