Please use the form below to provide your feedback. Because your feedback is valuable to us, the information you submit in this form is recorded in our issue tracking system (JIRA), which is publicly available. You can track the status of your feedback using the ticket number displayed in the dialog once you submit the form.

After you have created your Couchbase Capella free tier, you must create a Cluster , a Bucket named "Content", a Scope named "Blogs", and then Collections called "Blog" and "Post" for storing the documents. Note that names are case-sensitive .

Create the .NET Console Application using this tutorial or Visual Studio or via the Command Line :

mkdir CouchbaseGettingStarted
cd CouchbaseGettingStarted
dotnet new console

Once you have created the console application add the dependency on Couchbase.EntityFrameworkCore :

dotnet install Couchbase.EntityFrameworkCore --version 1.0.0
The EFCore.NamingConventions package is used to enforce the casing of the SQL++ statements generated by EF Core. The default casing for the SQL generated by EF Core is PascalCase, which doesn’t match the JSON CamelCase convention used by the Couchbase SDK. If the two do not match, results will be returned, but the values will be the .NET defaults for each respective property type. using Couchbase; using Couchbase.EntityFrameworkCore; using Couchbase.EntityFrameworkCore.Extensions; using Couchbase.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; public class BloggingContext : DbContext public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) var loggingFactory = LoggerFactory.Create(builder => builder.AddConsole()); options.UseCouchbase( new ClusterOptions() .WithCredentials("USERNAME", "PASSWORD") .WithConnectionString("couchbases://cb.xxxxxxxx.cloud.couchbase.com") .WithLogging(loggingFactory), couchbaseDbContextOptions => couchbaseDbContextOptions.Bucket = "Content"; couchbaseDbContextOptions.Scope = "Blogs"; optons.UseCamelCaseNamingConvention(); // Use EFCore.NamingConventions for JSON document casing protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity<Blog>().ToCouchbaseCollection(this, "Blog"); modelBuilder.Entity<Post>().ToCouchbaseCollection(this, "Post"); public class Blog public string BlogId { get; set; } public string Url { get; set; } public List<Post> Posts { get; } = new(); public class Post public string PostId { get; set; } public string Title { get; set; } public string Content { get; set; } public int BlogId { get; set; } public Blog Blog { get; set; }
using var db = new BloggingContext();
// Note: This sample requires the Couchbase database to be created before running.
// The Bucket name is "Content", the scope is "Blogs" and the collections are "Post and "Blog"
// Buckets, Scopes and Collections are case sensitive!
// Create
Console.WriteLine("Inserting a new blog");
var blog = new Blog
    Url = "http://blogs.msdn.com/adonet",
    BlogId = Guid.NewGuid().ToString()
db.Add(blog);
await db.SaveChangesAsync();
// Read
Console.WriteLine("Querying for a blog");
blog = await db.Blogs
    .OrderBy(b => b.BlogId)
    .FirstAsync();
// Update
Console.WriteLine("Updating the blog and adding a post");
blog.Url = "https://devblogs.microsoft.com/dotnet";
blog.Posts.Add(
    new Post
        Title = "Hello World",
        Content = "I wrote an app using EF Core!",
        PostId = Guid.NewGuid().ToString()
await db.SaveChangesAsync();
// Delete
Console.WriteLine("Delete the blog");
db.Remove(blog);
await db.SaveChangesAsync();
/source/couchbase-dotnet-ef/samples/CouchbaseGettingStarted/bin/Debug/net8.0/CouchbaseGettingStarted
Inserting a new blog
Querying for a blog
Updating the blog and adding a post
Delete the blog
Process finished with exit code 0.