Couchbase Lite 2.0 is a powerful NoSQL embedded data store for iOS, Android and .Net Mobile Platforms. Couchbase Lite provides functionality such as database and document CRUD operations, brings powerful Query API with SQL-like semantics and Full-Text-Search (FTS) capabilities.

Couchbase Lite Extensibility

The Couchbase.Lite and Couchbase.Lite.Enterprise Nuget packages provide a broad array of capabilities for easily creating, configuring, and manipulating the data within Couchbase Lite databases on the platforms that support the Couchbase Lite .NET SDK. While these packages already contain a large amount of functionality out of the box, an enormous benefit of using Nuget packages is the potential for extensibility. The ability to extend existing functionality provides us, as a development community, with an avenue to create and maintain projects that supplement existing Couchbase Lite features.

One example of an opportunity to extend Couchbase Lite is to add the ability to dynamically convert objects to and from MutableDocument objects. Currently, as seen below, each model object property name and value must be added manually to MutableDocument objects through various type-specific methods.

Subsequently, to convert a MutableDocument back into the original object the following must be done.

 

Introducing Couchbase.Lite.Mapping

As you can see, the code for converting an object into a MutableDocument and back again is simple, but as every object must be mapped developers can find themselves writing many similar lines of code. So, it’s with much excitement that Couchbase Labs is introducing a new Nuget package to help decrease the amount of code written to map model objects to and from MutableDocument objects.

Couchbase.Lite.Mapping can be found on Nuget.org, and is a completely open-source project maintained in Couchbase Labs on Github. It is important to note that the Couchbase.Lite.Mapping library is not officially supported by Couchbase, Inc., but is, instead, a community effort. Please give it a try, and let us know what you think!

Also, as this is an ongoing effort, please feel free to contribute by submitting comments, issues, and/or pull-requests.

 

Author

Posted by Rob Hedgpeth, Senior Developer Advocate, Couchbase

Rob Hedgpeth is a Senior Developer Advocate at Couchbase specializing in mobile and IoT technologies. Rob has been developing applications of all flavors for over a decade, but has primarily been focused on the mobile space since 2010. Prior to working at Couchbase Rob worked as a Mobile Architect at Xamarin and Microsoft.

One Comment

  1. Great info. At least for me there seemed to be a dependency on Newtonsoft.Json.

Leave a reply