Page 1 of 1

Sterling NoSQL Database for .NET, Silverlight, and Windows Phone

Posted: Tue Sep 02, 2025 11:05 am
by surovy113
Database upgrades is a story that admittedly requires some work for Sterling. Currently, the suggested path is to version your classes using namespaces. Unfortunately, this violates the notion that you don't have to change your classes to persist them, but it is an interim requirement until a full upgrade path is implemented.

When you have to change types that are part of the database, instead of updating the existing types, create a new namespace and declare the new types there. Likewise, create a new database version (it must have a different type and name, but that might simply include the version in the name). Keep in mind the "old" classes and definitions can be declared in a separate XAP file that is loaded dynamically only when an upgrade is needed.

Handling Nullable Indexes and Keys


Keys should always be non-null. While indexes also require non-null values, you can use dataset fields and properties that allow null values by supplying a default to represent the null value. For example, if you allow null strings, an attempt to provide an index on that field or property will result in errors. A simple cast to string.Empty in the index definition will rectify this:

Experienced Developers


If you are looking to jump straight into the "meat" of Sterling, the product ships with two code examples (one for the browser/desktop, and one for the phone). In addition, Sterling uses the Silverlight Unit Test Framework to host tests for both the phone and the browser versions. Anytime any issue is encountered or new feature is added, a set of related unit tests is created. Therefore, you will find plenty of patterns and code examples in the test projects.

Notice that Sterling supports a variety of features, including both fields and properties, and nested classes and structures. The SterlingIgnore attribute is used on a class definition to prevent that class from being serialized, or on a property or field to prevent that property or field from being serialized.

Image

Defining your Class as a Table


Add the Sterling project or DLL to your solution and reference it. It is recommended you create a project specifically for the Sterling database, for example, "TestDatabaseInstance." Create a class called "T" and inherit from BaseDatabaseInstance. Sterling supports multiple databases, and the only requirement for an application is that they each have a unique name.