Object Spaces programming model for an ASP.NET scenario

I just posted these questions on the microsoft.public.objectspaces newsgroup:
 
Lately, I've been wondering what the preferred or best programming model for OS is, in an ASP.NET scenario. By this I mean: how would you program with ObjectSpace or ObjectSet objects in a multithreaded/multiuser environment in a way that is most suited for OS?
An ASP.NET application typically has multiple concurrent users. ASP.NET itself is multithreaded. Some thoughts in that regard that crossed my mind:
 
  • Seems to me that an ObjectSpace object is typically expensive to create. How expensive is it in reality? Is creation of a new ObjectSpace object on every http request a smart thing to do or not to do?
  • If the answer to the point above is "don't do that", would you create one ObjectSpace or ObjectContext for every user and store it in session state (because it seems that you will need to track your objects: see point below)? Or, would you just store it in cache or application state? The documentation says: "Thread Safety: Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe." Hence, having a shared ObjectSpace or ObjectContext object does not seem like a good idea.
  • Say you would not be able to cache or store your ObjectContext (or ObjectSpace or ObjectSet) object, and you want to update your changed business object. As you were unable to track any changes, a database roundtrip seems necessary. You could either materialize the object again, transfer the values from the changed object onto the retrieved one and call PersistChanges. Or just call Resync on the object an then call PersistChanges. Is the only way to update an object without a roundtrip one where you have a tracked original? (Just like you need to retrieve the object before you can delete it using ObjectSpace.MarkForDeletion?)
How do you use OS in ASP.NET? Any thoughts are greatly appreciated.
 
These questions have been going through my mind for a couple of weeks now. I cannot seem to find any kindred souls that have documented on this usage scenario for ObjectSpaces. The SDK documentation on the subject is so thin, any examples always retrieve, update and delete in one go. This is not possible in a web scenario, where there is usually one request in between retrieval and storage. Sure, you could retrieve and store in one request, but that would require two database server roundtrips. Sounds like it's not the smartest thing in the world you can come up with.

I'm very curious on the reactions I will get and the length of the thread. There must be a lot of people who have explicit ideas on this. My expectations are high.

Comments

# Paul Gielens said:

Guess the MBF would be a perfect fit for scenarios as you describe above. EntityBroker will feature similar functionality… an application server. See the PDC MBF presentation for more info.

vrijdag 20 februari 2004 20:22
# Frans Bouma said:

EntityBroker will definitely NOT provide similar functionality as MBF and will not be an application server. MBF is about guaranteed transactions for example, accross appdomains/machines/threads/applications. EntityBroker has a nice remoting proxy setup and some business object designers, but that's about how close they'll get.

zondag 22 februari 2004 12:48
# Paul Gielens said:

And I quote: "For extreme requirements, an upcoming server of the EntityBroker might give additional performance advantages".

maandag 23 februari 2004 9:07