.NET Core 1.0.1

Getting Started local development with Azure Cosmos DB services – Part 2

May 29, 2017 .NET, .NET Core 1.0, .NET Core 1.0.1, .NET Framework, ASP.NET, Azure, Azure SDK Tools, Azure Tools, Cloud Computing, CodeSnippets, CosmosDB, Document DB, Microsoft, PaaS, SaaS, Visual Studio 2015, Visual Studio 2015 Update 3, Visual Studio 2017, VisualStudio, VS2015, VS2017, Windows, Windows 10, Windows Azure Development, Windowz Azure No comments

In my previous article we discussed about setting local development environment using Cosmos DB Emulator for Windows. With this part 2 of the article, we will cover developing, debugging and integration related aspects of using Cosmos DB Emulator.

Developing with Cosmos DB Emulator

Once you have Cosmos DB emulator installed and running on your machine, you can use any supported Cosmos DB SDK or Cosmos DB REST API to interact with emulator. This process is same as you are using a Cosmos DB cloud service.

Cosmos DB Emulator also provides a build-in visual explorer through which you can view,create and edit collections and documents.

image

Before you integrate Cosmos DB SDK or Cosmos DB REST API you would need to generate master key for authentication. Unlike cloud service, Cosmos DB emulator only support single fixed account and master key.  You would not be able to communicate with Emulator without this master key.

Default Master Key:

Account name: localhost:<port>

Account key: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==

PS: This key is only to be used in Emulator. You cannot use the same key for Production(Cosmos DB Cloud Service).

Furthermore, if you want to set your own key. You can go to command line references and run DocumentDB.Emulator.exe with sufficient command switch to set your own key. Remember it should meet the key security requirements. See command-line tool reference for more information.

The Azure Cosmos DB Emulator is installed by default to the C:\Program Files\Azure Cosmos DB Emulator  or C:\Program Files\DocumentDB Emulator  directory.

Once you have account name and key, you are good to go with development and debugging using Azure Cosmos DB emulator.

Let us start looking at how to use CosmosDB SDK. Once you add Cosmos DB SDK for .NET from NUGET sources. You would need to import the following namespaces to reference necessary classes.

 using Microsoft.Azure.Documents;
   
 using Microsoft.Azure.Documents.Client;
   
 using Microsoft.Azure.Documents.Linq;

Simple code to establish connection:

// Connect to the Azure Cosmos DB Emulator running locally use DocumentClient class in : 
DocumentClient client = new DocumentClient(
    new Uri("https://localhost:8081"), 
    "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==");

In the above code block we are directly embedding endpoint, key in the source code.But as a suggested approch keeping in mind to easily point to production service would be maintain the key in Web.config appSettings.

   <add value="https://localhost:8081/" key="endpoint"/>
    <add value="C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" key="authKey"/>
 

Add NuGet reference to Microsoft.Azure.DocumentDB  (always use the latest version of the library)

image

For the ease of this article, I am going to use the existing ToDoList sample from DocumentDB Samples provided by Microsoft. You can originally find the same source from C:\Program Files\DocumentDB Emulator\Packages\DataExplorer\quickstart.

image

Copy and Unzip DocumentDB-Quickstart-DotNet.zip and open todo.sln in Visual Studio 2017 and your solution structure will look like below:

image

Now run the application in your Visual Studio.

1. You will see an initial screen:

image

2. Click on Create New:

image

3. New record will be added to your Azure Cosmos DB Emulator:

image

4. To verify in Cosmos DB emulator now open Cosmos DB explorer, click on Collections and Select ToDoList

image

5.Expand Documents and select item with id:da305da3-c1dc-4e34-94d9-fd7f82d26c58

image

Hope this article was helpful for you with initial development.  Share your feedback through comments and share this to your friends and colleagues.

Useful Links:

Visual Studio for Mac–Final–Released / Download Here

