Embedded Database Engine for Silverlight Applications

So far, rich Internet applications (RIA) don’t have to be concerned with data management on the client side, as most connected implementations are designed to be simply a visualization and interaction layer to data and services on the server side. In these cases, data is retrieved from the server as JSON or XML data types (or serialized binary objects for some platforms), then cached in-memory as objects and collections, part of the application, and eventually discarded as part of the application lifecycle.

But for relatively more complex applications that require larger and more distributed data sets, lower application latency, reduced chattiness, data relationships (even basic ones), the implementation starts to get a little complicated, and becomes more difficult with procedural languages like JavaScript. In that case, a simple and light-weight in-memory embedded database may become quite useful.

Perst for .NET

McObjectMcObject’s Perst is an open source, object-oriented embedded database system. Perst has been available in Java (SE, ME, and EE) and in .NET and .NET Compact Framework, and Mono. But recently McObjects ported Perst to Silverlight as well. Its small library size (~1MB including support for generics; ~5,000 lines of code) and small in-memory footprint is packed with a very sophisticated set of features, such as:

  • Support for direct and transparent object persistence
  • Full text search with indexing support
  • Full-ACID transactions support
  • SQL-based interface
  • XML import/export

Perst inherited much of its heritage from McObject’s eXtremeDB embedded database product, which has been used in devices such as MP3 players, WiMAX base stations, digital TV set top boxes, military and aerospace applications, etc. Yes, even embedded applications and firmware can use databases.

Interestingly, the C# code tree was initially produced from the Java version using the Java-to-C# converted in Visual Studio, then some additional changes to enable specific C# features. While not all Java applications can be converted this easily, this shows that some can. And this also means how similar C# and Java are.

As an embedded database engine, Perst presents a very viable in-memory data management solution to Silverlight applications. It can be instantiated and used directly as part of the application, instead of something that runs in a separate process and memory space, or over the network on the back-end server for most RIA’s. Perst can also use Silverlight’s isolated storage to manage additional data that can be cached in a persistent manner. This enables many more complex scenarios than simply storing JSON, XML, CSV, or plain text data in isolated storage.

Silverlight 3 Out-Of-Browser

One can argue that the “connected client” design (as described above) works best for RIA’s, as they’re rich Web applications intended to enhance the user experience when connected to the cloud, to begin with. Or essentially, everyone can assume ubiquitous connectivity anytime and everywhere, so applications only need to live in the cloud, then all we need is a browser.

But we’re also starting to see very valid scenarios emerge to access the cloud outside of the browser. And applications in these scenarios are often more refined/specialized than their HTML-based counterparts. For example, iPhone apps, iTunes, Wii, Adobe AIR, Google Gears, Google Desktop, Apple Dashboard Widgets, Yahoo! Gadgets, Windows Gadgets, FireFox extensions and plug-ins, Internet Explorer 8 WebSlices, SideBars, and ToolBars, etc. These out-of-browser application models are very valid because it has been observed that users tend to spend more time with them, than the websites behind those clients.

There are many potential reasons for this observation, with some more prevalent in some scenarios. For example, local content is more visible to users and easier to access, without having to open a browser and then finding the website (sometimes needing to re-authenticate) and downloading the content. And of course, content and data can be stored locally for off-line access.

Now that Silverlight 3 also supports installation of applications locally on the desktop, we can add the option of caching some data locally, in addition to being a locally installed visualization and interaction layer to cloud-based services, or a rich disconnected gadget. And McObject’s Perst embedded database would again be a really compelling solution to help with managing the data.

This is especially important for out-of-browser and locally installed applications, as one of their primary benefits is to support off-line usage. Having a database management solution such as Perst can help increase the overall robustness of the user experience, by ensuring work continuity regardless of connection state.

About McObject

Founded by embedded database and real-time systems experts, McObject offers proven data management technology that makes applications and devices smarter, more reliable and more cost-effective to develop and maintain. McObject counts among its customers industry leaders such as Chrysler, Maximizer Software, Siemens, Phillips, EADS, JVC, Tyco Thermal Controls, F5 Networks, DIRECTV, CA, Motorola and Boeing.