|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Caches, Datasets, and Relationsthe language. On my last project, I had two datasets. One lived in the Cache object, was very large, rarely changed, and was shared across all users of the application. The other lived in the Session object, was smaller, changed frequently, and one existed per user of the application. The first, the cacheobject in Cache, held all of the data that an application uses that rarely changes - lists of users, and all of those tables you use to populate dropdown lists. The second, the sessionobject in Session, held the data that the user was specifically working with. So if you have 20 users online, they share the cacheobject and each have thier own sessionobject. This works very well. The drop in bandwidth across all of the boxes involved in the application is large - a similar application in old school asp would have a copy of all of the data for each instance. What is bothering me is that this scenario breaks relations between tables. You have to either not add the relations between parent-child tables or remove them if they come down from the database, because you have half the data in one dataset and half the data in the other. Each dataset, from it's own perspective, is missing half of the data. You could merge the two into the sessionobject, but then you have 20 copies of the bulky metadata, one per client. So my questions are: 1) Can relations and constraints exist between the tables in two different datasets? This seems unlikely, but I might be suprised. 2) If you can have constraints between two datasets, would you then just obtain both sets of data and then apply the constraints on the web client side? 3) Who else has considered this problem? What did you come up with? As far as I know, it's not possible to have a DataRelation over more
than one table. However, it is possible to add a DataRelation to your DataSet without enforcing it as a constraint. This overload of DataRelationCollection.Add() supports a createConstraints paramater that can be set to false: http://msdn2.microsoft.com/en-us/library/5a2hh46x(VS.80).aspx You can also temporarily disable constraints using the DataSet's EnforceConstraints property, which is sometimes useful when initially filling a DataSet: DataSet.EnforceConstraints = false; HTH, Chris |
|||||||||||||||||||||||