22 | {
23 | public ApplicationDbContext()
24 | : base("DefaultConnection", throwIfV1Schema: false)
25 | {
26 | }
27 |
28 | public static ApplicationDbContext Create()
29 | {
30 | return new ApplicationDbContext();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.GlobalAsaxIntegration")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.GlobalAsaxIntegration")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("91a2b11c-4a7e-4191-98ed-1db7828b8f54")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Scripts/_references.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.GlobalAsaxIntegration/Scripts/_references.js
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Owin;
2 | using Owin;
3 |
4 | [assembly: OwinStartupAttribute(typeof(Couchbase.Examples.GlobalAsaxIntegration.Startup))]
5 | namespace Couchbase.Examples.GlobalAsaxIntegration
6 | {
7 | public partial class Startup
8 | {
9 | public void Configuration(IAppBuilder app)
10 | {
11 | ConfigureAuth(app);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Confirm Email";
3 | }
4 |
5 | @ViewBag.Title.
6 |
7 |
8 | Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.ExternalLoginConfirmationViewModel
2 | @{
3 | ViewBag.Title = "Register";
4 | }
5 | @ViewBag.Title.
6 | Associate your @ViewBag.LoginProvider account.
7 |
8 | @using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 |
12 | Association Form
13 |
14 | @Html.ValidationSummary(true, "", new { @class = "text-danger" })
15 |
16 | You've successfully authenticated with @ViewBag.LoginProvider .
17 | Please enter a user name for this site below and click the Register button to finish
18 | logging in.
19 |
20 |
27 |
32 | }
33 |
34 | @section Scripts {
35 | @Scripts.Render("~/bundles/jqueryval")
36 | }
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Login Failure";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 | Unsuccessful login with service.
8 |
9 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.ForgotPasswordViewModel
2 | @{
3 | ViewBag.Title = "Forgot your password?";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Enter your email.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
25 | }
26 |
27 | @section Scripts {
28 | @Scripts.Render("~/bundles/jqueryval")
29 | }
30 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Forgot Password Confirmation";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 |
8 |
9 |
10 | Please check your email to reset your password.
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/Login.cshtml:
--------------------------------------------------------------------------------
1 | @using Couchbase.Examples.GlobalAsaxIntegration.Models
2 | @model LoginViewModel
3 | @{
4 | ViewBag.Title = "Log in";
5 | }
6 |
7 | @ViewBag.Title.
8 |
60 |
61 | @section Scripts {
62 | @Scripts.Render("~/bundles/jqueryval")
63 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.RegisterViewModel
2 | @{
3 | ViewBag.Title = "Register";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Create a new account.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
26 |
32 |
37 | }
38 |
39 | @section Scripts {
40 | @Scripts.Render("~/bundles/jqueryval")
41 | }
42 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.ResetPasswordViewModel
2 | @{
3 | ViewBag.Title = "Reset password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Reset your password.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 | @Html.HiddenFor(model => model.Code)
15 |
21 |
27 |
33 |
38 | }
39 |
40 | @section Scripts {
41 | @Scripts.Render("~/bundles/jqueryval")
42 | }
43 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Reset password confirmation";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 |
8 |
9 |
10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.SendCodeViewModel
2 | @{
3 | ViewBag.Title = "Send";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
9 | @Html.AntiForgeryToken()
10 | @Html.Hidden("rememberMe", @Model.RememberMe)
11 | Send verification code
12 |
13 |
14 |
15 | Select Two-Factor Authentication Provider:
16 | @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers)
17 |
18 |
19 |
20 | }
21 |
22 | @section Scripts {
23 | @Scripts.Render("~/bundles/jqueryval")
24 | }
25 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.VerifyCodeViewModel
2 | @{
3 | ViewBag.Title = "Verify";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
9 | @Html.AntiForgeryToken()
10 | @Html.Hidden("provider", @Model.Provider)
11 | @Html.Hidden("rememberMe", @Model.RememberMe)
12 | Enter verification code
13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" })
15 |
21 |
29 |
34 | }
35 |
36 | @section Scripts {
37 | @Scripts.Render("~/bundles/jqueryval")
38 | }
39 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Account/_ExternalLoginsListPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.ExternalLoginListViewModel
2 | @using Microsoft.Owin.Security
3 |
4 | Use another service to log in.
5 |
6 | @{
7 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
8 | if (loginProviders.Count() == 0) {
9 |
10 |
11 | There are no external authentication services configured. See this article
12 | for details on setting up this ASP.NET application to support logging in via external services.
13 |
14 |
15 | }
16 | else {
17 | using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) {
18 | @Html.AntiForgeryToken()
19 |
20 |
21 | @foreach (AuthenticationDescription p in loginProviders) {
22 | @p.AuthenticationType
23 | }
24 |
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "About";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Contact";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Home Page";
3 | }
4 |
5 |
6 |
ASP.NET
7 |
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.
8 |
Learn more »
9 |
10 |
11 |
12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.AddPhoneNumberViewModel
2 | @{
3 | ViewBag.Title = "Phone Number";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Add a phone number
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
25 | }
26 |
27 | @section Scripts {
28 | @Scripts.Render("~/bundles/jqueryval")
29 | }
30 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.ChangePasswordViewModel
2 | @{
3 | ViewBag.Title = "Change Password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Change Password Form
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
26 |
32 |
37 | }
38 | @section Scripts {
39 | @Scripts.Render("~/bundles/jqueryval")
40 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.SetPasswordViewModel
2 | @{
3 | ViewBag.Title = "Create Password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | You do not have a local username/password for this site. Add a local
9 | account so you can log in without an external login.
10 |
11 |
12 | @using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
13 | {
14 | @Html.AntiForgeryToken()
15 |
16 | Create Local Login
17 |
18 | @Html.ValidationSummary("", new { @class = "text-danger" })
19 |
25 |
31 |
36 | }
37 | @section Scripts {
38 | @Scripts.Render("~/bundles/jqueryval")
39 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.GlobalAsaxIntegration.Models.VerifyPhoneNumberViewModel
2 | @{
3 | ViewBag.Title = "Verify Phone Number";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | @Html.Hidden("phoneNumber", @Model.PhoneNumber)
12 | Enter verification code
13 | @ViewBag.Status
14 |
15 | @Html.ValidationSummary("", new { @class = "text-danger" })
16 |
22 |
27 | }
28 |
29 | @section Scripts {
30 | @Scripts.Render("~/bundles/jqueryval")
31 | }
32 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model System.Web.Mvc.HandleErrorInfo
2 |
3 | @{
4 | ViewBag.Title = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Shared/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @model System.Web.Mvc.HandleErrorInfo
2 |
3 | @{
4 | ViewBag.Title = "Locked Out";
5 | }
6 |
7 |
8 | Locked out.
9 | This account has been locked out, please try again later.
10 |
11 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title - My ASP.NET Application
7 | @Styles.Render("~/Content/css")
8 | @Scripts.Render("~/bundles/modernizr")
9 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
24 | @Html.ActionLink("Home", "Index", "Home")
25 | @Html.ActionLink("About", "About", "Home")
26 | @Html.ActionLink("Contact", "Contact", "Home")
27 |
28 | @Html.Partial("_LoginPartial")
29 |
30 |
31 |
32 |
33 | @RenderBody()
34 |
35 |
38 |
39 |
40 | @Scripts.Render("~/bundles/jquery")
41 | @Scripts.Render("~/bundles/bootstrap")
42 | @RenderSection("scripts", required: false)
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNet.Identity
2 | @if (Request.IsAuthenticated)
3 | {
4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
5 | {
6 | @Html.AntiForgeryToken()
7 |
8 |
9 |
10 | @Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
11 |
12 | Log off
13 |
14 | }
15 | }
16 | else
17 | {
18 |
19 | @Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })
20 | @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/_Layout.cshtml";
3 | }
4 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.GlobalAsaxIntegration/favicon.ico
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.GlobalAsaxIntegration/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.GlobalAsaxIntegration/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.GlobalAsaxIntegration/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.GlobalAsaxIntegration/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Managment.CreateUpdateViews/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Managment.CreateUpdateViews/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Couchbase.Configuration.Client;
8 |
9 | namespace Couchbase.Examples.Managment.CreateUpdateViews
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | using (var cluster = new Cluster())
16 | {
17 | using (var bucket = cluster.OpenBucket())
18 | {
19 | var manager = bucket.CreateManager("Administrator", "");
20 | var designDoc = "{\"views\":{\"all_docs\":{\"map\":\"function (doc, meta) { emit(meta.id, doc); }\"}}}";
21 | var insertResult = manager.InsertDesignDocumentAsync("dd_docs", designDoc).Result;
22 |
23 | if (insertResult.Success)
24 | {
25 | var designDocModified = "{\"views\": {}}";
26 | var updateResult = manager.UpdateDesignDocumentAsync("dd_docs", designDocModified).Result;
27 | Console.WriteLine(updateResult.Success);
28 | }
29 | }
30 | }
31 | Console.Read();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Managment.CreateUpdateViews/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.Managment.CreateUpdateViews")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.Managment.CreateUpdateViews")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5d185fbb-12ee-4c47-bd5d-052cd4d705bb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Managment.CreateUpdateViews/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Mangement.ClusterProvisioner/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Mangement.ClusterProvisioner/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Configuration.Client;
7 | using Couchbase.Configuration.Server.Serialization;
8 | using Couchbase.Core;
9 | using Couchbase.Management;
10 |
11 | namespace Couchbase.Examples.Mangement.ClusterProvisioner
12 | {
13 | class Program
14 | {
15 | private ICluster _cluster;
16 | private IClusterManager _manager;
17 |
18 | static void Main(string[] args)
19 | {
20 | try
21 | {
22 | var provisioner = new Program();
23 | provisioner.BootStrapCluster();
24 | }
25 | catch (BootstrapException e)
26 | {
27 | Console.WriteLine(e.Message);
28 | Console.WriteLine(e.StackTrace);
29 | }
30 | Console.Read();
31 | }
32 |
33 | static void PrintExceptions(AggregateException e)
34 | {
35 |
36 | }
37 |
38 | public void BootStrapCluster()
39 | {
40 | //get a config pointing at the initial entry point node (EP)
41 | var config = new ClientConfiguration
42 | {
43 | Servers = new List
44 | {
45 | new Uri("http://192.168.77.101:8091/")
46 | }
47 | };
48 |
49 | //create the cluster object
50 | _cluster = new Cluster(config);
51 |
52 | //use the factory method to create a ClusterManager
53 | _manager = _cluster.CreateManager("Administrator", "password");
54 | }
55 |
56 | ///
57 | /// Adds a node to the cluster.
58 | ///
59 | /// The URI for node.
60 | ///
61 | public async Task AddNode(Uri uriForNode)
62 | {
63 | var result = await _manager.AddNodeAsync(uriForNode.Host);
64 | if (result.Success)
65 | {
66 | Console.WriteLine("Node {0} added successfully.", uriForNode);
67 | return;
68 | }
69 | if (result.Exception != null)
70 | {
71 | Console.WriteLine("Failed to add node {0}: {1}\n{2}",
72 | uriForNode, result.Message, result.Exception);
73 | throw result.Exception;
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Mangement.ClusterProvisioner/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.Mangement.ClusterProvisioner")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.Mangement.ClusterProvisioner")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a9c45034-3e8b-4639-8d5b-9b17f3e03e1e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.Mangement.ClusterProvisioner/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OptimisticConcurrencyWithCas/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OptimisticConcurrencyWithCas/Post.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Couchbase.Examples.OptimisticConcurrencyWithCas
4 | {
5 | public class Post
6 | {
7 | public string PostId { get; set; }
8 |
9 | public string Author { get; set; }
10 |
11 | public DateTime Published { get; set; }
12 |
13 | public string Content { get; set; }
14 |
15 | public int Views { get; set; }
16 | }
17 | }
18 |
19 | #region [ License information ]
20 |
21 | /* ************************************************************
22 | *
23 | * @author Couchbase
24 | * @copyright 2015 Couchbase, Inc.
25 | *
26 | * Licensed under the Apache License, Version 2.0 (the "License");
27 | * you may not use this file except in compliance with the License.
28 | * You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing, software
33 | * distributed under the License is distributed on an "AS IS" BASIS,
34 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | * See the License for the specific language governing permissions and
36 | * limitations under the License.
37 | *
38 | * ************************************************************/
39 |
40 | #endregion
41 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OptimisticConcurrencyWithCas/Program.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 | using Couchbase.Configuration.Client;
6 | using Couchbase.IO;
7 |
8 | namespace Couchbase.Examples.OptimisticConcurrencyWithCas
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | ClusterHelper.Initialize(new ClientConfiguration
15 | {
16 | Servers = new List
17 | {
18 | new Uri("http://localhost:8091/")
19 | }
20 | });
21 | var bucket = ClusterHelper.GetBucket("default");
22 |
23 | var revision0 = new Post
24 | {
25 | PostId = "p0001",
26 | Author = "Stuie",
27 | Published = new DateTime(2012, 1, 13),
28 | Content = "A really cool blog post!",
29 | Views = 0
30 | };
31 |
32 | //insert the first revision
33 | bucket.Upsert(revision0.PostId, revision0);
34 |
35 | Task.Run(() => UpdatePostWithCasAsync(revision0));
36 |
37 | Console.Read();
38 | ClusterHelper.Close();
39 | }
40 |
41 | static async Task UpdatePostWithCasAsync(Post post)
42 | {
43 | var bucket = ClusterHelper.GetBucket("default");
44 | const int maxAttempts = 10;
45 | var attempts = 0;
46 |
47 | do
48 | {
49 | //get the original document - if it doesn't exist fail
50 | var result = await bucket.GetAsync(post.PostId);
51 | if (result.Status == ResponseStatus.KeyNotFound)
52 | {
53 | return false;
54 | }
55 |
56 | //update the original documents fields
57 | var original = result.Value;
58 | original.Content = post.Content;
59 | original.Author = post.Author;
60 | original.Views = original.Views++;
61 |
62 | //perform the mutation passing in the CAS value
63 | result = await bucket.UpsertAsync(original.PostId, original, result.Cas);
64 | if (result.Success)
65 | {
66 | return true;
67 | }
68 |
69 | //failed so try again up until maxAttempts
70 | } while (attempts++ < maxAttempts);
71 |
72 | //we failed within maxAttemps
73 | return false;
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OptimisticConcurrencyWithCas/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.OptimisticConcurrencyWithCas")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.OptimisticConcurrencyWithCas")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f917f452-4505-42d5-95e4-660c65b95349")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OptimisticConcurrencyWithCas/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/App_Start/BundleConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web;
2 | using System.Web.Optimization;
3 |
4 | namespace Couchbase.Examples.OwinKatanaIntegration
5 | {
6 | public class BundleConfig
7 | {
8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9 | public static void RegisterBundles(BundleCollection bundles)
10 | {
11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12 | "~/Scripts/jquery-{version}.js"));
13 |
14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
15 | "~/Scripts/jquery.validate*"));
16 |
17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're
18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
20 | "~/Scripts/modernizr-*"));
21 |
22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
23 | "~/Scripts/bootstrap.js",
24 | "~/Scripts/respond.js"));
25 |
26 | bundles.Add(new StyleBundle("~/Content/css").Include(
27 | "~/Content/bootstrap.css",
28 | "~/Content/site.css"));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/App_Start/FilterConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web;
2 | using System.Web.Mvc;
3 |
4 | namespace Couchbase.Examples.OwinKatanaIntegration
5 | {
6 | public class FilterConfig
7 | {
8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters)
9 | {
10 | filters.Add(new HandleErrorAttribute());
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/App_Start/RouteConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Routing;
7 |
8 | namespace Couchbase.Examples.OwinKatanaIntegration
9 | {
10 | public class RouteConfig
11 | {
12 | public static void RegisterRoutes(RouteCollection routes)
13 | {
14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15 |
16 | routes.MapRoute(
17 | name: "Default",
18 | url: "{controller}/{action}/{id}",
19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20 | );
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Content/Site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Set padding to keep content from hitting the edges */
7 | .body-content {
8 | padding-left: 15px;
9 | padding-right: 15px;
10 | }
11 |
12 | /* Override the default bootstrap behavior where horizontal description lists
13 | will truncate terms that are too long to fit in the left column
14 | */
15 | .dl-horizontal dt {
16 | white-space: normal;
17 | }
18 |
19 | /* Set width on the form input elements since they're 100% wide by default */
20 | input,
21 | select,
22 | textarea {
23 | max-width: 280px;
24 | }
25 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 |
7 | namespace Couchbase.Examples.OwinKatanaIntegration.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public ActionResult Index()
12 | {
13 | var bucket = ClusterHelper.GetBucket("default");
14 | var result = bucket.Upsert("foo", "bar");
15 | return View();
16 | }
17 |
18 | public ActionResult About()
19 | {
20 | ViewBag.Message = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public ActionResult Contact()
26 | {
27 | ViewBag.Message = "Your contact page.";
28 |
29 | return View();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Couchbase.Examples.OwinKatanaIntegration.MvcApplication" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Optimization;
7 | using System.Web.Routing;
8 |
9 | namespace Couchbase.Examples.OwinKatanaIntegration
10 | {
11 | public class MvcApplication : System.Web.HttpApplication
12 | {
13 | protected void Application_Start()
14 | {
15 | AreaRegistration.RegisterAllAreas();
16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
17 | RouteConfig.RegisterRoutes(RouteTable.Routes);
18 | BundleConfig.RegisterBundles(BundleTable.Bundles);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Models/IdentityModels.cs:
--------------------------------------------------------------------------------
1 | using System.Data.Entity;
2 | using System.Security.Claims;
3 | using System.Threading.Tasks;
4 | using Microsoft.AspNet.Identity;
5 | using Microsoft.AspNet.Identity.EntityFramework;
6 |
7 | namespace Couchbase.Examples.OwinKatanaIntegration.Models
8 | {
9 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
10 | public class ApplicationUser : IdentityUser
11 | {
12 | public async Task GenerateUserIdentityAsync(UserManager manager)
13 | {
14 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
15 | var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
16 | // Add custom user claims here
17 | return userIdentity;
18 | }
19 | }
20 |
21 | public class ApplicationDbContext : IdentityDbContext
22 | {
23 | public ApplicationDbContext()
24 | : base("DefaultConnection", throwIfV1Schema: false)
25 | {
26 | }
27 |
28 | public static ApplicationDbContext Create()
29 | {
30 | return new ApplicationDbContext();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.OwinKatanaIntegration")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.OwinKatanaIntegration")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("bc3c88e2-9004-41af-9f2c-26f24bbf1aa9")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Scripts/_references.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.OwinKatanaIntegration/Scripts/_references.js
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using Couchbase.Configuration.Client;
5 | using Microsoft.Owin;
6 | using Microsoft.Owin.BuilderProperties;
7 | using Owin;
8 |
9 | [assembly: OwinStartupAttribute(typeof(Couchbase.Examples.OwinKatanaIntegration.Startup))]
10 | namespace Couchbase.Examples.OwinKatanaIntegration
11 | {
12 | public partial class Startup
13 | {
14 | public void Configuration(IAppBuilder app)
15 | {
16 | ConfigureAuth(app);
17 |
18 | //initialize the ClusterHelper
19 | ClusterHelper.Initialize(new ClientConfiguration
20 | {
21 | Servers = new List
22 | {
23 | new Uri("http://localhost:8091/")
24 | }
25 | });
26 |
27 | //Register a callback that will dispose of the ClusterHelper on app shutdown
28 | var properties = new AppProperties(app.Properties);
29 | var token = properties.OnAppDisposing;
30 | if (token != CancellationToken.None)
31 | {
32 | token.Register(() =>
33 | {
34 | ClusterHelper.Close();
35 | });
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Confirm Email";
3 | }
4 |
5 | @ViewBag.Title.
6 |
7 |
8 | Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.ExternalLoginConfirmationViewModel
2 | @{
3 | ViewBag.Title = "Register";
4 | }
5 | @ViewBag.Title.
6 | Associate your @ViewBag.LoginProvider account.
7 |
8 | @using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 |
12 | Association Form
13 |
14 | @Html.ValidationSummary(true, "", new { @class = "text-danger" })
15 |
16 | You've successfully authenticated with @ViewBag.LoginProvider .
17 | Please enter a user name for this site below and click the Register button to finish
18 | logging in.
19 |
20 |
27 |
32 | }
33 |
34 | @section Scripts {
35 | @Scripts.Render("~/bundles/jqueryval")
36 | }
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Login Failure";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 | Unsuccessful login with service.
8 |
9 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.ForgotPasswordViewModel
2 | @{
3 | ViewBag.Title = "Forgot your password?";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Enter your email.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
25 | }
26 |
27 | @section Scripts {
28 | @Scripts.Render("~/bundles/jqueryval")
29 | }
30 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Forgot Password Confirmation";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 |
8 |
9 |
10 | Please check your email to reset your password.
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.RegisterViewModel
2 | @{
3 | ViewBag.Title = "Register";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Create a new account.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
26 |
32 |
37 | }
38 |
39 | @section Scripts {
40 | @Scripts.Render("~/bundles/jqueryval")
41 | }
42 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.ResetPasswordViewModel
2 | @{
3 | ViewBag.Title = "Reset password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Reset your password.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 | @Html.HiddenFor(model => model.Code)
15 |
21 |
27 |
33 |
38 | }
39 |
40 | @section Scripts {
41 | @Scripts.Render("~/bundles/jqueryval")
42 | }
43 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Reset password confirmation";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 |
8 |
9 |
10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.SendCodeViewModel
2 | @{
3 | ViewBag.Title = "Send";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
9 | @Html.AntiForgeryToken()
10 | @Html.Hidden("rememberMe", @Model.RememberMe)
11 | Send verification code
12 |
13 |
14 |
15 | Select Two-Factor Authentication Provider:
16 | @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers)
17 |
18 |
19 |
20 | }
21 |
22 | @section Scripts {
23 | @Scripts.Render("~/bundles/jqueryval")
24 | }
25 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.VerifyCodeViewModel
2 | @{
3 | ViewBag.Title = "Verify";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
9 | @Html.AntiForgeryToken()
10 | @Html.Hidden("provider", @Model.Provider)
11 | @Html.Hidden("rememberMe", @Model.RememberMe)
12 | Enter verification code
13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" })
15 |
21 |
29 |
34 | }
35 |
36 | @section Scripts {
37 | @Scripts.Render("~/bundles/jqueryval")
38 | }
39 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Account/_ExternalLoginsListPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.ExternalLoginListViewModel
2 | @using Microsoft.Owin.Security
3 |
4 | Use another service to log in.
5 |
6 | @{
7 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
8 | if (loginProviders.Count() == 0) {
9 |
10 |
11 | There are no external authentication services configured. See this article
12 | for details on setting up this ASP.NET application to support logging in via external services.
13 |
14 |
15 | }
16 | else {
17 | using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) {
18 | @Html.AntiForgeryToken()
19 |
20 |
21 | @foreach (AuthenticationDescription p in loginProviders) {
22 | @p.AuthenticationType
23 | }
24 |
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "About";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Contact";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Home Page";
3 | }
4 |
5 |
6 |
ASP.NET
7 |
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.
8 |
Learn more »
9 |
10 |
11 |
12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.AddPhoneNumberViewModel
2 | @{
3 | ViewBag.Title = "Phone Number";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Add a phone number
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
25 | }
26 |
27 | @section Scripts {
28 | @Scripts.Render("~/bundles/jqueryval")
29 | }
30 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.ChangePasswordViewModel
2 | @{
3 | ViewBag.Title = "Change Password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Change Password Form
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
26 |
32 |
37 | }
38 | @section Scripts {
39 | @Scripts.Render("~/bundles/jqueryval")
40 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.SetPasswordViewModel
2 | @{
3 | ViewBag.Title = "Create Password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | You do not have a local username/password for this site. Add a local
9 | account so you can log in without an external login.
10 |
11 |
12 | @using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
13 | {
14 | @Html.AntiForgeryToken()
15 |
16 | Create Local Login
17 |
18 | @Html.ValidationSummary("", new { @class = "text-danger" })
19 |
25 |
31 |
36 | }
37 | @section Scripts {
38 | @Scripts.Render("~/bundles/jqueryval")
39 | }
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model Couchbase.Examples.OwinKatanaIntegration.Models.VerifyPhoneNumberViewModel
2 | @{
3 | ViewBag.Title = "Verify Phone Number";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | @Html.Hidden("phoneNumber", @Model.PhoneNumber)
12 | Enter verification code
13 | @ViewBag.Status
14 |
15 | @Html.ValidationSummary("", new { @class = "text-danger" })
16 |
22 |
27 | }
28 |
29 | @section Scripts {
30 | @Scripts.Render("~/bundles/jqueryval")
31 | }
32 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model System.Web.Mvc.HandleErrorInfo
2 |
3 | @{
4 | ViewBag.Title = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Shared/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @model System.Web.Mvc.HandleErrorInfo
2 |
3 | @{
4 | ViewBag.Title = "Locked Out";
5 | }
6 |
7 |
8 | Locked out.
9 | This account has been locked out, please try again later.
10 |
11 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title - My ASP.NET Application
7 | @Styles.Render("~/Content/css")
8 | @Scripts.Render("~/bundles/modernizr")
9 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
24 | @Html.ActionLink("Home", "Index", "Home")
25 | @Html.ActionLink("About", "About", "Home")
26 | @Html.ActionLink("Contact", "Contact", "Home")
27 |
28 | @Html.Partial("_LoginPartial")
29 |
30 |
31 |
32 |
33 | @RenderBody()
34 |
35 |
38 |
39 |
40 | @Scripts.Render("~/bundles/jquery")
41 | @Scripts.Render("~/bundles/bootstrap")
42 | @RenderSection("scripts", required: false)
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNet.Identity
2 | @if (Request.IsAuthenticated)
3 | {
4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
5 | {
6 | @Html.AntiForgeryToken()
7 |
8 |
9 |
10 | @Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
11 |
12 | Log off
13 |
14 | }
15 | }
16 | else
17 | {
18 |
19 | @Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })
20 | @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/_Layout.cshtml";
3 | }
4 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.OwinKatanaIntegration/favicon.ico
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.OwinKatanaIntegration/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.OwinKatanaIntegration/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbaselabs/couchbase-net-examples/e1e96d60221dc0db23b120c67d0622ebe2174434/Src/Couchbase.Examples.OwinKatanaIntegration/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.OwinKatanaIntegration/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PersistTo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PersistTo/Post.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Couchbase.Examples.PersistTo
4 | {
5 | public class Post
6 | {
7 | public string PostId { get; set; }
8 |
9 | public string Author { get; set; }
10 |
11 | public DateTime Published { get; set; }
12 |
13 | public string Content { get; set; }
14 |
15 | public int Views { get; set; }
16 | }
17 | }
18 |
19 | #region [ License information ]
20 |
21 | /* ************************************************************
22 | *
23 | * @author Couchbase
24 | * @copyright 2015 Couchbase, Inc.
25 | *
26 | * Licensed under the Apache License, Version 2.0 (the "License");
27 | * you may not use this file except in compliance with the License.
28 | * You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing, software
33 | * distributed under the License is distributed on an "AS IS" BASIS,
34 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | * See the License for the specific language governing permissions and
36 | * limitations under the License.
37 | *
38 | * ************************************************************/
39 |
40 | #endregion
41 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PersistTo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Configuration.Client;
7 | using Couchbase;
8 | using Couchbase.Core;
9 |
10 | namespace Couchbase.Examples.PersistTo
11 | {
12 | class Program
13 | {
14 | private static IBucket _bucket;
15 | static void Main(string[] args)
16 | {
17 | ClusterHelper.Initialize(new ClientConfiguration
18 | {
19 | Servers = new List
20 | {
21 | new Uri("http://localhost:8091/")
22 | }
23 | });
24 | _bucket = ClusterHelper.GetBucket("default");
25 |
26 | Task.Run(async () =>
27 | {
28 | var result = await InsertWithPersistTo(new Post
29 | {
30 | PostId = "p-0002",
31 | Author = "Bingo Bailey",
32 | Content = "Some nice content",
33 | Published = DateTime.Now
34 | });
35 |
36 | Console.WriteLine(result);
37 | });
38 |
39 | Console.Read();
40 | ClusterHelper.Close();
41 | }
42 |
43 | static async Task InsertWithPersistTo(Post value)
44 | {
45 | var result = await _bucket.InsertAsync(value.PostId, value, ReplicateTo.Zero, Couchbase.PersistTo.Two);
46 | if (result.Success)
47 | {
48 | return true;
49 | }
50 | return false;
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PersistTo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.PersistTo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.PersistTo")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("15992257-8e84-4239-bb23-40c4e647d534")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PersistTo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PessimisticConcurrencyWithLock/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PessimisticConcurrencyWithLock/Post.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Couchbase.Examples.PessimisticConcurrencyWithLock
4 | {
5 | public class Post
6 | {
7 | public string PostId { get; set; }
8 |
9 | public string Author { get; set; }
10 |
11 | public DateTime Published { get; set; }
12 |
13 | public string Content { get; set; }
14 |
15 | public int Views { get; set; }
16 | }
17 | }
18 |
19 | #region [ License information ]
20 |
21 | /* ************************************************************
22 | *
23 | * @author Couchbase
24 | * @copyright 2015 Couchbase, Inc.
25 | *
26 | * Licensed under the Apache License, Version 2.0 (the "License");
27 | * you may not use this file except in compliance with the License.
28 | * You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing, software
33 | * distributed under the License is distributed on an "AS IS" BASIS,
34 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | * See the License for the specific language governing permissions and
36 | * limitations under the License.
37 | *
38 | * ************************************************************/
39 |
40 | #endregion
41 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PessimisticConcurrencyWithLock/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Configuration.Client;
7 | using Couchbase.Core;
8 | using Couchbase.IO;
9 |
10 | namespace Couchbase.Examples.PessimisticConcurrencyWithLock
11 | {
12 | class Program
13 | {
14 | static void Main(string[] args)
15 | {
16 | ClusterHelper.Initialize(new ClientConfiguration
17 | {
18 | Servers = new List
19 | {
20 | new Uri("http://localhost:8091/")
21 | }
22 | });
23 | var bucket = ClusterHelper.GetBucket("default");
24 |
25 | var revision0 = new Post
26 | {
27 | PostId = "p0001",
28 | Author = "Stuie",
29 | Published = new DateTime(2012, 1, 13),
30 | Content = "A really cool blog post!",
31 | Views = 0
32 | };
33 |
34 | //insert the first revision
35 | bucket.Upsert(revision0.PostId, revision0);
36 |
37 | Task.Run(() => UpdatePostWithLockAsync(revision0));
38 |
39 | Console.Read();
40 | ClusterHelper.Close();
41 | }
42 |
43 | static async Task UpdatePostWithLockAsync(Post modified)
44 | {
45 | var bucket = ClusterHelper.GetBucket("default");
46 | var success = false;
47 |
48 | //get the original document - if it doesn't exist fail
49 | var result = await bucket.GetWithLockAsync(modified.PostId, TimeSpan.FromSeconds(5));
50 | if (result.Success)
51 | {
52 | //update the original documents fields
53 | var original = result.Value;
54 | original.Content = modified.Content;
55 | original.Author = modified.Author;
56 | original.Views = original.Views++;
57 |
58 | //perform the mutation passing in the CAS value
59 | var updated = await bucket.UpsertAsync(original.PostId, original, result.Cas);
60 | if (updated.Success)
61 | {
62 | success = true;
63 | }
64 | await bucket.UnlockAsync(original.PostId, result.Cas);
65 | }
66 | return success;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PessimisticConcurrencyWithLock/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.PessimisticConcurrencyWithLock")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.PessimisticConcurrencyWithLock")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5c319ed4-5125-4135-b559-460cc03b1572")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.PessimisticConcurrencyWithLock/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.ReplicateTo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.ReplicateTo/Post.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Couchbase.Examples.ReplicateTo
4 | {
5 | public class Post
6 | {
7 | public string PostId { get; set; }
8 |
9 | public string Author { get; set; }
10 |
11 | public DateTime Published { get; set; }
12 |
13 | public string Content { get; set; }
14 |
15 | public int Views { get; set; }
16 | }
17 | }
18 |
19 | #region [ License information ]
20 |
21 | /* ************************************************************
22 | *
23 | * @author Couchbase
24 | * @copyright 2015 Couchbase, Inc.
25 | *
26 | * Licensed under the Apache License, Version 2.0 (the "License");
27 | * you may not use this file except in compliance with the License.
28 | * You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing, software
33 | * distributed under the License is distributed on an "AS IS" BASIS,
34 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | * See the License for the specific language governing permissions and
36 | * limitations under the License.
37 | *
38 | * ************************************************************/
39 |
40 | #endregion
41 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.ReplicateTo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Configuration.Client;
7 | using Couchbase.Core;
8 | using Couchbase;
9 |
10 | namespace Couchbase.Examples.ReplicateTo
11 | {
12 | internal class Program
13 | {
14 | private static IBucket _bucket;
15 |
16 | private static void Main(string[] args)
17 | {
18 | ClusterHelper.Initialize(new ClientConfiguration
19 | {
20 | Servers = new List
21 | {
22 | new Uri("http://localhost:8091/")
23 | }
24 | });
25 | _bucket = ClusterHelper.GetBucket("default");
26 |
27 | Task.Run(async () =>
28 | {
29 | var result = await InsertWithReplicateTo(new Post
30 | {
31 | PostId = "p-0002",
32 | Author = "Bingo Bailey",
33 | Content = "Some nice content",
34 | Published = DateTime.Now
35 | });
36 |
37 | Console.WriteLine(result);
38 | });
39 |
40 | Console.Read();
41 | ClusterHelper.Close();
42 | }
43 |
44 | private static async Task InsertWithReplicateTo(Post value)
45 | {
46 | var result = await _bucket.UpsertAsync(value.PostId, value, Couchbase.ReplicateTo.Two);
47 | if (result.Success)
48 | {
49 | return true;
50 | }
51 | return false;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.ReplicateTo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.ReplicateTo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.ReplicateTo")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ec1d652f-3db1-4c06-92c8-5e063ccc9cf3")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.ReplicateTo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.SubDocumentAPI/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.SubDocumentAPI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.SubDocumentAPI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.SubDocumentAPI")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7c148537-1abe-4279-9d87-2262de9829be")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.SubDocumentAPI/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.TouchAndGet/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.TouchAndGet/Post.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Couchbase.Examples.OptimisticConcurrencyWithCas
4 | {
5 | public class Post
6 | {
7 | public string PostId { get; set; }
8 |
9 | public string Author { get; set; }
10 |
11 | public DateTime Published { get; set; }
12 |
13 | public string Content { get; set; }
14 |
15 | public int Views { get; set; }
16 | }
17 | }
18 |
19 | #region [ License information ]
20 |
21 | /* ************************************************************
22 | *
23 | * @author Couchbase
24 | * @copyright 2015 Couchbase, Inc.
25 | *
26 | * Licensed under the Apache License, Version 2.0 (the "License");
27 | * you may not use this file except in compliance with the License.
28 | * You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing, software
33 | * distributed under the License is distributed on an "AS IS" BASIS,
34 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | * See the License for the specific language governing permissions and
36 | * limitations under the License.
37 | *
38 | * ************************************************************/
39 |
40 | #endregion
41 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.TouchAndGet/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using Couchbase.Configuration.Client;
8 |
9 | namespace Couchbase.Examples.TouchAndGet
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | ClusterHelper.Initialize(new ClientConfiguration
16 | {
17 | Servers = new List
18 | {
19 | new Uri("http://192.168.77.101/:8091/")
20 | }
21 | });
22 | GetAndTouchAsync();
23 | Console.Read();
24 | ClusterHelper.Close();
25 | }
26 |
27 | private static async void GetAndTouchAsync()
28 | {
29 | var bucket = ClusterHelper.GetBucket("default");
30 | var result = bucket.Upsert("foo", "bar", new TimeSpan(0, 0, 0, 3));
31 |
32 | if (result.Success)
33 | {
34 | Thread.Sleep(1000);
35 |
36 | result = bucket.GetAndTouch("foo", new TimeSpan(0, 0, 0, 3));
37 | Console.WriteLine(result.Success);
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.TouchAndGet/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Examples.TouchAndGet")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Examples.TouchAndGet")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5d5df439-55cc-4b16-bc5e-13b74c7e97a2")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Examples.TouchAndGet/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.ExamplesTimeToLive/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.ExamplesTimeToLive/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Configuration.Client;
7 |
8 | namespace Couchbase.ExamplesTimeToLive
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | ClusterHelper.Initialize(new ClientConfiguration
15 | {
16 | Servers = new List
17 | {
18 | new Uri("http://192.168.77.101/:8091/")
19 | }
20 | });
21 |
22 | UpsertWithTtl();
23 |
24 | UpsertWithDocumentTtl();
25 |
26 | Console.Read();
27 | ClusterHelper.Close();
28 | }
29 |
30 | static async void UpsertWithTtl()
31 | {
32 | var bucket = ClusterHelper.GetBucket("default");
33 |
34 | var result = await bucket.UpsertAsync("foo", "bar", new TimeSpan(2, 0, 0, 0));
35 | if (result.Success)
36 | {
37 | //upsert was successful
38 | }
39 | }
40 |
41 | static async void UpsertWithDocumentTtl()
42 | {
43 | var bucket = ClusterHelper.GetBucket("default");
44 |
45 | var result = await bucket.UpsertAsync(new Document
46 | {
47 | Id = "foo",
48 | Content = "bar",
49 | Expiry = (uint) new TimeSpan(2, 0, 0, 0).TotalMilliseconds
50 | });
51 |
52 | if (result.Success)
53 | {
54 | //upsert was successful
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Src/Couchbase.ExamplesTimeToLive/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.ExamplesTimeToLive")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.ExamplesTimeToLive")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("55bdebd1-ddd4-4efb-9ef1-22995cc75628")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.ExamplesTimeToLive/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.HelloCouchbase/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.HelloCouchbase/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Couchbase.HelloCouchbase
4 | {
5 | class Program
6 | {
7 | public static Cluster Cluster = new Cluster();
8 |
9 | static void Main(string[] args)
10 | {
11 | using (var bucket = Cluster.OpenBucket())
12 | {
13 | var document = new Document
14 | {
15 | Id = "Hello",
16 | Content = new
17 | {
18 | Name = "Couchbase"
19 | }
20 | };
21 |
22 | var upsert = bucket.Upsert(document);
23 | if (upsert.Success)
24 | {
25 | var get = bucket.GetDocument(document.Id);
26 | document = get.Document;
27 | var msg = string.Format("{0} {1}!", document.Id, document.Content.Name);
28 | Console.WriteLine(msg);
29 | }
30 | Console.Read();
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Src/Couchbase.HelloCouchbase/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.HelloCouchbase")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.HelloCouchbase")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("c011f999-0815-4340-9d6c-60122fc92ceb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.HelloCouchbase/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.IncrementExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.IncrementExample/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Core;
7 |
8 | namespace Couchbase.IncrementExample
9 | {
10 | class Program
11 | {
12 | static Cluster _cluster = new Cluster();
13 |
14 | static void Main(string[] args)
15 | {
16 | using (var bucket = _cluster.OpenBucket())
17 | {
18 | var key = "stats::counter1";
19 | Increment(bucket, key);
20 | Increment(bucket, key);
21 | Decrement(bucket, key);
22 | Decrement(bucket, key);
23 | Decrement(bucket, key);
24 | }
25 | _cluster.Dispose();
26 | Console.Read();
27 | }
28 |
29 | static void Increment(IBucket bucket, string key)
30 | {
31 | var result = bucket.Increment(key);
32 | if (result.Success)
33 | {
34 | Console.WriteLine(result.Value);
35 | }
36 | }
37 |
38 | static void Decrement(IBucket bucket, string key)
39 | {
40 | var result = bucket.Decrement(key);
41 | if (result.Success)
42 | {
43 | Console.WriteLine(result.Value);
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Src/Couchbase.IncrementExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.IncrementExample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.IncrementExample")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("826a6685-864f-4e54-9e33-31ad392582af")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.IncrementExample/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.Linq2CouchbaseExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Src/Couchbase.Linq2CouchbaseExample/Beer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Couchbase.Linq.Filters;
3 | using Newtonsoft.Json;
4 |
5 | namespace Couchbase.Linq2CouchbaseExample
6 | {
7 | [DocumentTypeFilter("beer")]
8 | public class Beer
9 | {
10 | [JsonProperty("name")]
11 | public string Name { get; set; }
12 |
13 | [JsonProperty("abv")]
14 | public decimal Abv { get; set; }
15 |
16 | [JsonProperty("ibu")]
17 | public decimal Ibu { get; set; }
18 |
19 | [JsonProperty("srm")]
20 | public decimal Srm { get; set; }
21 |
22 | [JsonProperty("upc")]
23 | public decimal Upc { get; set; }
24 |
25 | [JsonProperty("type")]
26 | public string Type { get; set; }
27 |
28 | [JsonProperty("brewery_id")]
29 | public string BreweryId { get; set; }
30 |
31 | [JsonProperty("description")]
32 | public string Description { get; set; }
33 |
34 | [JsonProperty("style")]
35 | public string Style { get; set; }
36 |
37 | [JsonProperty("category")]
38 | public string Category { get; set; }
39 |
40 | [JsonProperty("updated")]
41 | public DateTime Updated { get; set; }
42 | }
43 | }
44 |
45 | #region [ License information ]
46 |
47 | /* ************************************************************
48 | *
49 | * @author Couchbase
50 | * @copyright 2015 Couchbase, Inc.
51 | *
52 | * Licensed under the Apache License, Version 2.0 (the "License");
53 | * you may not use this file except in compliance with the License.
54 | * You may obtain a copy of the License at
55 | *
56 | * http://www.apache.org/licenses/LICENSE-2.0
57 | *
58 | * Unless required by applicable law or agreed to in writing, software
59 | * distributed under the License is distributed on an "AS IS" BASIS,
60 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
61 | * See the License for the specific language governing permissions and
62 | * limitations under the License.
63 | *
64 | * ************************************************************/
65 |
66 | #endregion
67 |
--------------------------------------------------------------------------------
/Src/Couchbase.Linq2CouchbaseExample/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Configuration.Client;
7 | using Couchbase.Linq;
8 |
9 | namespace Couchbase.Linq2CouchbaseExample
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | var config = new ClientConfiguration
16 | {
17 | Servers = new List { new Uri("http://localhost:8091") }
18 | };
19 |
20 | ClusterHelper.Initialize(config);
21 | var db = new BucketContext(ClusterHelper.GetBucket("beer-sample"));
22 | var query = from b in db.Query()
23 | select b;
24 |
25 | foreach (var beer in query)
26 | {
27 | Console.WriteLine(beer.Type + ": " + beer.Name);
28 | }
29 | Console.Read();
30 | ClusterHelper.Close();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Src/Couchbase.Linq2CouchbaseExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.Linq2CouchbaseExample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.Linq2CouchbaseExample")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5bb0be0a-40e4-495c-ae5a-7d8c39aee832")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.Linq2CouchbaseExample/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Src/Couchbase.LoggingExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/Src/Couchbase.LoggingExample/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Couchbase.LoggingExample
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | using (var cluster = new Cluster())
14 | {
15 | using (var bucket = cluster.OpenBucket())
16 | {
17 | bucket.Upsert("somekey", "somevalue");
18 | }
19 | }
20 | Console.Read();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Src/Couchbase.LoggingExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.LoggingExample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.LoggingExample")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0d02ba4e-c572-47ae-991c-750a0d9be263")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.LoggingExample/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Src/Couchbase.N1QLExamples/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.N1QLExamples/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.CompilerServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Couchbase.N1QLExamples
9 | {
10 | class Program
11 | {
12 | static Cluster _cluster = new Cluster();
13 |
14 | static void Main(string[] args)
15 | {
16 | using (var bucket = _cluster.OpenBucket())
17 | {
18 | const string query = "SELECT c FROM tutorial as c";
19 | var result = bucket.Query(query);
20 | foreach (var row in result.Rows)
21 | {
22 | Console.WriteLine(row);
23 | }
24 | }
25 | _cluster.Dispose();
26 | Console.Read();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Src/Couchbase.N1QLExamples/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.N1QLExamples")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.N1QLExamples")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("d8f4a218-00dc-463c-b8d2-8bc055eef4f8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.N1QLExamples/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.ReadExamples/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.ReadExamples/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Couchbase.ReadExamples
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Src/Couchbase.ReadExamples/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.ReadExamples")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.ReadExamples")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f052c7a9-fcf1-4de5-919a-4d37eaceb8b6")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.ReadExamples/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.SslExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/Src/Couchbase.SslExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.SslExample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.SslExample")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("8f7fc20d-7fd7-46e7-9f8c-6b9a999bea38")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.SslExample/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Couchbase.ViewExamples/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/Couchbase.ViewExamples/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Couchbase.Core;
7 |
8 | namespace Couchbase.ViewExamples
9 | {
10 | class Program
11 | {
12 | static Cluster _cluster = new Cluster();
13 |
14 | static void Main(string[] args)
15 | {
16 | using (var bucket = _cluster.OpenBucket("beer-sample"))
17 | {
18 | BasicQuery(bucket);
19 | }
20 | _cluster.Dispose();
21 | Console.Read();
22 | }
23 |
24 | static void BasicQuery(IBucket bucket)
25 | {
26 | var query = bucket.CreateQuery("beer", "brewery_beers").
27 | Limit(5);
28 |
29 | var result = bucket.Query(query);
30 | foreach (var row in result.Rows)
31 | {
32 | Console.WriteLine(row);
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.ViewExamples/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Couchbase.ViewExamples")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Couchbase.ViewExamples")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0e7b7513-8620-47b5-b97f-4e8aee1c3a74")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/Couchbase.ViewExamples/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/CouchbaseAsyncExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Src/CouchbaseAsyncExample/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Remoting.Channels;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Couchbase;
8 | using Couchbase.Configuration.Client;
9 | using Couchbase.Core;
10 |
11 | namespace CouchbaseAsyncExample
12 | {
13 | class Program
14 | {
15 | public class Person
16 | {
17 | private static readonly string _type = "person";
18 |
19 | public Person()
20 | {
21 | Type = _type;
22 | }
23 |
24 | public string Id { get; set; }
25 |
26 | public string Name { get; set; }
27 |
28 | public int Age { get; set; }
29 |
30 | public string Type { get; private set; }
31 | }
32 |
33 | private static void Main(string[] args)
34 | {
35 | var count = 100000;
36 | var config = new ClientConfiguration
37 | {
38 | Servers = new List
39 | {
40 | //change this to your cluster to bootstrap
41 | new Uri("http://localhost:8091/pools")
42 | }
43 | };
44 |
45 | ClusterHelper.Initialize(config);
46 | var bucket = ClusterHelper.GetBucket("default");
47 |
48 | var items = new List();
49 | for (int i = 0; i < count; i++)
50 | {
51 | items.Add(new Person {Age = 21, Name = "Some name" + i, Id = i.ToString()});
52 | }
53 |
54 | Task.Run(async () => await UpsertAllAsync(items, bucket)).ConfigureAwait(false);
55 |
56 | Console.Read();
57 | ClusterHelper.Close();
58 | }
59 |
60 | public static async Task UpsertAllAsync(List persons, IBucket bucket)
61 | {
62 | var tasks = new List>>();
63 | persons.ForEach(x => tasks.Add(bucket.UpsertAsync(x.Id, x)));
64 |
65 | var results = await Task.WhenAll(tasks).ConfigureAwait(false);
66 | Console.WriteLine("Total upserted: {0}", results.Length);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Src/CouchbaseAsyncExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("CouchbaseAsyncExample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("CouchbaseAsyncExample")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("cc9253b8-05e1-4dda-b969-6e9700cd5466")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Src/CouchbaseAsyncExample/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------