Product Reviews

db4Objects Provides Object-Oriented Local Storage

If you're willing to make the mental shift to storing objects instead of data, db4Objects may be the right solution for a distributable local database.

In the July issue of Visual Studio Magazine we reviewed VistaDB, a database engine written entirely in .NET managed code that is tuned for distributed applications needing to store data locally. Now Visual Studio Magazine Tools Editor Peter Vogel looks at db4Objects, a free database engine that offers a unique spin on local data storage.

You want something different in client-side storage for distributed applications? How about object oriented storage with Versant Corp.'s db4Objects (db4o)? In a client, you often just retrieve objects from your server, manipulate them (or create new ones), and return objects to the server. Rather than go through some ORM layer to save data at the client, db4o allows you to just save the object. You don't even have to predefine the tables in your database before saving.

With db4o, the cost involved in saving an object is practically nothing. I retrieved 1,000 rows from a relational database, created objects to hold the rows' values, and stored the results in a db4o database. The time required to retrieve and store the objects was almost identical with the time required to just retrieve the rows. Retrieving the objects through db4o was the same as retrieving the original rows from the relational database. For a client-side database this is more than "good enough" performance.

Deploying db4o is easy since the engine is just another DLL referenced by your application. Integration with Visual Studio is also good -- db4o includes the Object Manager utility (available from the Tools menu) that provides the functionality that you would normally get from Server Explorer. And the price is definitely right: db4o is free.


[Click on image for larger view.]
Figure 1.This Object Manager utility included with db4o allows you to query and update your db4o database.

However, db4o requires a very different syntax for working with data than your relational database, so you can't swap client-side code for server-side code. But, as long as your client code remains on the client, that isn't a problem. Also, lot of the functionality that you take for granted in a relational database environment isn't present in db4o (stored procedures, for instance). Nor is querying as flexible as in SQL (or as fast when multiple classes are involved). However, for local storage those features may not be essential.

If you're willing to make the paradigm shift to thinking of your client as working with objects, even as your server works with data, then db4o is worth investigating as a powerful (and cheap) way to provide local storage in a distributed environment.

db4Objects

Versant Corporation
Web:
www.versant.com
Phone: 650-232-2400
Price: Free
Quick Facts: A database engine for storing and retrieving .NET objects
Pros: Simple deployment, unique object-oriented approach
Cons: No support for stored procedures, inflexible querying



About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at http://blog.learningtree.com/tag/ui/.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube