{"id":2276,"date":"2016-05-31T18:30:51","date_gmt":"2016-05-31T18:30:50","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2276"},"modified":"2025-10-09T07:08:25","modified_gmt":"2025-10-09T14:08:25","slug":"couchbase-with-windows-net-part-5-asp-net-crud","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/","title":{"rendered":"Couchbase with Windows and .NET &#8211; Part 5 &#8211; ASP.NET CRUD"},"content":{"rendered":"<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-and-.net---part-1\/\">Part 1 covered how to install and setup Couchbase on Windows<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-and-.net---part-2\/\">Part 2 covered some Couchbase lingo that you&#8217;ll need to know<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-and-.net---part-3---asp.net-mvc\/\">Part 3 showed the very simplest example of using Couchbase in ASP.NET<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-.net-part-4-linq2couchbase\/\">In Part 4, I did some refactoring and introduced Linq2Couchbase<\/a><\/li>\n<\/ul>\n<p>This is the last blog post in this series introducing <a href=\"https:\/\/www.couchbase.com\/developers\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">Couchbase<\/a> to ASP.NET developers (or vice-versa, depending on your point of view :). I&#8217;ll be rounding out the sample app that I&#8217;ve been building with a full suite of CRUD functionality. The app already shows a list of people. After this post, you&#8217;ll be able to add a new person via the web app (instead of directly in Couchbase Console), edit a person, and delete a person.<\/p>\n<p>Before I start, a disclaimer. I&#8217;ve made some modeling <em>decisions<\/em> in this sample app. I&#8217;ve decided that keys to Person documents should be of the format &#8220;Person::{guid}&#8221;, and I&#8217;ve decided that I will enforce the &#8220;Person::&#8221; prefix at the repository level. I&#8217;ve also made a decision not to use any intermediate view models or edit models in my MVC app, for the purposes of a concise demonstration. By no means do you have to make the same decisions I did! I encourage you to think through the implications for your particular use case, and please feel free to discuss the merits and trade-offs in the comments.<\/p>\n<h2>Adding a new person document<\/h2>\n<p>In the previous blog posts, I added new documents through the Couchbase Console. Now let&#8217;s make it possible via a standard HTML form on an ASP.NET page.<\/p>\n<p>First, I need to make a slight change to the Person class:<\/p>\n<pre><code>[DocumentTypeFilter(\"Person\")]\r\npublic class Person\r\n{\r\n    public Person() { Type = \"Person\"; }\r\n\r\n    [Key]\r\n    public string Id { get; set; }\r\n    public string Type { get; set; }\r\n    public string Name { get; set; } \r\n    public string Address { get; set; }\r\n}\r\n<\/code><\/pre>\n<p>I added an &#8220;Id&#8221; field, and marked it with the <code>[Key]<\/code> attribute. This attribute comes from System.ComponentModel.DataAnnotations, but Linq2Couchbase interprets it to mean &#8220;use this field for the Couchbase key&#8221;.<\/p>\n<p>Now, let&#8217;s add a very simple new action to HomeController:<\/p>\n<pre><code>public ActionResult Add()\r\n{\r\n    return View(\"Edit\", new Person());\r\n}\r\n<\/code><\/pre>\n<p>And I&#8217;ll link\u00a0to that with the bootstrap navigation (which I snuck in previously, and by no means are you required to use):<\/p>\n<ul class=\"nav navbar-nav\">\n<li style=\"list-style-type: none\">\n<ol class=\"nav navbar-nav\">\n<li>\n<pre class=\"\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">ul<\/span> <span class=\"hljs-attribute\">class<\/span>=<span class=\"hljs-value\">\"nav navbar-nav\"<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">li<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">a<\/span> <span class=\"hljs-attribute\">href<\/span>=<span class=\"hljs-value\">\"\/\"<\/span>&gt;<\/span>Home<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">a<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">li<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">li<\/span>&gt;<\/span>@Html.ActionLink(\"Add Person\", \"Add\", \"Home\")<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">li<\/span>&gt; <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">ul<\/span>&gt;<\/span><\/pre>\n<p>Nothing much out of the ordinary so far. I&#8217;ll create a simple Edit.cshtml with a straightforward, plain-looking form.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<pre class=\"p1\">@model CouchbaseAspNetExample3.Models.Person\r\n\r\n@{\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>ViewBag.Title = \"Add : Couchbase &amp; ASP.NET Example\";\r\n\r\n}\r\n\r\n@using (Html.BeginForm(\"Save\", \"Home\", FormMethod.Post))\r\n\r\n{\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>&lt;p&gt;\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span>@Html.LabelFor(m =&gt; m.Name)\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span>@Html.TextBoxFor(m =&gt; m.Name)\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>&lt;\/p&gt;\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>&lt;p&gt;\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span>@Html.LabelFor(m =&gt; m.Address)\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span>@Html.TextBoxFor(m =&gt; m.Address)\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>&lt;\/p&gt;\r\n\r\n<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>&lt;input type=\"submit\" value=\"Submit\" \/&gt;\r\n\r\n}<\/pre>\n<p>Since that form will be POSTing to a Save action, that needs to be created next:<\/p>\n<pre><code>[HttpPost]\r\npublic ActionResult Save(Person model)\r\n{\r\n    _personRepo.Save(model);\r\n    return RedirectToAction(\"Index\");\r\n}\r\n<\/code><\/pre>\n<p>Notice that the Person type used in the parameter is the same type as before. Here is where a more complex web application would probably want to use an edit model, validation, mapping, and so on. I&#8217;ve omitted all of that, and I send the model straight to a new method in PersonRepository:<\/p>\n<pre><code>public void Save(Person person)\r\n{\r\n    \/\/ if there is no ID, then assume this is a \"new\" person\r\n    \/\/ and assign an ID\r\n    if (string.IsNullOrEmpty(person.Id))\r\n        person.Id = \"Person::\" + Guid.NewGuid();\r\n\r\n    _context.Save(person);\r\n}\r\n<\/code><\/pre>\n<p>This repository method will set the ID, if one isn&#8217;t already set (it will be, when we cover &#8216;Edit&#8217; later). The &#8220;Save&#8221; method on IBucketContext is from Linq2Couchbase. It will add a new document if the key doesn&#8217;t exist, or update an existing document if it does. It&#8217;s known as an &#8220;upsert&#8221; operation. In fact, I can do nearly the same thing without Linq2Couchbase:<\/p>\n<pre><code>var doc = new Document\r\n{\r\n    Id = \"Person::\" + person.Id,\r\n    Content = person\r\n};\r\n_bucket.Upsert(doc);\r\n<\/code><\/pre>\n<h2>Editing an existing person document<\/h2>\n<p>Now, I want to be able to edit an existing person document in my ASP.NET site. First, let&#8217;s add an edit link to each person, by making a change to _person.cshtml partial view.<\/p>\n<pre class=\"\">    @Model.Name\r\n    @Html.ActionLink(\"[Edit]\", \"Edit\", new {id = Model.Id.Replace(\"Person::\", \"\")})\r\n    @Html.ActionLink(\"[Delete]\", \"Delete\", new {id = Model.Id.Replace(\"Person::\", \"\")}, new { @class=\"deletePerson\"})\r\n<\/pre>\n<p>Again, I&#8217;m using bootstrap here, which is not required. I also added a &#8220;delete&#8221; link while I was in there, which we&#8217;ll get to later. One more thing to point out: <em><strong>when creating the routeValues, I stripped out &#8220;Person::&#8221; from the Id<\/strong><\/em>. If I don&#8217;t do this, ASP.NET will complain about a potentially malicious HTTP request. It would probably be better to give each person document a more friendly <a href=\"https:\/\/en.wikipedia.org\/wiki\/Semantic_URL#Slug\">&#8220;slug&#8221;<\/a> to use in the URL, and maybe to use that as the document key too. That&#8217;s going to depend on you and your use case.<\/p>\n<p>Now I need an Edit action in HomeController:<\/p>\n<pre><code>public ActionResult Edit(Guid id)\r\n{\r\n    var person = _personRepo.GetPersonByKey(id);\r\n    return View(\"Edit\", person);\r\n}\r\n<\/code><\/pre>\n<p>I&#8217;m reusing the same Edit.cshtml view, but now I need to add a hidden field to hold the document ID.<\/p>\n<pre><code>&lt;input <span class=\"hljs-built_in\">type<\/span>=<span class=\"hljs-string\">\"hidden\"<\/span> name=<span class=\"hljs-string\">\"Id\"<\/span> value=<span class=\"hljs-string\">\"@Model.Id\"<\/span>\/&gt;\r\n<\/code><\/pre>\n<p>Voila! Now you can add and edit person documents.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2016\/may\/couchbase-with-windows-.net-part-5-asp.net-crud\/editcouchbasedocument_001.png\" alt=\"Add or Edit a Person document\" \/><\/p>\n<p>This may not be terribly impressive to those of you already comfortable with ASP.NET MVC. So, next, let&#8217;s look at something cool that a NoSQL database like Couchbase brings to the table.<\/p>\n<h2>Iterating on the data stored in the person document<\/h2>\n<p>I want to collect more information about a Person. Let&#8217;s say I want to get a phone number, and a list of that person&#8217;s favorite movies. With a relational database, that means that I would need to add <em>at least<\/em> two columns, and more likely, at least one other table to hold the movies, with a foreign key.<\/p>\n<p>With Couchbase, there is no explicit schema. So instead, all I have to do is add a couple more properties to the Person class.<\/p>\n<pre><code>[DocumentTypeFilter(\"Person\")]\r\npublic class Person\r\n{\r\n    public Person() { Type = \"Person\"; }\r\n\r\n    [Key]\r\n    public string Id { get; set; }\r\n    public string Type { get; set; }\r\n    public string Name { get; set; } \r\n    public string Address { get; set; }\r\n\r\n    public string PhoneNumber { get; set; }\r\n    public List FavoriteMovies { get; set; }\r\n}\r\n<\/code><\/pre>\n<p>I also need to add a corresponding UI. I used a bit of jQuery to allow the user to add any number of movies. I won&#8217;t show the code for it here, because the implementation details aren&#8217;t important. But I have made the whole <a href=\"https:\/\/github.com\/couchbaselabs\/couchbase-asp-net-blog-example-3\">sample available on Github<\/a>, so you can check it out later if you&#8217;d like.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2016\/may\/couchbase-with-windows-.net-part-5-asp.net-crud\/editpersoniteration_002.png\" alt=\"Iteration on Person with new UI form\" \/><\/p>\n<p>I also need to make changes to the _person.cshtml to (conditionally) display the extra information:<\/p>\n<pre class=\"\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">div<\/span> <span class=\"hljs-attribute\">class<\/span>=<span class=\"hljs-value\">\"panel-body\"<\/span>&gt;<\/span> \r\n@Model.Address \r\n@if (!string.IsNullOrEmpty(Model.PhoneNumber))\r\n{ \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">br<\/span> \/&gt;<\/span> \r\n@Model.PhoneNumber \r\n} \r\n@if (Model.FavoriteMovies != null &amp;&amp; Model.FavoriteMovies.Any())\r\n{ \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">br<\/span>\/&gt;<\/span> \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">h4<\/span>&gt;<\/span>Favorite Movies<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">h4<\/span>&gt;<\/span> \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">ul<\/span>&gt;<\/span> \r\n@foreach (var movie in Model.FavoriteMovies) \r\n{ \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">li<\/span>&gt;<\/span>@movie<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">li<\/span>&gt;<\/span> \r\n} \r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">ul<\/span>&gt;<\/span> \r\n} \r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">div<\/span>&gt;<\/span><\/pre>\n<p>And here&#8217;s how that would look (this time with two Person documents):<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2016\/may\/couchbase-with-windows-.net-part-5-asp.net-crud\/iterationdisplayui_003.png\" alt=\"Iteration on Person with new UI display\" \/><\/p>\n<p>I didn&#8217;t have to migrate a SQL schema. I didn&#8217;t have to create any sort of foreign key relationship. I didn&#8217;t have to setup any OR\/M mappings. I simply added a couple of new fields, and Couchbase turned it into a corresponding JSON document.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2016\/may\/couchbase-with-windows-.net-part-5-asp.net-crud\/iterationcouchbasedocument_004.png\" alt=\"Iteration on Person with new JSON document\" \/><\/p>\n<h2>Deleting a person document<\/h2>\n<p>I already added the &#8220;Delete&#8221; link, so I just need to create a new Controller action&#8230;<\/p>\n<pre><code>public ActionResult Delete(Guid id)\r\n{\r\n    _personRepo.Delete(id);\r\n    return RedirectToAction(\"Index\");\r\n}\r\n<\/code><\/pre>\n<p>&#8230;and a new repository method:<\/p>\n<pre><code>public void Delete(Guid id)\r\n{\r\n    _bucket.Remove(\"Person::\" + id);\r\n}\r\n<\/code><\/pre>\n<p>Notice that this method is not using Linq2Couchbase. It&#8217;s using the Remove method on IBucket. There is a Remove available on IBucketContext, but you need to pass it an object, and not just a key. I elected to use the IBucket, but there&#8217;s nothing inherently superior about it.<\/p>\n<h2>Wrapping up<\/h2>\n<p>Thanks for reading through this blog series. Hopefully, you&#8217;re on your way to considering or even including Couchbase in your next ASP.NET project. Here are some more interesting links for you to continue your Couchbase journey:<\/p>\n<ul>\n<li>You might be interested in the <a href=\"https:\/\/www.couchbase.com\/blog\/the-couchbase-asp.net-identity-storage-provider-part-1\/\">ASP.NET Identity Provider for Couchbase<\/a> (<a href=\"https:\/\/github.com\/couchbaselabs\/couchbase-aspnet-identity\">github<\/a>). If you want to store identity information in Couchbase, this is one way you could do it. At the time of this blog post, it&#8217;s an early developer preview, and is missing support for social logins.<\/li>\n<li>Linq2Couchbase is a great project with a lot of features and documentation, but it&#8217;s still a work in progress. If you are interested, I suggest visiting <a href=\"https:\/\/github.com\/couchbaselabs\/Linq2Couchbase\">Linq2Couchbase on Github<\/a>. Ask questions on Gitter, and feel free to submit issues or pull requests.<\/li>\n<li>Right now, <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-4.5-application-contest-chance-to-win-usd500-amazon-gift-card\/\">Couchbase is giving away a $500 prize<\/a> for a creative use of Couchbase. Iterate on this ASP.NET example? Create a plugin for your favorite IDE? Implement that missing functionality in the ASP.NET Identity Provider? You&#8217;ll get some swag just for entering.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>I&#8217;ve put the <a href=\"https:\/\/github.com\/couchbaselabs\/couchbase-asp-net-blog-example-3\">full source code for this example on Github<\/a>.<\/p>\n<p>What did I leave out? What&#8217;s keeping you from trying Couchbase with ASP.NET today? Please leave a comment, <a href=\"https:\/\/twitter.com\/mgroves\">ping me on Twitter<\/a>, or email me (matthew.groves AT couchbase DOT com). I&#8217;d love to hear from you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part 1 covered how to install and setup Couchbase on Windows Part 2 covered some Couchbase lingo that you&#8217;ll need to know Part 3 showed the very simplest example of using Couchbase in ASP.NET In Part 4, I did some [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,10126,1816],"tags":[1469],"ppma_author":[8968],"class_list":["post-2276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-asp-dotnet","category-couchbase-server","tag-linq2couchbase"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.0 (Yoast SEO v26.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Couchbase with Windows and .NET - Part 5 - ASP.NET CRUD - 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\/couchbase-with-windows-net-part-5-asp-net-crud\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Couchbase with Windows and .NET - Part 5 - ASP.NET CRUD\" \/>\n<meta property=\"og:description\" content=\"Part 1 covered how to install and setup Couchbase on Windows Part 2 covered some Couchbase lingo that you&#8217;ll need to know Part 3 showed the very simplest example of using Couchbase in ASP.NET In Part 4, I did some [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-31T18:30:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-09T14:08:25+00:00\" \/>\n<meta name=\"author\" content=\"The Couchbase Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"The Couchbase Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/\"},\"author\":{\"name\":\"The Couchbase Team\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/764f4a6771ee19bc7af70b70a326fb93\"},\"headline\":\"Couchbase with Windows and .NET &#8211; Part 5 &#8211; ASP.NET CRUD\",\"datePublished\":\"2016-05-31T18:30:50+00:00\",\"dateModified\":\"2025-10-09T14:08:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/\"},\"wordCount\":1271,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"linq2couchbase\"],\"articleSection\":[\".NET\",\"ASP.NET\",\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/\",\"name\":\"Couchbase with Windows and .NET - Part 5 - ASP.NET CRUD - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2016-05-31T18:30:50+00:00\",\"dateModified\":\"2025-10-09T14:08:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#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\/couchbase-with-windows-net-part-5-asp-net-crud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Couchbase with Windows and .NET &#8211; Part 5 &#8211; ASP.NET CRUD\"}]},{\"@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\/764f4a6771ee19bc7af70b70a326fb93\",\"name\":\"The Couchbase Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/7befc37d02226b59499817eafdec60c3\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b4c18c758421903398e84d6c9560f319f39c665798d7d23e6a6f9dff8a8f984e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b4c18c758421903398e84d6c9560f319f39c665798d7d23e6a6f9dff8a8f984e?s=96&d=mm&r=g\",\"caption\":\"The Couchbase Team\"},\"description\":\"Jennifer Garcia is a Senior Web Manager at Couchbase Inc. As the website manager, Jennifer has overall responsibility for the website properties including design, implementation, content, and performance.\",\"sameAs\":[\"https:\/\/www.couchbase.com\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/jennifer-garcia\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Couchbase with Windows and .NET - Part 5 - ASP.NET CRUD - 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\/couchbase-with-windows-net-part-5-asp-net-crud\/","og_locale":"en_US","og_type":"article","og_title":"Couchbase with Windows and .NET - Part 5 - ASP.NET CRUD","og_description":"Part 1 covered how to install and setup Couchbase on Windows Part 2 covered some Couchbase lingo that you&#8217;ll need to know Part 3 showed the very simplest example of using Couchbase in ASP.NET In Part 4, I did some [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/","og_site_name":"The Couchbase Blog","article_published_time":"2016-05-31T18:30:50+00:00","article_modified_time":"2025-10-09T14:08:25+00:00","author":"The Couchbase Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"The Couchbase Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/"},"author":{"name":"The Couchbase Team","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/764f4a6771ee19bc7af70b70a326fb93"},"headline":"Couchbase with Windows and .NET &#8211; Part 5 &#8211; ASP.NET CRUD","datePublished":"2016-05-31T18:30:50+00:00","dateModified":"2025-10-09T14:08:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/"},"wordCount":1271,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["linq2couchbase"],"articleSection":[".NET","ASP.NET","Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/","name":"Couchbase with Windows and .NET - Part 5 - ASP.NET CRUD - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2016-05-31T18:30:50+00:00","dateModified":"2025-10-09T14:08:25+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-with-windows-net-part-5-asp-net-crud\/#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\/couchbase-with-windows-net-part-5-asp-net-crud\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Couchbase with Windows and .NET &#8211; Part 5 &#8211; ASP.NET CRUD"}]},{"@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\/764f4a6771ee19bc7af70b70a326fb93","name":"The Couchbase Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/7befc37d02226b59499817eafdec60c3","url":"https:\/\/secure.gravatar.com\/avatar\/b4c18c758421903398e84d6c9560f319f39c665798d7d23e6a6f9dff8a8f984e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b4c18c758421903398e84d6c9560f319f39c665798d7d23e6a6f9dff8a8f984e?s=96&d=mm&r=g","caption":"The Couchbase Team"},"description":"Jennifer Garcia is a Senior Web Manager at Couchbase Inc. As the website manager, Jennifer has overall responsibility for the website properties including design, implementation, content, and performance.","sameAs":["https:\/\/www.couchbase.com"],"url":"https:\/\/www.couchbase.com\/blog\/author\/jennifer-garcia\/"}]}},"authors":[{"term_id":8968,"user_id":2,"is_guest":0,"slug":"jennifer-garcia","display_name":"The Couchbase Team","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/b4c18c758421903398e84d6c9560f319f39c665798d7d23e6a6f9dff8a8f984e?s=96&d=mm&r=g","author_category":"","last_name":"Garcia","first_name":"Jennifer","job_title":"","user_url":"https:\/\/www.couchbase.com","description":"Jennifer Garcia is a Senior Web Manager at Couchbase Inc. As the website manager, Jennifer has overall responsibility for the website properties including design, implementation, content, and performance."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2276","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2276"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2276\/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=2276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2276"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}