Help with creating strongly typed DataSet

G

Guest

I'm designing an extranet web site that customers will use to log in and see their account history, make payments against their balance, etc.

I've declared a strongly typed DataSet as a public static object in the main accounts page - "public Customer.DataSet dsMyData = new Customer.DataSet();" and populate the tables with information about the account, services, etc which are referenced from the other pages as such: lblEMail.Text = CustScreen.dsMyData.Account[0].EMail;

Everything works great until two customers log in at roughtly the same time. Because the DataSet object is static, the second customer overwrites the DataSet with their account information, at which both customers see the information for the customer who logged in second.

Clearly, using a static object isn't going to work in an environment where multiple accounts are logging in at the same time. What would be the correct method for creating a strongly typed dataset that is unique to each asp.net session?

Thanks in advance for your help,

Andre
 
R

Rick Strahl [MVP]

Hi Andre,

You should be recreating your DataSet for each Web request unless the data
in the DataSet itself is static and read-only. If it's Read/Write data you
should reload on each hit in typical fashion for a stateless Web
application.

If your app is low volume you can also cache your DataSet in the Session
object on a per user basis, but in general this isn't a good idea and it may
cost you more in serialization than it does to pull the data as needed ffrom
the database.

Regards,

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web


Andre Ranieri said:
I'm designing an extranet web site that customers will use to log in and
see their account history, make payments against their balance, etc.
I've declared a strongly typed DataSet as a public static object in the
main accounts page - "public Customer.DataSet dsMyData = new
Customer.DataSet();" and populate the tables with information about the
account, services, etc which are referenced from the other pages as such:
lblEMail.Text = CustScreen.dsMyData.Account[0].EMail;
Everything works great until two customers log in at roughtly the same
time. Because the DataSet object is static, the second customer overwrites
the DataSet with their account information, at which both customers see the
information for the customer who logged in second.
Clearly, using a static object isn't going to work in an environment where
multiple accounts are logging in at the same time. What would be the
correct method for creating a strongly typed dataset that is unique to each
asp.net session?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top