{"id":1817,"date":"2014-12-16T17:46:21","date_gmt":"2014-12-16T17:46:20","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1817"},"modified":"2017-05-04T13:31:17","modified_gmt":"2017-05-04T20:31:17","slug":"using-c-domain-objects-define-couchbase-views","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/","title":{"rendered":"Using C# Domain Objects to Define Couchbase Views"},"content":{"rendered":"<p>The Couchbase Client Library 1.2-Beta includes a new API for some basic cluster management.\u00a0 There are methods for creating, removing and listing buckets.\u00a0 There are similar methods for managing design documents.\u00a0 These new features are found in the new class <em>CouchbaseCluster<\/em>, under the <em>Couchbase.Management<\/em> namespace.\u00a0 The main benefit of this new API is that it&#8217;s now possible to allow your application to create its bucket and set its design documents when it starts up.<\/p>\n<p>One of the overloads for creating new design documents allows you to specify a <em>Stream<\/em> as the source of the design document.\u00a0 With this version, it&#8217;s easy to create design documents from a set of files.\u00a0 You can also just specify a string containing the document.<\/p>\n<p>I recently had an idea to create a simple command line utility to use these design doc management methods to automate the creation of basic views.\u00a0 The result of this idea is up on GitHub at <a href=\"https:\/\/github.com\/jzablocki\/couchbase-model-views\">https:\/\/github.com\/jzablocki\/couchbase-model-views<\/a>.\u00a0 Using this framework, you&#8217;ll be able to automate the creation of views simply by decorating your existing model classes with custom attributes.<\/p>\n<p>Consider a <em>Beer<\/em> class with a properties for Name, Description, Brewery and ABV.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">class<\/span> Beer<br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Id <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Name <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Description <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">float<\/span> ABV <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Brewery <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<\/div>\n<\/div>\n<p>This class maps to &#8220;beer&#8221; documents in your Couchbase bucket.<\/p>\n<div class=\"geshifilter\">\n<div class=\"javascript geshifilter-javascript\" style=\"font-family: monospace;\"><span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;name&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;Samuel Adams Summer Ale&#8221;<\/span><span style=\"color: #339933;\">,<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;abv&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #cc0000;\">5.2<\/span><span style=\"color: #339933;\">,<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;type&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;beer&#8221;<\/span><span style=\"color: #339933;\">,<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;brewery_id&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;110f04db06&#8221;<\/span><span style=\"color: #339933;\">,<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;description&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;Bright and citrusy, brewed with mysterious grains of&#8230;<br \/>\n}<\/span><\/div>\n<\/div>\n<p>To achieve this mapping, you&#8217;d likely use <em>Newtonsoft<\/em>.<em>Json<\/em>&#8216;s property mapping attributes.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">class<\/span> Beer<br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Id <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;name&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Name <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;description&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Description <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;abv&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">float<\/span> ABV <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;breweryId&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Brewery <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<\/div>\n<\/div>\n<p>Using two new attributes found in the <em>CouchbaseModelViews.Framework<\/em> project, you could further decorate this class to declare which properties in this class should be indexed by Couchbase Server.\u00a0 These attributes are <em>CouchbaseDesignDocument<\/em> and <em>CouchbaseViewKey<\/em>.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p><span style=\"color: #008000;\">[<\/span>CouchbaseDesignDoc<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;beers&#8221;<\/span>, <span style=\"color: #666666;\">&#8220;beer&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">class<\/span> Beer<br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Id <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;name&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #008000;\">[<\/span>CouchbaseViewKey<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;by_abv_and_name&#8221;<\/span>, <span style=\"color: #666666;\">&#8220;name&#8221;<\/span>, <span style=\"color: #ff0000;\">1<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #008000;\">[<\/span>CouchbaseViewKey<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;by_name&#8221;<\/span>, <span style=\"color: #666666;\">&#8220;name&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Name <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;description&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Description <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;abv&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #008000;\">[<\/span>CouchbaseViewKey<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;by_abv_and_name&#8221;<\/span>, <span style=\"color: #666666;\">&#8220;abv&#8221;<\/span>, <span style=\"color: #ff0000;\">0<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">float<\/span> ABV <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">[<\/span>JsonProperty<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;breweryId&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #008000;\">[<\/span>CouchbaseViewKey<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;by_brewery&#8221;<\/span>, <span style=\"color: #666666;\">&#8220;breweryId&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> Brewery <span style=\"color: #008000;\">{<\/span> get<span style=\"color: #008000;\">;<\/span> set<span style=\"color: #008000;\">;<\/span> <span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<\/div>\n<\/div>\n<p>The <em>CouchbaseDesignDoc<\/em> attribute is set on a model class.\u00a0 It uses a plain-old-CLR-object (POCO) to define a design document.\u00a0 If you omit the name argument, a design document with the same name (lowercased) as the class will be created.\u00a0 If you omit the type argument, views will check that documents have a type property with the value of the name (lowercased) of the class.<\/p>\n<p>The <em>CouchbaseViewKey<\/em> attribute is set on properties in a POCO class that should be indexed.\u00a0 For example, the Name property in the <em>Beer<\/em> class above has a <em>CouchbaseViewKey<\/em> attribute on it with the arguments &#8220;by_name&#8221; and &#8220;name.&#8221;\u00a0 The view that will result from these values is as follows:<\/p>\n<div class=\"geshifilter\">\n<div class=\"javascript geshifilter-javascript\" style=\"font-family: monospace;\"><span style=\"color: #003366; font-weight: bold;\">function<\/span><span style=\"color: #009900;\">(<\/span>doc<span style=\"color: #339933;\">,<\/span> meta<span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">(<\/span>doc.<span style=\"color: #660066;\">type<\/span> <span style=\"color: #339933;\">==<\/span> <span style=\"color: #3366cc;\">&#8220;beer&#8221;<\/span> <span style=\"color: #339933;\">&amp;&amp;<\/span> doc.<span style=\"color: #000066;\">name<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span><br \/>\nemit<span style=\"color: #009900;\">(<\/span>doc.<span style=\"color: #000066;\">name<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #003366; font-weight: bold;\">null<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><\/div>\n<\/div>\n<p>The &#8220;by_name&#8221; argument is the name of this view and the &#8220;name&#8221; argument defines what property is checked for existence and emitted.<\/p>\n<p>It&#8217;s also possible to include composite keys by decorating multiple properties with <em>CouchbaseViewKey<\/em> attributes containing the same value for the viewName parameter.\u00a0 Composite keys are demonstrated with &#8220;by_abv_and_name&#8221; on the ABV and Name properties.\u00a0 Notice also that there is an optional order parameter that allows you to set the order in which properties are emitted.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">function<span style=\"color: #008000;\">(<\/span>doc, meta<span style=\"color: #008000;\">)<\/span> <span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">if<\/span> <span style=\"color: #008000;\">(<\/span>doc<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">type<\/span> <span style=\"color: #008000;\">==<\/span> <span style=\"color: #666666;\">&#8220;beer&#8221;<\/span> <span style=\"color: #008000;\">&amp;&amp;<\/span> doc<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">abv<\/span> <span style=\"color: #008000;\">&amp;&amp;<\/span> doc<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">name<\/span><span style=\"color: #008000;\">)<\/span> <span style=\"color: #008000;\">{<\/span><br \/>\nemit<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">[<\/span>doc<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">abv<\/span>, doc<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">name<\/span><span style=\"color: #008000;\">]<\/span>, <span style=\"color: #0600ff; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Once you&#8217;ve decorated your class with the appropriate attributes, you can use the <em>CouchbaseModelViewsGenerator<\/em> project to run the models through the view generator.\u00a0 This is a simple command line project that requires an app.config with a section listing all assemblies containing models that will be used to create views.<\/p>\n<div class=\"geshifilter\">\n<div class=\"xml geshifilter-xml\" style=\"font-family: monospace;\">\n<p><span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;sectionGroup<\/span> <span style=\"color: #000066;\">name<\/span>=<span style=\"color: #ff0000;\">&#8220;modelViews&#8221;<\/span><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;section<\/span> <span style=\"color: #000066;\">name<\/span>=<span style=\"color: #ff0000;\">&#8220;assemblies&#8221;<\/span> <span style=\"color: #000066;\">type<\/span>=<span style=\"color: #ff0000;\">&#8220;System.Configuration.DictionarySectionHandler&#8221;<\/span><span style=\"color: #000000; font-weight: bold;\">\/&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><\/p>\n<p><span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;modelViews<span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;assemblies<span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;add<\/span> <span style=\"color: #000066;\">key<\/span>=<span style=\"color: #ff0000;\">&#8220;DemoModels&#8221;<\/span> <span style=\"color: #000066;\">value<\/span>=<span style=\"color: #ff0000;\">&#8220;CouchbaseModelViews.DemoModels&#8221;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p>Additionally, you will need to configure the <em>CouchbaseCluster<\/em>.\u00a0 <em>CouchbaseCluster<\/em> instances are creating using the same configuration (code or app.config) as the existing <em>CouchbaseClient<\/em>.\u00a0 However, there are now an additional two properties you can set to provide the administrator credentials.<\/p>\n<div class=\"geshifilter\">\n<div class=\"xml geshifilter-xml\" style=\"font-family: monospace;\"><span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;couchbase<span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;servers<\/span> <span style=\"color: #000066;\">bucket<\/span>=<span style=\"color: #ff0000;\">&#8220;default&#8221;<\/span> <span style=\"color: #000066;\">bucketPassword<\/span>=<span style=\"color: #ff0000;\">&#8220;&#8221;<\/span> <span style=\"color: #000066;\">username<\/span>=<span style=\"color: #ff0000;\">&#8220;Administrator&#8221;<\/span> <span style=\"color: #000066;\">password<\/span>=<span style=\"color: #ff0000;\">&#8220;qwerty&#8221;<\/span><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&lt;add<\/span> <span style=\"color: #000066;\">uri<\/span>=<span style=\"color: #ff0000;\">&#8220;https:\/\/localhost:8091\/pools&#8221;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900;\"><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/span><\/div>\n<\/div>\n<p>Once you&#8217;ve setup your app.config, make sure you have the listed assemblies in the bin directory where they can be loaded.\u00a0 The easiest way to achieve this discover-ability is of course to reference them.\u00a0 However, if you just want to use a compiled version of the console app, then simply copy them into the bin directory.<\/p>\n<p>When executed, the framework will create a &#8220;beers&#8221; design document that looks like the following:<\/p>\n<div class=\"geshifilter\">\n<div class=\"javascript geshifilter-javascript\" style=\"font-family: monospace;\"><span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;views&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;by_abv_and_name&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;map&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;function(doc, meta) { <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> if (doc.type == <span style=\"color: #000099; font-weight: bold;\">&#8220;<\/span>beer<span style=\"color: #000099; font-weight: bold;\">&#8220;<\/span> &amp;&amp; doc.abv &amp;&amp; doc.name) { <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> emit([doc.abv, doc.name], null); <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> } <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span> }&#8221;<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><span style=\"color: #339933;\">,<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;by_name&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;map&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;function(doc, meta) { <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> if (doc.type == <span style=\"color: #000099; font-weight: bold;\">&#8220;<\/span>beer<span style=\"color: #000099; font-weight: bold;\">&#8220;<\/span> &amp;&amp; doc.name) { <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> emit(doc.name, null); <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> } <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span> }&#8221;<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><span style=\"color: #339933;\">,<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;by_brewery&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #009900;\">{<\/span><br \/>\n<span style=\"color: #3366cc;\">&#8220;map&#8221;<\/span><span style=\"color: #339933;\">:<\/span> <span style=\"color: #3366cc;\">&#8220;function(doc, meta) { <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> if (doc.type == <span style=\"color: #000099; font-weight: bold;\">&#8220;<\/span>beer<span style=\"color: #000099; font-weight: bold;\">&#8220;<\/span> &amp;&amp; doc.breweryId) { <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> emit(doc.breweryId, null); <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span><span style=\"color: #000099; font-weight: bold;\">t<\/span> } <span style=\"color: #000099; font-weight: bold;\">r<\/span><span style=\"color: #000099; font-weight: bold;\">n<\/span> }&#8221;<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><br \/>\n<span style=\"color: #009900;\">}<\/span><\/div>\n<\/div>\n<p>The console contains no actual view creation logic.\u00a0 It just orchestrates calls to the various plumbing components inside the <em>Framework<\/em> project.\u00a0 If you prefer to include the view creation inside of Global.asax or some other app start event, you could simply make these calls yourself.\u00a0 There are four primary components of the framework.<\/p>\n<ul>\n<li>The <em>ConfigParser<\/em> simply reads the list of assemblies from the config section and generates an enumerable list of assemblies.<\/li>\n<li>The <em>ViewBuilder<\/em> class takes an assembly or enumerable list of assemblies and iterates over each of the types.\u00a0 For each type found with a <em>CouchbaseDesignDoc<\/em> attribute, views are constructed.\u00a0 The <em>Build<\/em> method of the <em>ViewBuilder<\/em> returns a dictionary, where the keys are design doc names and the values are the actual design docs.<\/li>\n<li>The <em>DesignDocManager<\/em> takes a dictionary with doc name, design doc pairs and uses the <em>CouchbaseCluster<\/em> to create design documents.<\/li>\n<li>There&#8217;s also a <em>ViewRunner<\/em> class, which will run the newly created views.<\/li>\n<\/ul>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\"><\/div>\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">var assemblies <span style=\"color: #008000;\">=<\/span> ConfigParser<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">GetAssemblies<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar builder <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> ViewBuilder<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nbuilder<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">AddAssemblies<\/span><span style=\"color: #008000;\">(<\/span>assemblies<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">ToList<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar designDocs <span style=\"color: #008000;\">=<\/span> builder<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Build<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar ddManager <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> DesignDocManager<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nddManager<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Create<\/span><span style=\"color: #008000;\">(<\/span>designDocs, <span style=\"color: #008000;\">(<\/span>s<span style=\"color: #008000;\">)<\/span> <span style=\"color: #008000;\">=&gt;<\/span> Console<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">WriteLine<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;Created {0} design doc&#8221;<\/span>, s<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar runner <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> ViewRunner<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nrunner<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Run<\/span><span style=\"color: #008000;\">(<\/span>designDocs, <span style=\"color: #008000;\">(<\/span>k, v, s<span style=\"color: #008000;\">)<\/span> <span style=\"color: #008000;\">=&gt;<\/span> Console<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">WriteLine<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;[{0}::{1}] Key {2}&#8221;<\/span>, k, v, s<span style=\"color: #008000;\">[<\/span><span style=\"color: #666666;\">&#8220;key&#8221;<\/span><span style=\"color: #008000;\">]<\/span><span style=\"color: #008000;\">)<\/span>, <span style=\"color: #ff0000;\">5<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/div>\n<\/div>\n<p>There is no coupling between any two of these three components and you can use them as you wish.\u00a0 If you have your own assembly gathering facility for example, simply pass it to the <em>ViewBuilder.Build<\/em> to render the JSON needed to create the views.<\/p>\n<p>At this point, the framework is mostly complete and reasonably tested.\u00a0 The code has a few more loops than I&#8217;d like and I might have overused Tuples , but it works.\u00a0 Feel free to use it in your projects.\u00a0 Keep in mind, this is a Couchbase Labs project and isn&#8217;t officially supported.\u00a0 Remember too that it&#8217;s using the Beta version of the .NET Couchbase Client Library and the API is subject to change.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Couchbase Client Library 1.2-Beta includes a new API for some basic cluster management.\u00a0 There are methods for creating, removing and listing buckets.\u00a0 There are similar methods for managing design documents.\u00a0 These new features are found in the new class [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8980],"class_list":["post-1817","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using C# Domain Objects to Define Couchbase Views - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using C# Domain Objects to Define Couchbase Views\" \/>\n<meta property=\"og:description\" content=\"The Couchbase Client Library 1.2-Beta includes a new API for some basic cluster management.\u00a0 There are methods for creating, removing and listing buckets.\u00a0 There are similar methods for managing design documents.\u00a0 These new features are found in the new class [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-16T17:46:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-05-04T20:31:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"John Zablocki, NET. SDK Developer, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Zablocki, NET. SDK Developer, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\"},\"author\":{\"name\":\"John Zablocki, NET. SDK Developer, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282\"},\"headline\":\"Using C# Domain Objects to Define Couchbase Views\",\"datePublished\":\"2014-12-16T17:46:20+00:00\",\"dateModified\":\"2017-05-04T20:31:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\"},\"wordCount\":1285,\"commentCount\":10,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\",\"name\":\"Using C# Domain Objects to Define Couchbase Views - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-16T17:46:20+00:00\",\"dateModified\":\"2017-05-04T20:31:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using C# Domain Objects to Define Couchbase Views\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282\",\"name\":\"John Zablocki, NET. SDK Developer, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/201925d9efc4992ce80385b76fdea34b\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g\",\"caption\":\"John Zablocki, NET. SDK Developer, Couchbase\"},\"description\":\"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University. You can also check out the book on Amazon named \\\"Couchbase Essentials\\\" which explains how to install and configure Couchbase Server.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/john-zablocki\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using C# Domain Objects to Define Couchbase Views - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/","og_locale":"en_US","og_type":"article","og_title":"Using C# Domain Objects to Define Couchbase Views","og_description":"The Couchbase Client Library 1.2-Beta includes a new API for some basic cluster management.\u00a0 There are methods for creating, removing and listing buckets.\u00a0 There are similar methods for managing design documents.\u00a0 These new features are found in the new class [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-16T17:46:20+00:00","article_modified_time":"2017-05-04T20:31:17+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"John Zablocki, NET. SDK Developer, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Zablocki, NET. SDK Developer, Couchbase","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/"},"author":{"name":"John Zablocki, NET. SDK Developer, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282"},"headline":"Using C# Domain Objects to Define Couchbase Views","datePublished":"2014-12-16T17:46:20+00:00","dateModified":"2017-05-04T20:31:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/"},"wordCount":1285,"commentCount":10,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/","url":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/","name":"Using C# Domain Objects to Define Couchbase Views - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2014-12-16T17:46:20+00:00","dateModified":"2017-05-04T20:31:17+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/using-c-domain-objects-define-couchbase-views\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using C# Domain Objects to Define Couchbase Views"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282","name":"John Zablocki, NET. SDK Developer, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/201925d9efc4992ce80385b76fdea34b","url":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","caption":"John Zablocki, NET. SDK Developer, Couchbase"},"description":"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University. You can also check out the book on Amazon named \"Couchbase Essentials\" which explains how to install and configure Couchbase Server.","url":"https:\/\/www.couchbase.com\/blog\/author\/john-zablocki\/"}]}},"authors":[{"term_id":8980,"user_id":22,"is_guest":0,"slug":"john-zablocki","display_name":"John Zablocki, NET. SDK Developer, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","author_category":"","last_name":"Zablocki","first_name":"John","job_title":"","user_url":"","description":"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University.\r\nYou can also check out the book on Amazon named \"Couchbase Essentials\" which explains how to install and configure Couchbase Server."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/1817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=1817"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/1817\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=1817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=1817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=1817"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=1817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}