I am evaluating db4o for persistence for a ASP .NET MVC project.
I am wondering how I should use the IObjectContainer in a web context with regards to object lifetime. As I see it, I can do one of the following:
- Create the IObjectContainer at application startup and keep the same instance for the entire application lifetime.
- Create one IObjectContainer per request.
- Start a server, and get a client IObjectContainer for each database interaction.
What are the implications of these options, in terms of performance and concurrency ?
Since the database is locked when an IObjectContainer is opened, I am pretty sure that option 2) would get me some problems with concurrency - would this also be the case for option 1 ?
As I understand it, if I retrieve an object from an IObjectContainer, it must be saved by the same IObjectContainer instance - in order for db4o to identify it as being the same object. Therefore, If I choose option 3), I would have to retrieve the original object, make the necessary changes (copy data from a modified object), and then store it using the same IObjectContainer. Is this true ?