May 10, 2017 .NET, .NET Core 1.0, .NET Core 1.0.1, .NET Framework, ASP.NET, ASP.NET Core 1.0, ASP.NET Core 1.0.1, ASP.NET MVC, Mac OSX, MacOS Sierra, Microsoft, Mobile-Development, SignalR, Visual Studio for Mac, VisualStudio, Web API v2.0, Xamarin, Xamarin Studio No comments

Microsoft has released Visual Studio for Mac, a revamped and renamed version of Xamarin Studio with little bit look and feel changes to make it look like Visual Studio product line has been released.

With Visual Studio for Mac, you should be able to develop .NET/C#/ASP.NET based apps and XAMARIN Native and Forms based apps in Mac OS environment.

Visual Studio for Mac comes with different editions like as in Visual Studio 2017/Xamarin Studio such as Community, Professional and Enterprise.

  • Visual Studio Community for Mac – Free, fully-featured IDE for students, open-source and individual developers.
  • Visual Studio Professional for Mac – Professional developer tools, services, and subscription benefits for small teams.
  • Visual Studio Enterprise for Mac – End-to-end solution to meet demanding quality and scale needs of teams of all sizes.

vsmac1

vsmac2

Go through Release Notes here for more details.

Download: 

Visual Studio 2017 Released

March 7, 2017 .NET, .NET Core 1.0, .NET Core 1.0.1, .NET Framework, .NET Framework 4.6, ASP.NET, ASP.NET 4.5, ASP.NET AJAX, ASP.NET Core 1.0, ASP.NET Core 1.0.1, Azure Tools, C#.NET, KnowledgeBase, Microsoft, SignalR, Visual Studio 2017, VisualStudio, VS2017, Web API, Web API v2.0, Windows, Windows 10 No comments

Microsoft has released today the latest version of Visual Studio.

The new Visual Studio 2017 will help you develop apps for  Android, iOS, Windows, Web, and Cloud.  It will also help you use version management, be agile, and collaborate effectively.

Includes support for Xcode 8.3, iOS 10.3, watchOS 3.2, and tvOS 10.2 tools and APIs in the Xamarin.VS Extension for Visual Studio 2017..

To know more about all the features included, please go through What’s New in Visual Studio 2017 

RTM VERSION 15.0
RTM BUILD 26228.04
RELEASE DATE 03/07/2017
RELEASE NOTES Release Notes

Download:

Microsoft Visual Studio 2015 Update 3 (KB3165756) – Cumulative Servicing Release – 14.0. 25431.01

November 1, 2016 .NET, .NET Core 1.0, .NET Core 1.0.1, .NET Framework, ASP.NET, ASP.NET Core 1.0, ASP.NET Core 1.0.1, Microsoft, Visual Studio 2015, VisualStudio, VS2015 No comments

As per Microsoft ” This cumulative servicing release provides fixes to Microsoft Visual Studio 2015 Update 3. These fixes address high-impact bugs that were either found by the product team or reported by the community.

Download the latest from: here , and you can fine the detailed list of fixes on the same site.

.NET Core 1.0.1 Update (September 2016) Available

September 14, 2016 .NET, .NET Core 1.0, .NET Core 1.0.1, .NET Framework, ASP.NET, ASP.NET Core 1.0, ASP.NET Core 1.0.1, HotFixes, Linux, Mac OSX, Microsoft, Open.Source, OpenSource, Operating Systems, Updates, Visual Studio 2015, Visual Studio 2015 Update 3, Visual Studio Code, VisualStudio, VS2015, Windows, Windows No comments

Microsoft .NET Core team has released an update to .NET Core 1.0, versioned as “.NET Core 1.0.1”.

Read more detailed updates from Microsoft Developer Announcement Blog: Announcing September 2016 Updates for .NET Core 1.0

You can read the release notes for .NET Core, ASP.NET Core and Entity Framework 1.0.1 to learn about the specific changes that are included, including the commits that the release was built from.

You can download associated tooling updates from below links: