<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual Studio &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/visual-studio/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:21:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Visual Studio &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Webinar: Why Visual Studio 2017? Few Features of VS2017 You May Love</title>
		<link>https://mail.sibeeshpassion.com/webinar-why-visual-studio-2017-few-features-of-vs2017-you-may-love/</link>
					<comments>https://mail.sibeeshpassion.com/webinar-why-visual-studio-2017-few-features-of-vs2017-you-may-love/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 10 Apr 2017 09:29:29 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2017]]></category>
		<category><![CDATA[Webinars]]></category>
		<category><![CDATA[Features of VS2017]]></category>
		<category><![CDATA[VS2017]]></category>
		<category><![CDATA[VS2017 IDE features]]></category>
		<category><![CDATA[Webinar]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=12175</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/webinar-why-visual-studio-2017-few-features-of-vs2017-you-may-love/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The Cool New Refactoring and Text Editor Options in VS2017</title>
		<link>https://mail.sibeeshpassion.com/the-cool-new-refactoring-and-text-editor-options-in-vs2017/</link>
					<comments>https://mail.sibeeshpassion.com/the-cool-new-refactoring-and-text-editor-options-in-vs2017/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 02 Apr 2017 08:07:02 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2017]]></category>
		<category><![CDATA[New text editor experience in VS2017]]></category>
		<category><![CDATA[Refactoring In VS2017]]></category>
		<category><![CDATA[VS2017]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=12167</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/the-cool-new-refactoring-and-text-editor-options-in-vs2017/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>What is there for a JavaScript developer in VS2017</title>
		<link>https://mail.sibeeshpassion.com/what-is-there-for-a-javascript-developer-in-vs2017/</link>
					<comments>https://mail.sibeeshpassion.com/what-is-there-for-a-javascript-developer-in-vs2017/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 02 Apr 2017 05:37:14 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2017]]></category>
		<category><![CDATA[Develop JavaScript application in VS2017]]></category>
		<category><![CDATA[JavaScript new features in VS2017]]></category>
		<category><![CDATA[VS2017]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=12166</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/what-is-there-for-a-javascript-developer-in-vs2017/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Working With Azure Media Service Account</title>
		<link>https://mail.sibeeshpassion.com/working-with-azure-media-service-account/</link>
					<comments>https://mail.sibeeshpassion.com/working-with-azure-media-service-account/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 25 May 2016 00:00:36 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Create an Asset dynamically via console application]]></category>
		<category><![CDATA[Media Service]]></category>
		<category><![CDATA[Media service account]]></category>
		<category><![CDATA[Retrieving the items from the Asset]]></category>
		<category><![CDATA[Uploading image to the assets]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11635</guid>

					<description><![CDATA[[toc] Introduction In this article we are going to work with Media Service Account in Azure. Once we create a media service account, we will create a console application in which we will add the operations like creating the media assets dynamically. You can also upload some files to the assets created. We will discuss here that too. I hope you will like this. Download the source code You can always download the source code here: Azure Media Service Background Few days back I have got a requirement of storing some files in the cloud. As you all know, Azure [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>In this article we are going to work with Media Service Account in <a href="http://sibeeshpassion.com/category/Azure/" target="_blank" rel="noopener">Azure</a>. Once we create a media service account, we will create a console application in which we will add the operations like creating the media assets dynamically. You can also upload some files to the assets created. We will discuss here that too. I hope you will like this.</p>
<h3>Download the source code</h3>
<p>You can always download the source code here: <a href="https://code.msdn.microsoft.com/Working-With-Azure-Media-ad283589" target="_blank" rel="noopener">Azure Media Service</a></p>
<h3>Background</h3>
<p>Few days back I have got a requirement of storing some files in the cloud. As you all know, <a href="http://sibeeshpassion.com/category/Azure/" target="_blank" rel="noopener">Azure </a>will be the right choice if you talk about the cloud services. And I had account with Azure already, so the things were pretty much easy for me. Thus I decided to create a media service account for this requirement. Here we are going to see how we can create an Azure media service account and how to use the same. Following are the prerequisites.</p>
<h3>What is media service account?</h3>
<li>A media service account is a Azure based account which gives you access to cloud based media services in Azure.</li>
<li>Stores metadata of the media files you create, instead saving the actual media content.</li>
<li>To work with media service account, you must have an associated storage account.</li>
<li>While creating a media service account, you can either select the storage account you already have or you can create a new one.</li>
<li>Since the media service account and storage account is treated separately, the content will be available in your storage account even if you delete your media service account</li>
<blockquote><p>
Please be noted that your storage account region must be same as your media service account region.
</p></blockquote>
<h3>Prerequisites</h3>
<li>Visual Studio</li>
<li>Azure account with active subscription</li>
<p>If you are a start up company or you are in thinking to start a one, you can always go for BizSpark(Software and services made for the start ups), to join please check here: <a href="http://sibeeshpassion.com/how-to-join-bizspark/" target="_blank" rel="noopener">How to join bizspark</a>. Or you can always create a free account <a href="https://azure.microsoft.com/en-in/pricing/free-trial/" target="_blank" rel="noopener">here</a>.</p>
<h3>Things we are going to do</h3>
<p>The following are the tasks we are going to do.</p>
<li>Creating an Azure media service account.</li>
<p>If you don&#8217;t have an Azure account with active subscription, you must creates it first before going to do this task.</p>
<li>Creating a Console application to use Media service account</li>
<li>Create an Asset dynamically via console application</li>
<li>Uploading image to the assets</li>
<li>Retrieving the items from the Asset</li>
<p>Now we will go and create our media service account.</p>
<h3>Steps to create an Azure media service account</h3>
<p>To create an azure media service account, please follows the preceding steps. </p>
<p>Step 1: Login to your Azure Portal (<a href="https://portal.azure.com" target="_blank" rel="noopener">https://portal.azure.com</a>)</p>
<div id="attachment_11636" style="width: 467px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Azure-Home.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-11636" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Azure-Home.png" alt="Azure Home" width="457" height="587" class="size-full wp-image-11636" srcset="/wp-content/uploads/2016/05/Azure-Home.png 457w, /wp-content/uploads/2016/05/Azure-Home-234x300.png 234w, /wp-content/uploads/2016/05/Azure-Home-400x514.png 400w" sizes="(max-width: 457px) 100vw, 457px" /></a><p id="caption-attachment-11636" class="wp-caption-text">Azure Home</p></div>
<p>Step 2: Click New and select Media + CDN</p>
<div id="attachment_11637" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-And-CDN-e1464160195844.png"><img decoding="async" aria-describedby="caption-attachment-11637" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-And-CDN-e1464160195844.png" alt="Media And CDN" width="650" height="463" class="size-full wp-image-11637" srcset="/wp-content/uploads/2016/05/Media-And-CDN-e1464160195844.png 501w, /wp-content/uploads/2016/05/Media-And-CDN-e1464160195844-300x214.png 300w, /wp-content/uploads/2016/05/Media-And-CDN-e1464160195844-400x285.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11637" class="wp-caption-text">Media And CDN</p></div>
<p>Step 3: Click on the media service</p>
<p>This will redirect you to <a href="https://manage.windowsazure.com" target="_blank" rel="noopener">old azure portal</a>, If you are not redirected, no worries. It is fine. </p>
<div id="attachment_11638" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-e1464160366877.png"><img decoding="async" aria-describedby="caption-attachment-11638" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-e1464160366877.png" alt="Media Service" width="650" height="355" class="size-full wp-image-11638" srcset="/wp-content/uploads/2016/05/Media-Service-e1464160366877.png 650w, /wp-content/uploads/2016/05/Media-Service-e1464160366877-300x164.png 300w, /wp-content/uploads/2016/05/Media-Service-e1464160366877-400x218.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11638" class="wp-caption-text">Media Service</p></div>
<p>Step 4: Give the details.</p>
<div id="attachment_11639" style="width: 381px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/New-Storage-Account.png"><img decoding="async" aria-describedby="caption-attachment-11639" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/New-Storage-Account.png" alt="New Storage Account" width="371" height="477" class="size-full wp-image-11639" srcset="/wp-content/uploads/2016/05/New-Storage-Account.png 371w, /wp-content/uploads/2016/05/New-Storage-Account-233x300.png 233w" sizes="(max-width: 371px) 100vw, 371px" /></a><p id="caption-attachment-11639" class="wp-caption-text">New Storage Account</p></div>
<p>Here you can select if you have a storage account or a new one will be created for you automatically. </p>
<p>Step 5: Finish </p>
<p>Once you give the needed details, you can click on the tick symbol. </p>
<div id="attachment_11640" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-Created-e1464160595700.png"><img decoding="async" aria-describedby="caption-attachment-11640" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-Created-e1464160595700.png" alt="Media Service Created" width="650" height="160" class="size-full wp-image-11640" srcset="/wp-content/uploads/2016/05/Media-Service-Created-e1464160595700.png 650w, /wp-content/uploads/2016/05/Media-Service-Created-e1464160595700-300x74.png 300w, /wp-content/uploads/2016/05/Media-Service-Created-e1464160595700-400x98.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11640" class="wp-caption-text">Media Service Created</p></div>
<p>Now we have our storage account and media service account with us. You can always download the sample applications given there. What you need to do all is just select the language you wish and click on the download link. We will create a console application to use this media service account. Sounds cool?</p>
<h3>Creating a Console application to use Media service account</h3>
<p>To create a console application in <a href="http://sibeeshpassion.com/category/visual-studio/" target="_blank" rel="noopener">Visual Studio</a> click File->New project-> Select language->Select Console Application.</p>
<p>Now go back to your Azure portal and click on Manage Keys at the bottom, copy the MEDIA SERVICE ACCOUNT NAME and  MEDIA SERVICE ACCESS KEY (Either primary or secondary). Then you need to add the settings as appSettings in your App.config file as follows. </p>
<p>[xml]<br />
&lt;appSettings&gt;<br />
    &lt;add key=&quot;MediaServicesAccountName&quot; value=&quot;****&quot; /&gt;<br />
    &lt;add key=&quot;MediaServicesAccountKey&quot; value=&quot;***************************&quot; /&gt;<br />
  &lt;/appSettings&gt;<br />
[/xml]</p>
<p>The next thing you need to do is installing <em>windowsazure.mediaservices </em>from package manager console. For that please go to your package manger console from NuGet Package Manager. And run the below query.</p>
<p>[csharp]<br />
 install-package windowsazure.mediaservices<br />
[/csharp]</p>
<p>Now you need to include the preceding namespace to get started with.</p>
<p>[csharp]<br />
using Microsoft.WindowsAzure.MediaServices.Client;<br />
[/csharp]</p>
<p>Now change your Program.cs codes as follows</p>
<p>[csharp]<br />
using Microsoft.WindowsAzure.MediaServices.Client;<br />
using System;<br />
using System.Configuration;</p>
<p>namespace AzureMediaServiceApp<br />
{<br />
    class Program<br />
    {<br />
        #region Constants<br />
        private static string mediaServicesAccountName = ConfigurationManager.AppSettings[&quot;MediaServicesAccountName&quot;];<br />
        private static string mediaServicesAccountKey = ConfigurationManager.AppSettings[&quot;MediaServicesAccountKey&quot;];<br />
        #endregion<br />
        static void Main(string[] args)<br />
        {<br />
            string input = string.Empty;<br />
            Console.WriteLine(&quot;Enter the asset name to be created&#8230;&quot;);<br />
            input = Console.ReadLine();<br />
            CreateBLOBContainer(input);<br />
        }<br />
        public static string CreateBLOBContainer(string containerName)<br />
        {<br />
            try<br />
            {<br />
                string result = string.Empty;<br />
                CloudMediaContext mediaContext;<br />
                mediaContext = new CloudMediaContext(mediaServicesAccountName, mediaServicesAccountKey);<br />
                IAsset asset = mediaContext.Assets.Create(containerName, AssetCreationOptions.None);<br />
                return asset.Uri.ToString();<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                return ex.Message;<br />
            }<br />
        }<br />
    }<br />
}<br />
[/csharp]</p>
<p>What we are doing in the above code is, we are fetching the account details from the App.config and calling a function <em>CreateBLOBContainer</em> with the name of the asset as a parameter. We will ask for this name in the console window. Sounds good?</p>
<div id="attachment_11642" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-Created-Output-e1464167236811.png"><img decoding="async" aria-describedby="caption-attachment-11642" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-Created-Output-e1464167236811.png" alt="Media Service Created Output" width="650" height="327" class="size-full wp-image-11642" srcset="/wp-content/uploads/2016/05/Media-Service-Created-Output-e1464167236811.png 650w, /wp-content/uploads/2016/05/Media-Service-Created-Output-e1464167236811-300x151.png 300w, /wp-content/uploads/2016/05/Media-Service-Created-Output-e1464167236811-400x201.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11642" class="wp-caption-text">Media Service Created Output</p></div>
<p>Now go back to your azure portal and click on content tab, you can see the asset you are just created. </p>
<div id="attachment_11643" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-Created-Azure-Portal-Output-e1464167401891.png"><img decoding="async" aria-describedby="caption-attachment-11643" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Media-Service-Created-Azure-Portal-Output-e1464167401891.png" alt="Media Service Created Azure Portal Output" width="650" height="136" class="size-full wp-image-11643" srcset="/wp-content/uploads/2016/05/Media-Service-Created-Azure-Portal-Output-e1464167401891.png 650w, /wp-content/uploads/2016/05/Media-Service-Created-Azure-Portal-Output-e1464167401891-300x63.png 300w, /wp-content/uploads/2016/05/Media-Service-Created-Azure-Portal-Output-e1464167401891-400x84.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11643" class="wp-caption-text">Media Service Created Azure Portal Output</p></div>
<p>Now we will create a function which will upload some files to asset. So that we will change our Program.cs file as follows.</p>
<p>[csharp]<br />
using Microsoft.WindowsAzure.MediaServices.Client;<br />
using System;<br />
using System.Configuration;<br />
using System.IO;</p>
<p>namespace AzureMediaServiceApp<br />
{<br />
    class Program<br />
    {<br />
        #region Constants<br />
        private static readonly string mediaServicesAccountName = ConfigurationManager.AppSettings[&quot;MediaServicesAccountName&quot;];<br />
        private static readonly string mediaServicesAccountKey = ConfigurationManager.AppSettings[&quot;MediaServicesAccountKey&quot;];<br />
        private static readonly string myAzureCon = ConfigurationManager.ConnectionStrings[&quot;myAzureStorageCon&quot;].ConnectionString;<br />
        private static MediaServicesCredentials _mediaServiceCredentials = null;<br />
        #endregion<br />
        static void Main(string[] args)<br />
        {<br />
            string input = string.Empty;<br />
            Console.WriteLine(&quot;Enter the asset name to be created&#8230;&quot;);<br />
            input = Console.ReadLine();<br />
            _mediaServiceCredentials = new MediaServicesCredentials(mediaServicesAccountName, mediaServicesAccountKey);<br />
            IAsset asset = CreateBLOBContainer(input, _mediaServiceCredentials);<br />
            UploadImages(asset, _mediaServiceCredentials);<br />
        }<br />
        public static IAsset CreateBLOBContainer(string containerName, MediaServicesCredentials _medServCredentials)<br />
        {<br />
            try<br />
            {<br />
                string result = string.Empty;<br />
                CloudMediaContext mediaContext;<br />
                mediaContext = new CloudMediaContext(_medServCredentials);<br />
                IAsset asset = mediaContext.Assets.Create(containerName, AssetCreationOptions.None);<br />
                return asset;</p>
<p>            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
        }<br />
        public static string UploadImages(IAsset asset, MediaServicesCredentials _medServCredentials)<br />
        {<br />
            try<br />
            {<br />
                string _singleInputFilePath = Path.GetFullPath(@&quot;E:\X7Md4VB.JPG&quot;);<br />
                CloudMediaContext mediaContext;<br />
                mediaContext = new CloudMediaContext(_medServCredentials);<br />
                var fileName = Path.GetFileName(_singleInputFilePath);<br />
                var assetFile = asset.AssetFiles.Create(fileName);<br />
                var policy = mediaContext.AccessPolicies.Create(&quot;policy for upload&quot;, TimeSpan.FromMinutes(30), AccessPermissions.Read | AccessPermissions.Write | AccessPermissions.List);<br />
                var locator = mediaContext.Locators.CreateSasLocator(asset, policy, DateTime.UtcNow.AddDays(1));<br />
                assetFile.Upload(_singleInputFilePath);<br />
                return &quot;Success!&quot;;<br />
            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
        }<br />
    }<br />
}<br />
[/csharp]</p>
<p>Here we calls a function <em>UploadImages</em> which accepts IAsset and MediaServicesCredentials as a parameter to upload the images to the asset we created. Once you run this, you can see that image has been uploaded in your asset. To check that, please go to your Azure portal and see your asset size in content tab. I am sure that the size must be changed. </p>
<div id="attachment_11644" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Image-uploaded-to-Media-Service-e1464177194192.png"><img decoding="async" aria-describedby="caption-attachment-11644" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Image-uploaded-to-Media-Service-e1464177194192.png" alt="Image uploaded to Media Service" width="650" height="105" class="size-full wp-image-11644" srcset="/wp-content/uploads/2016/05/Image-uploaded-to-Media-Service-e1464177194192.png 650w, /wp-content/uploads/2016/05/Image-uploaded-to-Media-Service-e1464177194192-300x48.png 300w, /wp-content/uploads/2016/05/Image-uploaded-to-Media-Service-e1464177194192-400x65.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11644" class="wp-caption-text">Image uploaded to Media Service</p></div>
<p>Now we will list down all the items we saved to the asset. Shall we?</p>
<p><strong>Retrieving the items from the Asset</strong></p>
<p>To retrieve the items we will add an another function as follows. </p>
<p>[csharp]<br />
 private static void GetAllTheAssetsAndFiles(MediaServicesCredentials _medServCredentials)<br />
        {<br />
            try<br />
            {<br />
                string result = string.Empty;<br />
                CloudMediaContext mediaContext;<br />
                mediaContext = new CloudMediaContext(_medServCredentials);<br />
                StringBuilder myBuilder = new StringBuilder();<br />
                foreach (var item in mediaContext.Assets)<br />
                {<br />
                    myBuilder.AppendLine(Environment.NewLine);<br />
                    myBuilder.AppendLine(&quot;&#8211;My Assets&#8211;&quot;);<br />
                    myBuilder.AppendLine(&quot;Name: &quot; + item.Name);<br />
                    myBuilder.AppendLine(&quot;++++++++++++++++++++&quot;);</p>
<p>                    foreach (var subItem in item.AssetFiles)<br />
                    {<br />
                        myBuilder.AppendLine(&quot;File Name: &quot;+subItem.Name);<br />
                        myBuilder.AppendLine(&quot;Size: &quot; + subItem.ContentFileSize);<br />
                        myBuilder.AppendLine(&quot;++++++++++++++++++++++&quot;);<br />
                    }<br />
                }<br />
                Console.WriteLine(myBuilder);<br />
            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>And it will give you an output as follows. </p>
<div id="attachment_11645" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/My-Assets-and-contents.png"><img decoding="async" aria-describedby="caption-attachment-11645" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/My-Assets-and-contents-e1464178390636.png" alt="My Assets and contents" width="650" height="327" class="size-full wp-image-11645" srcset="/wp-content/uploads/2016/05/My-Assets-and-contents-e1464178390636.png 650w, /wp-content/uploads/2016/05/My-Assets-and-contents-e1464178390636-300x151.png 300w, /wp-content/uploads/2016/05/My-Assets-and-contents-e1464178390636-400x201.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11645" class="wp-caption-text">My Assets and contents</p></div>
<h3>Conclusion</h3>
<p>Did I miss anything that you may think which is needed? Have you ever tried Azure media service account? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h3>Your turn. What do you think?</h3>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/working-with-azure-media-service-account/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Working with API help page controller action description in Web API</title>
		<link>https://mail.sibeeshpassion.com/working-with-api-help-page-controller-action-description-in-web-api/</link>
					<comments>https://mail.sibeeshpassion.com/working-with-api-help-page-controller-action-description-in-web-api/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 12 May 2016 00:00:24 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[API Help Page Description]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Enable Region Summary Of Actions]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11555</guid>

					<description><![CDATA[In this article we are going to see how we can enable the API descriptions for the better understanding of how our API controller works and what exactly it is supposed to do. It is recommended that to give the summary and parameter lists and a bit introduction to the service whenever you write any API services. Here I am going to use create a Web API in Visual Studio 2015. I hope you will like this. Download the source code You can always download the source code here: API Help Page Documentation Background Few months back I have hosted [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we are going to see how we can enable the API descriptions for the better understanding of how our API controller works and what exactly it is supposed to do. It is recommended that to give the summary and parameter lists and a bit introduction to the service whenever you write any API services. Here I am going to use create a <a href="http://sibeeshpassion.com/category/web-api" target="_blank" rel="noopener">Web API</a> in <a href="http://sibeeshpassion.com/category/tools/visual-studio/" target="_blank" rel="noopener">Visual Studio</a> 2015. I hope you will like this.</p>
<p><strong>Download the source code</strong></p>
<p>You can always download the source code here: <a href="https://code.msdn.microsoft.com/Working-with-API-help-page-23eddf9e" target="_blank" rel="noopener">API Help Page Documentation</a></p>
<p><strong>Background</strong></p>
<p>Few months back I have hosted one of my API application to <a href="http://sibeeshpassion.com/category/azure" target="_blank" rel="noopener">Azure</a>. I thought of implementing the document summary for the services(controllers actions) now. And I did, now any one can understand what exactly my service will do by going to the help page of the API application. I will show you a demo of the same. Here we will create a Web API with entity framework. Lets us start then.</p>
<p><strong>Setting up database</strong></p>
<p>Here I am going to create a database which I created for my demo purposes, you can always create this database by running the queries mentioned here.</p>
<p><strong>Create database</strong></p>
<p>[sql]<br />
USE [master]<br />
GO</p>
<p>/****** Object:  Database [TrialsDB]    Script Date: 5/12/2016 10:56:41 AM ******/<br />
CREATE DATABASE [TrialsDB]<br />
 CONTAINMENT = NONE<br />
 ON  PRIMARY<br />
( NAME = N&#8217;TrialsDB&#8217;, FILENAME = N&#8217;C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TrialsDB.mdf&#8217; , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )<br />
 LOG ON<br />
( NAME = N&#8217;TrialsDB_log&#8217;, FILENAME = N&#8217;C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TrialsDB_log.ldf&#8217; , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET COMPATIBILITY_LEVEL = 110<br />
GO</p>
<p>IF (1 = FULLTEXTSERVICEPROPERTY(&#8216;IsFullTextInstalled&#8217;))<br />
begin<br />
EXEC [TrialsDB].[dbo].[sp_fulltext_database] @action = &#8216;enable&#8217;<br />
end<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_NULL_DEFAULT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_NULLS OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_PADDING OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_WARNINGS OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ARITHABORT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_CLOSE OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_CREATE_STATISTICS ON<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_SHRINK OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_UPDATE_STATISTICS ON<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET CURSOR_CLOSE_ON_COMMIT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET CURSOR_DEFAULT  GLOBAL<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET CONCAT_NULL_YIELDS_NULL OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET NUMERIC_ROUNDABORT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET QUOTED_IDENTIFIER OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET RECURSIVE_TRIGGERS OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET  DISABLE_BROKER<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET DATE_CORRELATION_OPTIMIZATION OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET TRUSTWORTHY OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ALLOW_SNAPSHOT_ISOLATION OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET PARAMETERIZATION SIMPLE<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET READ_COMMITTED_SNAPSHOT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET HONOR_BROKER_PRIORITY OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET RECOVERY FULL<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET  MULTI_USER<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET PAGE_VERIFY CHECKSUM<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET DB_CHAINING OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET TARGET_RECOVERY_TIME = 0 SECONDS<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET  READ_WRITE<br />
GO<br />
[/sql]</p>
<p><strong>Create table with data</strong></p>
<p>[sql]<br />
USE [TrialsDB]<br />
GO<br />
/****** Object:  Table [dbo].[Product]    Script Date: 5/12/2016 10:54:48 AM ******/<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
CREATE TABLE [dbo].[Product](<br />
	[ProductID] [int] NOT NULL,<br />
	[Name] [nvarchar](max) NOT NULL,<br />
	[ProductNumber] [nvarchar](25) NOT NULL,<br />
	[MakeFlag] [bit] NOT NULL,<br />
	[FinishedGoodsFlag] [bit] NOT NULL,<br />
	[Color] [nvarchar](15) NULL,<br />
	[SafetyStockLevel] [smallint] NOT NULL,<br />
	[ReorderPoint] [smallint] NOT NULL,<br />
	[StandardCost] [money] NOT NULL,<br />
	[ListPrice] [money] NOT NULL,<br />
	[Size] [nvarchar](5) NULL,<br />
	[SizeUnitMeasureCode] [nchar](3) NULL,<br />
	[WeightUnitMeasureCode] [nchar](3) NULL,<br />
	[Weight] [decimal](8, 2) NULL,<br />
	[DaysToManufacture] [int] NOT NULL,<br />
	[ProductLine] [nchar](2) NULL,<br />
	[Class] [nchar](2) NULL,<br />
	[Style] [nchar](2) NULL,<br />
	[ProductSubcategoryID] [int] NULL,<br />
	[ProductModelID] [int] NULL,<br />
	[SellStartDate] [datetime] NOT NULL,<br />
	[SellEndDate] [datetime] NULL,<br />
	[DiscontinuedDate] [datetime] NULL,<br />
	[rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,<br />
	[ModifiedDate] [datetime] NOT NULL<br />
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]<br />
GO<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (1, N&#8217;Adjustable Race&#8217;, N&#8217;AR-5381&#8242;, 0, 0, NULL, 1000, 750, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;694215b7-08f7-4c0d-acb1-d734ba44c0c8&#8242;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (2, N&#8217;Bearing Ball&#8217;, N&#8217;BA-8327&#8242;, 0, 0, NULL, 1000, 750, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;58ae3c20-4f3a-4749-a7d4-d568806cc537&#8242;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (3, N&#8217;BB Ball Bearing&#8217;, N&#8217;BE-2349&#8242;, 1, 0, NULL, 800, 600, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;9c21aed2-5bfa-4f18-bcb8-f11638dc2e4e&#8217;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (4, N&#8217;Headset Ball Bearings&#8217;, N&#8217;BE-2908&#8242;, 0, 0, NULL, 800, 600, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;ecfed6cb-51ff-49b5-b06c-7d8ac834db8b&#8217;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (316, N&#8217;Blade&#8217;, N&#8217;BL-2036&#8242;, 1, 0, NULL, 800, 600, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;e73e9750-603b-4131-89f5-3dd15ed5ff80&#8242;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (317, N&#8217;LL Crankarm&#8217;, N&#8217;CA-5965&#8242;, 0, 0, N&#8217;Black&#8217;, 500, 375, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, NULL, N&#8217;L &#8216;, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;3c9d10b7-a6b2-4774-9963-c19dcee72fea&#8217;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
INSERT [dbo].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodsFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (318, N&#8217;ML Crankarm&#8217;, N&#8217;CA-6738&#8242;, 0, 0, N&#8217;Black&#8217;, 500, 375, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, NULL, N&#8217;M &#8216;, NULL, NULL, NULL, CAST(0x0000921E00000000 AS DateTime), NULL, NULL, N&#8217;eabb9a92-fa07-4eab-8955-f0517b4a4ca7&#8217;, CAST(0x00009A5C00A53CF8 AS DateTime))<br />
[/sql]</p>
<p>Our database is ready, now create a Web API application in visual studio and then entity with the above mentioned database. </p>
<div id="attachment_11556" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Creating-Entity-e1463031313825.png"><img decoding="async" aria-describedby="caption-attachment-11556" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Creating-Entity-1024x542.png" alt="Creating Entity" width="634" height="336" class="size-large wp-image-11556" /></a><p id="caption-attachment-11556" class="wp-caption-text">Creating Entity</p></div>
<p>If you don&#8217;t know how to create an entity in your solution, please read that <a href="http://sibeeshpassion.com/web-api-with-angular-js/" target="_blank" rel="noopener">here</a>. I have mentioned the steps to be followed in that article. Once you have created the entity, you are good to go and create a API controller with the entity created. If you do so, The CRUD actions will be created automatically for you. You may need to edit those actions according to your needs. </p>
<div id="attachment_11557" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/Web-API-2-Controller-with-actions-using-Entity-Framework-e1463031653319.png"><img decoding="async" aria-describedby="caption-attachment-11557" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/Web-API-2-Controller-with-actions-using-Entity-Framework-e1463031653319.png" alt="Web API 2 Controller with actions, using Entity Framework" width="650" height="457" class="size-full wp-image-11557" srcset="/wp-content/uploads/2016/05/Web-API-2-Controller-with-actions-using-Entity-Framework-e1463031653319.png 650w, /wp-content/uploads/2016/05/Web-API-2-Controller-with-actions-using-Entity-Framework-e1463031653319-300x211.png 300w, /wp-content/uploads/2016/05/Web-API-2-Controller-with-actions-using-Entity-Framework-e1463031653319-400x281.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11557" class="wp-caption-text">Web API 2 Controller with actions, using Entity Framework</p></div>
<p>Select the Model Class, DBContext then name your controller and click OK. I hope a controller with the CRUD actions like preceding has been generated for you.</p>
<p>[csharp]<br />
 public class ProductsController : ApiController<br />
    {<br />
        private TrialsDBEntities db = new TrialsDBEntities();</p>
<p>        // GET: api/Products<br />
        public IQueryable&lt;Product&gt; GetProducts()<br />
        {<br />
            return db.Products;<br />
        }</p>
<p>        // GET: api/Products/5<br />
        [ResponseType(typeof(Product))]<br />
        public IHttpActionResult GetProduct(int id)<br />
        {<br />
            Product product = db.Products.Find(id);<br />
            if (product == null)<br />
            {<br />
                return NotFound();<br />
            }</p>
<p>            return Ok(product);<br />
        }</p>
<p>        // PUT: api/Products/5<br />
        [ResponseType(typeof(void))]<br />
        public IHttpActionResult PutProduct(int id, Product product)<br />
        {<br />
            if (!ModelState.IsValid)<br />
            {<br />
                return BadRequest(ModelState);<br />
            }</p>
<p>            if (id != product.ProductID)<br />
            {<br />
                return BadRequest();<br />
            }</p>
<p>            db.Entry(product).State = EntityState.Modified;</p>
<p>            try<br />
            {<br />
                db.SaveChanges();<br />
            }<br />
            catch (DbUpdateConcurrencyException)<br />
            {<br />
                if (!ProductExists(id))<br />
                {<br />
                    return NotFound();<br />
                }<br />
                else<br />
                {<br />
                    throw;<br />
                }<br />
            }</p>
<p>            return StatusCode(HttpStatusCode.NoContent);<br />
        }</p>
<p>        // POST: api/Products<br />
        [ResponseType(typeof(Product))]<br />
        public IHttpActionResult PostProduct(Product product)<br />
        {<br />
            if (!ModelState.IsValid)<br />
            {<br />
                return BadRequest(ModelState);<br />
            }</p>
<p>            db.Products.Add(product);</p>
<p>            try<br />
            {<br />
                db.SaveChanges();<br />
            }<br />
            catch (DbUpdateException)<br />
            {<br />
                if (ProductExists(product.ProductID))<br />
                {<br />
                    return Conflict();<br />
                }<br />
                else<br />
                {<br />
                    throw;<br />
                }<br />
            }</p>
<p>            return CreatedAtRoute(&quot;DefaultApi&quot;, new { id = product.ProductID }, product);<br />
        }</p>
<p>        // DELETE: api/Products/5<br />
        [ResponseType(typeof(Product))]<br />
        public IHttpActionResult DeleteProduct(int id)<br />
        {<br />
            Product product = db.Products.Find(id);<br />
            if (product == null)<br />
            {<br />
                return NotFound();<br />
            }</p>
<p>            db.Products.Remove(product);<br />
            db.SaveChanges();</p>
<p>            return Ok(product);<br />
        }</p>
<p>        protected override void Dispose(bool disposing)<br />
        {<br />
            if (disposing)<br />
            {<br />
                db.Dispose();<br />
            }<br />
            base.Dispose(disposing);<br />
        }</p>
<p>        private bool ProductExists(int id)<br />
        {<br />
            return db.Products.Count(e =&gt; e.ProductID == id) &gt; 0;<br />
        }<br />
    }<br />
[/csharp]</p>
<p>Now please run your application and go to the help page. You can see the API help page as follows. </p>
<div id="attachment_11558" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/API-Help-Page-e1463032044742.png"><img decoding="async" aria-describedby="caption-attachment-11558" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/API-Help-Page-e1463032044742.png" alt="API Help Page" width="650" height="524" class="size-full wp-image-11558" srcset="/wp-content/uploads/2016/05/API-Help-Page-e1463032044742.png 650w, /wp-content/uploads/2016/05/API-Help-Page-e1463032044742-300x242.png 300w, /wp-content/uploads/2016/05/API-Help-Page-e1463032044742-400x322.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11558" class="wp-caption-text">API Help Page</p></div>
<p>As you can see &#8216;No documentation available.&#8217; under description of all the service actions. No worries we will try to add some summary to the actions now. So we will change the code as follows.</p>
<p>[csharp]<br />
 #region GetProducts<br />
        /// &lt;summary&gt;<br />
        /// Get all the products available<br />
        /// GET: api/Products<br />
        /// &lt;/summary&gt;<br />
        public IQueryable&lt;Product&gt; GetProducts()<br />
        {<br />
            return db.Products;<br />
        }<br />
        #endregion</p>
<p>        #region GetProductWithParameter<br />
        /// &lt;summary&gt;<br />
        /// Get a single product<br />
        /// GET: api/Products/5<br />
        /// &lt;param name=&quot;id&quot;&gt;&lt;/param&gt;<br />
        /// &lt;/summary&gt;<br />
        [ResponseType(typeof(Product))]<br />
        public IHttpActionResult GetProduct(int id)<br />
        {<br />
            Product product = db.Products.Find(id);<br />
            if (product == null)<br />
            {<br />
                return NotFound();<br />
            }</p>
<p>            return Ok(product);<br />
        }<br />
        #endregion<br />
[/csharp]</p>
<p>Now run your application and see the help page. Still the same result? Hmm, here comes the things we need to do. I will explain that. </p>
<li>Go to Areas\HelpPage\App_Start and click on the file <em>HelpPageConfig.cs</em>.</li>
<li>Uncomment the following line from the static function Register. </li>
<p>[csharp]<br />
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath(&quot;App_Data/XmlDocument.xml&quot;)));<br />
[/csharp]</p>
<li>Right click on your project and go to properties, then click on Build</li>
<li>Go to Output section and click on XML documentation file and then type <em>~/App_Data/XmlDocument.xml</em> in the given text box. </li>
<li>Save and build your project.</li>
<p>This will create a XML document with the name <em>XmlDocument.xml</em> in App_Data folder. Once it is generated, the summary you have described in your API controller will be listed there. Initially the file will be in excluded state, you may need to include the same to your project when you deploy your API application. For that please follows the below steps. </p>
<li>Click on show all files.</li>
<li>Click on Refresh.</li>
<li>Go to App_Data folder and find XmlDocument.xml.</li>
<li>Right click the file and click Include In Project.</li>
<p>That&#8217;s all. Run your application and see the Help page again. Hope you get the page as follows. </p>
<div id="attachment_11559" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/05/API-Help-Page-With-Descriptions-e1463033550891.png"><img decoding="async" aria-describedby="caption-attachment-11559" src="http://sibeeshpassion.com/wp-content/uploads/2016/05/API-Help-Page-With-Descriptions-e1463033550891.png" alt="API Help Page With Descriptions" width="650" height="361" class="size-full wp-image-11559" srcset="/wp-content/uploads/2016/05/API-Help-Page-With-Descriptions-e1463033550891.png 650w, /wp-content/uploads/2016/05/API-Help-Page-With-Descriptions-e1463033550891-300x167.png 300w, /wp-content/uploads/2016/05/API-Help-Page-With-Descriptions-e1463033550891-400x222.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11559" class="wp-caption-text">API Help Page With Descriptions</p></div>
<p>Have a happy coding!.</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/working-with-api-help-page-controller-action-description-in-web-api/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Creating Azure Mobile App With Visual Studio</title>
		<link>https://mail.sibeeshpassion.com/creating-azure-mobile-app-with-visual-studio/</link>
					<comments>https://mail.sibeeshpassion.com/creating-azure-mobile-app-with-visual-studio/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 24 Apr 2016 00:00:46 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Azure Mobile App]]></category>
		<category><![CDATA[Mobile App With Azure And Visual Studio]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 10]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11507</guid>

					<description><![CDATA[[toc] Introduction In this article we are going to create a mobile application with Azure using Visual Studio. Before you start with make sure that you have some azure credits with you. You can always create new azure free account where you can claim for some free credits Azure free trial . Please be noted that you can get only limited azure credits with the free account. But to get started, that is more than enough. Now we will go and create our application. I hope you will like this. Download the source code You can always download the source [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>In this article we are going to create a mobile application with <a href="http://sibeeshpassion.com/category/azure" target="_blank">Azure</a> using <a href="http://sibeeshpassion.com/category/visual-studio" target="_blank">Visual Studio</a>. Before you start with make sure that you have some azure credits with you. You can always create new azure free account where you can claim for some free credits <a href="https://azure.microsoft.com/en-in/pricing/free-trial/" target="_blank">Azure free trial </a>. Please be noted that you can get only limited azure credits with the free account. But to get started, that is more than enough. Now we will go and create our application. I hope you will like this. </p>
<h3>Download the source code</h3>
<p>You can always download the source code here</p>
<li><a href="https://gallery.technet.microsoft.com/Creating-Azure-Mobile-App-89d3df9f" target="_blank">Azure Mobile App With Visual Studio</a></li>
<h3>Background</h3>
<p>We all know what Azure is. If you are really new to Azure, I strongly recommend you to have a look at <a href="http://sibeeshpassion.com/category/azure" target="_blank">here</a> .To get started, please make sure that you have installed Visual Studio in your machine. You can always download visual studio from <a href="https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx" target="_blank">here</a>. </p>
<h3>Setting Azure Portal </h3>
<p>Login to your Azure portal from <a href="https://portal.azure.com/" target="_blank">Azure Portal</a>. Once you logged in, you can see a dashboard and a menu as follows.</p>
<div id="attachment_11508" style="width: 295px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Microsoft-Azure-Portal-Menu.png"><img decoding="async" aria-describedby="caption-attachment-11508" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Microsoft-Azure-Portal-Menu.png" alt="Microsoft Azure Portal Menu" width="285" height="747" class="size-full wp-image-11508" srcset="/wp-content/uploads/2016/04/Microsoft-Azure-Portal-Menu.png 285w, /wp-content/uploads/2016/04/Microsoft-Azure-Portal-Menu-114x300.png 114w, /wp-content/uploads/2016/04/Microsoft-Azure-Portal-Menu-229x600.png 229w" sizes="(max-width: 285px) 100vw, 285px" /></a><p id="caption-attachment-11508" class="wp-caption-text">Microsoft Azure Portal Menu</p></div>
<p>Now click on New -> Web+Mobile -> Mobile App.</p>
<div id="attachment_11509" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Web-Mobile-Category-In-Azure-Portal-e1460901278999.png"><img decoding="async" aria-describedby="caption-attachment-11509" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Web-Mobile-Category-In-Azure-Portal-1024x886.png" alt="Web Mobile Category In Azure Portal" width="634" height="549" class="size-large wp-image-11509" /></a><p id="caption-attachment-11509" class="wp-caption-text">Web Mobile Category In Azure Portal</p></div>
<p>Now name your mobile application. Select your subscription, it will be automatically selected if you have only one subscription. Please select the subscription accordingly if you have multiple subscriptions. Select or create new resource group. You may be thinking what is this resource group, and what are all the benefits for using it. According to Microsoft, a resource group is a collection of resources so that you can use those accordingly. A resource can be included only in one resource group and it is possible to link the resources in other resource group. Please be noted that you can&#8217;t edit and rename your resource group name. Only option you are allowed is to move your resources to your new resource group. Please see <a href="https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/" target="_blank">Move resources to a new resource group in azure</a> if you need to move your resources. </p>
<p>Now select your service plan or location as per your need. Now click on that link. You can see all the service plans you have used so far, you can select those if you want or you can create a new one. </p>
<div id="attachment_11511" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Available-App-Service-Plan-In-Azure-e1460903507474.png"><img decoding="async" aria-describedby="caption-attachment-11511" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Available-App-Service-Plan-In-Azure-e1460903507474.png" alt="Available App Service Plan In Azure" width="650" height="526" class="size-full wp-image-11511" srcset="/wp-content/uploads/2016/04/Available-App-Service-Plan-In-Azure-e1460903507474.png 650w, /wp-content/uploads/2016/04/Available-App-Service-Plan-In-Azure-e1460903507474-300x243.png 300w, /wp-content/uploads/2016/04/Available-App-Service-Plan-In-Azure-e1460903507474-400x324.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11511" class="wp-caption-text">Available App Service Plan In Azure</p></div>
<p>To create a new one, please click the &#8216;Create new&#8217; option. </p>
<div id="attachment_11512" style="width: 393px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/New-App-Service-Plan-In-Azure.png"><img decoding="async" aria-describedby="caption-attachment-11512" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/New-App-Service-Plan-In-Azure.png" alt="New App Service Plan In Azure" width="383" height="867" class="size-full wp-image-11512" srcset="/wp-content/uploads/2016/04/New-App-Service-Plan-In-Azure.png 383w, /wp-content/uploads/2016/04/New-App-Service-Plan-In-Azure-133x300.png 133w, /wp-content/uploads/2016/04/New-App-Service-Plan-In-Azure-265x600.png 265w" sizes="(max-width: 383px) 100vw, 383px" /></a><p id="caption-attachment-11512" class="wp-caption-text">New App Service Plan In Azure</p></div>
<p>Now select your app service plan, location, pricing tier. When you select the pricing tier, please be cautious because Azure charge you according to your use. Select it according your use. </p>
<div id="attachment_11513" style="width: 396px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/App-Service-Pricing-Tier.png"><img decoding="async" aria-describedby="caption-attachment-11513" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/App-Service-Pricing-Tier.png" alt="App Service Pricing Tier" width="386" height="865" class="size-full wp-image-11513" srcset="/wp-content/uploads/2016/04/App-Service-Pricing-Tier.png 386w, /wp-content/uploads/2016/04/App-Service-Pricing-Tier-134x300.png 134w, /wp-content/uploads/2016/04/App-Service-Pricing-Tier-268x600.png 268w" sizes="(max-width: 386px) 100vw, 386px" /></a><p id="caption-attachment-11513" class="wp-caption-text">App Service Pricing Tier</p></div>
<p>Now this is how you Mobile App service set up looks like. You can always pin your mobile app to your dashboard. </p>
<div id="attachment_11514" style="width: 396px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Mobie-App-Service.png"><img decoding="async" aria-describedby="caption-attachment-11514" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Mobie-App-Service.png" alt="Mobie App Service" width="386" height="864" class="size-full wp-image-11514" srcset="/wp-content/uploads/2016/04/Mobie-App-Service.png 386w, /wp-content/uploads/2016/04/Mobie-App-Service-134x300.png 134w, /wp-content/uploads/2016/04/Mobie-App-Service-268x600.png 268w" sizes="(max-width: 386px) 100vw, 386px" /></a><p id="caption-attachment-11514" class="wp-caption-text">Mobie App Service</p></div>
<p>Once this is done, you will get a notification that your mobile app deployment is succeeded if nothing goes wrong and you can see the app in your dashboard. Now click on the settings of your mobile application and then quick start.</p>
<div id="attachment_11515" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Quick-Start-Option-In-Azure-Mobile-App-e1460905361428.png"><img decoding="async" aria-describedby="caption-attachment-11515" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Quick-Start-Option-In-Azure-Mobile-App-e1460905361428.png" alt="Quick Start Option In Azure Mobile App" width="650" height="581" class="size-full wp-image-11515" srcset="/wp-content/uploads/2016/04/Quick-Start-Option-In-Azure-Mobile-App-e1460905361428.png 399w, /wp-content/uploads/2016/04/Quick-Start-Option-In-Azure-Mobile-App-e1460905361428-300x268.png 300w, /wp-content/uploads/2016/04/Quick-Start-Option-In-Azure-Mobile-App-e1460905361428-400x358.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11515" class="wp-caption-text">Quick Start Option In Azure Mobile App</p></div>
<p>Select Windows(C#) from it. Now you will be asked to complete three actions. </p>
<li>Connect a database</li>
<li>Create a table API</li>
<li>Configure your client application</li>
<h3>Connect a database</h3>
<p>Click on connect a database ( We will create a database first). Click Add and add a data connection as follows. </p>
<div id="attachment_11516" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Data-Connections-In-Azure-Mobile-App-e1460905798522.png"><img decoding="async" aria-describedby="caption-attachment-11516" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Data-Connections-In-Azure-Mobile-App-1024x583.png" alt="Data Connections In Azure Mobile App" width="634" height="361" class="size-large wp-image-11516" /></a><p id="caption-attachment-11516" class="wp-caption-text">Data Connections In Azure Mobile App</p></div>
<p>Now give your database name and pricing tier. For now I am going to select the pricing tier as Basic. You can see 5 DTUs are available for Basic tier. According to Microsoft, The Database Transaction Unit (DTU) is the unit of measure in SQL Database that represents the relative power of databases based on a real-world measure: the database transaction. Please read more <a href="https://azure.microsoft.com/en-us/documentation/articles/sql-database-service-tiers/?rnd=1#understanding-dtus" target="_blank">here</a>.</p>
<p>Did you notice that there is a field called Collation? Basically a collation is a set of rules and regulation we set for the proper use of characters. Like the characters are much different in all the languages, we set the collation accordingly. The default collation for character data in Azure SQL database is <em>SQL_Latin1_General_CP1_CI_AS</em>. You can read about collation <a href="https://azure.microsoft.com/en-in/blog/working-with-collations-in-sql-azure/" target="_blank">here</a>. </p>
<p>Next, set your server and click OK. Once you click OK, you can see the connection strings is being set automatically for you. Creation of data connection may take few minutes. Now we will create a table API. </p>
<h3>Create a table API</h3>
<p>To store the data in your back end. You need a table, isn&#8217;t it? The first option you will see here is select the language for your back end actions. You can select either C# or Node JS. </p>
<blockquote><p>There was a time, that we can do server side actions only by using server side languages like C#,Vb.Net, PhP etc. Now everything changes, we can do server side actions with few set of JavaScript, that is Node JS. </p></blockquote>
<p>Once you select your language you can see a message as &#8220;Once you’ve downloaded your personalized server project, extract it and open in Visual Studio. Right-click the project and select “Publish” to host the code in your mobile backend. The TodoItem table will be created automatically using Entity Framework.&#8221; Now we will do as suggested. </p>
<p>Please open your downloaded project in Visual Studio. Right click the project file then click publish. You can see a window and finish Profile, Connection, Settings steps. </p>
<div id="attachment_11517" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-Mobile-App-preview-e1460909105653.png"><img decoding="async" aria-describedby="caption-attachment-11517" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-Mobile-App-preview-e1460909105653.png" alt="Azure Mobile App preview" width="650" height="519" class="size-full wp-image-11517" srcset="/wp-content/uploads/2016/04/Azure-Mobile-App-preview-e1460909105653.png 447w, /wp-content/uploads/2016/04/Azure-Mobile-App-preview-e1460909105653-300x240.png 300w, /wp-content/uploads/2016/04/Azure-Mobile-App-preview-e1460909105653-400x319.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11517" class="wp-caption-text">Azure Mobile App preview</p></div>
<p>Click publish once you verified the settings. It may take few minutes according to your internet bandwidth. In the meanwhile you can see all the controllers and additional files had been created for us automatically. For example below is the Values controller.</p>
<p>[csharp]<br />
using System.Web.Http;<br />
using System.Web.Http.Tracing;<br />
using Microsoft.Azure.Mobile.Server;<br />
using Microsoft.Azure.Mobile.Server.Config;</p>
<p>namespace SibeeshTasksService.Controllers<br />
{<br />
    // Use the MobileAppController attribute for each ApiController you want to use<br />
    // from your mobile clients<br />
    [MobileAppController]<br />
    public class ValuesController : ApiController<br />
    {<br />
        // GET api/values<br />
        public string Get()<br />
        {<br />
            MobileAppSettingsDictionary settings = this.Configuration.GetMobileAppSettingsProvider().GetMobileAppSettings();<br />
            ITraceWriter traceWriter = this.Configuration.Services.GetTraceWriter();</p>
<p>            string host = settings.HostName ?? &quot;localhost&quot;;<br />
            string greeting = &quot;Hello from &quot; + host;</p>
<p>            traceWriter.Info(greeting);<br />
            return greeting;<br />
        }</p>
<p>        // POST api/values<br />
        public string Post()<br />
        {<br />
            return &quot;Hello World!&quot;;<br />
        }<br />
    }<br />
}<br />
[/csharp]</p>
<p>Now the publish process is completed, you can see a message as follows. </p>
<div id="attachment_11518" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-App-Service-Publish-e1460910331127.png"><img decoding="async" aria-describedby="caption-attachment-11518" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-App-Service-Publish-1024x414.png" alt="Azure App Service Publish" width="634" height="256" class="size-large wp-image-11518" /></a><p id="caption-attachment-11518" class="wp-caption-text">Azure App Service Publish</p></div>
<p>Now please go back to your Azure portal. </p>
<h3>Configure your client application</h3>
<p>It is time to configure our client application now. Download the client application by clicking the link provided. And open the project in Visual Studio. Please install the missing files if it is asked to do so. </p>
<div id="attachment_11520" style="width: 585px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/MIssing-Componenets.png"><img decoding="async" aria-describedby="caption-attachment-11520" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/MIssing-Componenets.png" alt="MIssing Componenets" width="575" height="807" class="size-full wp-image-11520" srcset="/wp-content/uploads/2016/04/MIssing-Componenets.png 575w, /wp-content/uploads/2016/04/MIssing-Componenets-214x300.png 214w, /wp-content/uploads/2016/04/MIssing-Componenets-400x561.png 400w, /wp-content/uploads/2016/04/MIssing-Componenets-428x600.png 428w" sizes="(max-width: 575px) 100vw, 575px" /></a><p id="caption-attachment-11520" class="wp-caption-text">MIssing Componenets</p></div>
<p>Once the installation is done, reload your project and it will be asked to enable developer mode for windows 10. Go ahead and change that in settings. </p>
<p>Now please open the shared project and click on MainPage.cs file, you can see the CRUD operation actions are already created for us. </p>
<p>[csharp]<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Threading.Tasks;<br />
using Microsoft.WindowsAzure.MobileServices;<br />
using Windows.UI.Popups;<br />
using Windows.UI.Xaml;<br />
using Windows.UI.Xaml.Controls;<br />
using Windows.UI.Xaml.Navigation;</p>
<p>// To add offline sync support, add the NuGet package Microsoft.WindowsAzure.MobileServices.SQLiteStore<br />
// to your project. Then, uncomment the lines marked // offline sync<br />
// For more information, see: http://aka.ms/addofflinesync<br />
//using Microsoft.WindowsAzure.MobileServices.SQLiteStore;  // offline sync<br />
//using Microsoft.WindowsAzure.MobileServices.Sync;         // offline sync</p>
<p>namespace SibeeshTasks<br />
{<br />
    sealed partial class MainPage: Page<br />
    {<br />
        private MobileServiceCollection&lt;TodoItem, TodoItem&gt; items;<br />
        private IMobileServiceTable&lt;TodoItem&gt; todoTable = App.MobileService.GetTable&lt;TodoItem&gt;();<br />
        //private IMobileServiceSyncTable&lt;TodoItem&gt; todoTable = App.MobileService.GetSyncTable&lt;TodoItem&gt;(); // offline sync</p>
<p>        public MainPage()<br />
        {<br />
            this.InitializeComponent();<br />
        }</p>
<p>        private async Task InsertTodoItem(TodoItem todoItem)<br />
        {<br />
            // This code inserts a new TodoItem into the database. When the operation completes<br />
            // and Mobile App backend has assigned an Id, the item is added to the CollectionView.<br />
            await todoTable.InsertAsync(todoItem);<br />
            items.Add(todoItem);</p>
<p>            //await SyncAsync(); // offline sync<br />
        }</p>
<p>        private async Task RefreshTodoItems()<br />
        {<br />
            MobileServiceInvalidOperationException exception = null;<br />
            try<br />
            {<br />
                // This code refreshes the entries in the list view by querying the TodoItems table.<br />
                // The query excludes completed TodoItems.<br />
                items = await todoTable<br />
                    .Where(todoItem =&gt; todoItem.Complete == false)<br />
                    .ToCollectionAsync();<br />
            }<br />
            catch (MobileServiceInvalidOperationException e)<br />
            {<br />
                exception = e;<br />
            }</p>
<p>            if (exception != null)<br />
            {<br />
                await new MessageDialog(exception.Message, &quot;Error loading items&quot;).ShowAsync();<br />
            }<br />
            else<br />
            {<br />
                ListItems.ItemsSource = items;<br />
                this.ButtonSave.IsEnabled = true;<br />
            }<br />
        }</p>
<p>        private async Task UpdateCheckedTodoItem(TodoItem item)<br />
        {<br />
            // This code takes a freshly completed TodoItem and updates the database. When the service<br />
            // responds, the item is removed from the list.<br />
            await todoTable.UpdateAsync(item);<br />
            items.Remove(item);<br />
            ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused);</p>
<p>            //await SyncAsync(); // offline sync<br />
        }</p>
<p>        private async void ButtonRefresh_Click(object sender, RoutedEventArgs e)<br />
        {<br />
            ButtonRefresh.IsEnabled = false;</p>
<p>            //await SyncAsync(); // offline sync<br />
            await RefreshTodoItems();</p>
<p>            ButtonRefresh.IsEnabled = true;<br />
        }</p>
<p>        private async void ButtonSave_Click(object sender, RoutedEventArgs e)<br />
        {<br />
            var todoItem = new TodoItem { Text = TextInput.Text };<br />
            await InsertTodoItem(todoItem);<br />
        }</p>
<p>        private async void CheckBoxComplete_Checked(object sender, RoutedEventArgs e)<br />
        {<br />
            CheckBox cb = (CheckBox)sender;<br />
            TodoItem item = cb.DataContext as TodoItem;<br />
            await UpdateCheckedTodoItem(item);<br />
        }</p>
<p>        protected override async void OnNavigatedTo(NavigationEventArgs e)<br />
        {<br />
            //await InitLocalStoreAsync(); // offline sync<br />
            await RefreshTodoItems();<br />
        }</p>
<p>        #region Offline sync</p>
<p>        //private async Task InitLocalStoreAsync()<br />
        //{<br />
        //    if (!App.MobileService.SyncContext.IsInitialized)<br />
        //    {<br />
        //        var store = new MobileServiceSQLiteStore(&quot;localstore.db&quot;);<br />
        //        store.DefineTable&lt;TodoItem&gt;();<br />
        //        await App.MobileService.SyncContext.InitializeAsync(store);<br />
        //    }<br />
        //<br />
        //    await SyncAsync();<br />
        //}</p>
<p>        //private async Task SyncAsync()<br />
        //{<br />
        //    await App.MobileService.SyncContext.PushAsync();<br />
        //    await todoTable.PullAsync(&quot;todoItems&quot;, todoTable.CreateQuery());<br />
        //}</p>
<p>        #endregion<br />
    }<br />
}<br />
[/csharp]</p>
<p>And following is the XAML file created for our app design.</p>
<p>[xml]<br />
&lt;Page<br />
    x:Class=&quot;SibeeshTasks.MainPage&quot;<br />
    IsTabStop=&quot;false&quot;<br />
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;<br />
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;<br />
    xmlns:local=&quot;using:SibeeshTasks&quot;<br />
    xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;<br />
    xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;<br />
    mc:Ignorable=&quot;d&quot;&gt;</p>
<p>    &lt;Grid Background=&quot;White&quot;&gt;</p>
<p>        &lt;Grid Margin=&quot;50,50,10,10&quot;&gt;<br />
            &lt;Grid.ColumnDefinitions&gt;<br />
                &lt;ColumnDefinition Width=&quot;*&quot; /&gt;<br />
                &lt;ColumnDefinition Width=&quot;*&quot; /&gt;<br />
            &lt;/Grid.ColumnDefinitions&gt;<br />
            &lt;Grid.RowDefinitions&gt;<br />
                &lt;RowDefinition Height=&quot;Auto&quot; /&gt;<br />
                &lt;RowDefinition Height=&quot;*&quot; /&gt;<br />
            &lt;/Grid.RowDefinitions&gt;</p>
<p>            &lt;Grid Grid.Row=&quot;0&quot; Grid.ColumnSpan=&quot;2&quot; Margin=&quot;0,0,0,20&quot;&gt;<br />
                &lt;StackPanel&gt;<br />
                    &lt;TextBlock Foreground=&quot;#0094ff&quot; FontFamily=&quot;Segoe UI Light&quot; Margin=&quot;0,0,0,6&quot;&gt;MICROSOFT AZURE MOBILE SERVICES&lt;/TextBlock&gt;<br />
                    &lt;TextBlock Foreground=&quot;Gray&quot; FontFamily=&quot;Segoe UI Light&quot; FontSize=&quot;45&quot; &gt;SibeeshTasks&lt;/TextBlock&gt;<br />
                &lt;/StackPanel&gt;<br />
            &lt;/Grid&gt;</p>
<p>            &lt;Grid Grid.Row=&quot;1&quot;&gt;<br />
                &lt;StackPanel&gt;</p>
<p>                    &lt;local:QuickStartTask Number=&quot;1&quot; Title=&quot;Insert a TodoItem&quot; Description=&quot;Enter some text below and click Save to insert a new todo item into your database&quot; /&gt;</p>
<p>                    &lt;StackPanel Orientation=&quot;Horizontal&quot; Margin=&quot;72,0,0,0&quot;&gt;<br />
                        &lt;TextBox Name=&quot;TextInput&quot; Margin=&quot;5&quot; MinWidth=&quot;300&quot;&gt;&lt;/TextBox&gt;<br />
                        &lt;Button Name=&quot;ButtonSave&quot; Click=&quot;ButtonSave_Click&quot; IsEnabled=&quot;False&quot;&gt;Save&lt;/Button&gt;<br />
                    &lt;/StackPanel&gt;</p>
<p>                &lt;/StackPanel&gt;<br />
            &lt;/Grid&gt;</p>
<p>            &lt;Grid Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot;&gt;<br />
                &lt;Grid.RowDefinitions&gt;<br />
                    &lt;RowDefinition Height=&quot;Auto&quot; /&gt;<br />
                    &lt;RowDefinition /&gt;<br />
                &lt;/Grid.RowDefinitions&gt;<br />
                &lt;StackPanel&gt;<br />
                    &lt;local:QuickStartTask Number=&quot;2&quot; Title=&quot;Query and Update Data&quot; Description=&quot;Click refresh below to load the unfinished TodoItems from your database. Use the checkbox to complete and update your TodoItems&quot; /&gt;<br />
                    &lt;Button Margin=&quot;72,0,0,0&quot; Name=&quot;ButtonRefresh&quot; Click=&quot;ButtonRefresh_Click&quot;&gt;Refresh&lt;/Button&gt;<br />
                &lt;/StackPanel&gt;</p>
<p>                &lt;ListView Name=&quot;ListItems&quot; Margin=&quot;62,10,0,0&quot; Grid.Row=&quot;1&quot;&gt;<br />
                    &lt;ListView.ItemTemplate&gt;<br />
                        &lt;DataTemplate&gt;<br />
                            &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;<br />
                                &lt;CheckBox Name=&quot;CheckBoxComplete&quot; IsChecked=&quot;{Binding Complete, Mode=TwoWay}&quot; Checked=&quot;CheckBoxComplete_Checked&quot; Content=&quot;{Binding Text}&quot; Margin=&quot;10,5&quot; VerticalAlignment=&quot;Center&quot;/&gt;<br />
                            &lt;/StackPanel&gt;<br />
                        &lt;/DataTemplate&gt;<br />
                    &lt;/ListView.ItemTemplate&gt;<br />
                &lt;/ListView&gt;</p>
<p>            &lt;/Grid&gt;</p>
<p>        &lt;/Grid&gt;<br />
    &lt;/Grid&gt;<br />
&lt;/Page&gt;<br />
[/xml]</p>
<p>Now please run your project. Here I am running the app in visual studio. You can always run the same in Windows Emulator. If nothing goes wrong you can see an output as follows. </p>
<div id="attachment_11521" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-Mobile-App-Output-e1460915717240.png"><img decoding="async" aria-describedby="caption-attachment-11521" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-Mobile-App-Output-1024x800.png" alt="Azure Mobile App Output" width="634" height="495" class="size-large wp-image-11521" /></a><p id="caption-attachment-11521" class="wp-caption-text">Azure Mobile App Output</p></div>
<div id="attachment_11522" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-Mobile-App-Output-Inserting-And-Reading-e1460915910597.png"><img decoding="async" aria-describedby="caption-attachment-11522" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Azure-Mobile-App-Output-Inserting-And-Reading-1024x802.png" alt="Azure Mobile App Output Inserting And Reading" width="634" height="497" class="size-large wp-image-11522" /></a><p id="caption-attachment-11522" class="wp-caption-text">Azure Mobile App Output Inserting And Reading</p></div>
<p>Just to make sure that the entries has been inserted and the data is getting from the database we can go back to our Azure portal. We all are humans, we believe things when we see. We all asks for the proof. Isn&#8217;t it? Click on SQL databases from the menu. Now you can see all the databases you have created, click on the database and get the server name, user id and password form the connection string. Once you get it, open your SQL Server Management Studio in your local machine and provide the details you took from the connection string. Now you can see the our Azure SQL database in your local SSMS.</p>
<div id="attachment_11523" style="width: 429px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Connect-Azure-SQL-Database-Through-SSMS.png"><img decoding="async" aria-describedby="caption-attachment-11523" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Connect-Azure-SQL-Database-Through-SSMS.png" alt="Connect Azure SQL Database Through SSMS" width="419" height="916" class="size-full wp-image-11523" srcset="/wp-content/uploads/2016/04/Connect-Azure-SQL-Database-Through-SSMS.png 419w, /wp-content/uploads/2016/04/Connect-Azure-SQL-Database-Through-SSMS-137x300.png 137w, /wp-content/uploads/2016/04/Connect-Azure-SQL-Database-Through-SSMS-400x874.png 400w, /wp-content/uploads/2016/04/Connect-Azure-SQL-Database-Through-SSMS-274x600.png 274w" sizes="(max-width: 419px) 100vw, 419px" /></a><p id="caption-attachment-11523" class="wp-caption-text">Connect Azure SQL Database Through SSMS</p></div>
<p>Now we can query our table and see the data. Right?</p>
<p>[sql]<br />
USE [Tasks]<br />
GO</p>
<p>SELECT [Id]<br />
      ,[Text]<br />
      ,[Complete]<br />
      ,[Version]<br />
      ,[CreatedAt]<br />
      ,[UpdatedAt]<br />
      ,[Deleted]<br />
  FROM [dbo].[TodoItems]<br />
GO<br />
[/sql]</p>
<p>I am sure you will get an result as follows.</p>
<div id="attachment_11524" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Querying-Azure-SQL-Database-In-SSMS-e1460917590108.png"><img decoding="async" aria-describedby="caption-attachment-11524" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Querying-Azure-SQL-Database-In-SSMS-1024x435.png" alt="Querying Azure SQL Database In SSMS" width="634" height="269" class="size-large wp-image-11524" /></a><p id="caption-attachment-11524" class="wp-caption-text">Querying Azure SQL Database In SSMS</p></div>
<p>You can always run this same application in Windows Emulator, Now we will see how we can do that.</p>
<h3>Download Windows Emulator</h3>
<p>Before getting started, you must install Windows Emulator in your machine. You can get the Windows 10 emulator from <a href="https://www.microsoft.com/en-in/download/details.aspx?id=46893" target="_blank">here</a>. Please be noted that there are some sysytem requirements and actions to be taken care of before going to install the emulator. Basically Microsoft emulator works as a virtual machine on Hyper V. You must enable it. </p>
<h3>Enable Hyper-V in Windows</h3>
<p>To enable Hyper-V, go to control panel and select Programs, then click on &#8216;Turn windows feature on or off&#8217; and then select all the items under Hyper-V.</p>
<div id="attachment_11539" style="width: 564px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Enable-Hyper-V-in-Windows.png"><img decoding="async" aria-describedby="caption-attachment-11539" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Enable-Hyper-V-in-Windows.png" alt="Enable Hyper V in Windows" width="554" height="491" class="size-full wp-image-11539" srcset="/wp-content/uploads/2016/04/Enable-Hyper-V-in-Windows.png 554w, /wp-content/uploads/2016/04/Enable-Hyper-V-in-Windows-300x266.png 300w, /wp-content/uploads/2016/04/Enable-Hyper-V-in-Windows-400x355.png 400w" sizes="(max-width: 554px) 100vw, 554px" /></a><p id="caption-attachment-11539" class="wp-caption-text">Enable Hyper V in Windows</p></div>
<p>You may need to restart your system once. There are some additional requirements too.</p>
<h3>System Requirements</h3>
<p>We must enable the following configurations in BIOS.</p>
<li>Hardware-assisted virtualization</li>
<li>Second Level Address Translation (SLAT)</li>
<li>Hardware-based Data Execution Prevention (DEP)</li>
<p>And we need,</p>
<li>4GB or more RAM</li>
<li>OS Windows 8 or higher(Pro edition or higher)</li>
<p>To go to BIOS settings in Windows 10, Just type &#8216;change advanced startup options&#8217; in the start search box. And then click on the Restart under advanced settings. There you will see the BIOS options. Once you are done these procedures, you can go ahead and install Windows Emulator. After you install the emulator you can see an option to run the app in emulator in Visual Studio. </p>
<h3>Run app in Windows emulator</h3>
<p>Please see the option as follows in visual studio. </p>
<div id="attachment_11540" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Emulator-option-in-Visual-studio-e1461419933506.png"><img decoding="async" aria-describedby="caption-attachment-11540" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Emulator-option-in-Visual-studio-e1461419933506.png" alt="Emulator option in Visual studio" width="650" height="82" class="size-full wp-image-11540" srcset="/wp-content/uploads/2016/04/Emulator-option-in-Visual-studio-e1461419933506.png 650w, /wp-content/uploads/2016/04/Emulator-option-in-Visual-studio-e1461419933506-300x38.png 300w, /wp-content/uploads/2016/04/Emulator-option-in-Visual-studio-e1461419933506-400x50.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11540" class="wp-caption-text">Emulator option in Visual studio</p></div>
<p>Now you can run your application in emulator if everything works fine. </p>
<div id="attachment_11541" style="width: 443px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Windows-emulator-output.png"><img decoding="async" aria-describedby="caption-attachment-11541" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Windows-emulator-output.png" alt="Windows emulator output" width="433" height="839" class="size-full wp-image-11541" srcset="/wp-content/uploads/2016/04/Windows-emulator-output.png 184w, /wp-content/uploads/2016/04/Windows-emulator-output-155x300.png 155w, /wp-content/uploads/2016/04/Windows-emulator-output-400x775.png 400w, /wp-content/uploads/2016/04/Windows-emulator-output-310x600.png 310w" sizes="(max-width: 433px) 100vw, 433px" /></a><p id="caption-attachment-11541" class="wp-caption-text">Windows emulator output</p></div>
<p>I guess we are done. Hope you enjoyed reading. I will see you soon with another article. </p>
<h3>Conclusion</h3>
<p>Did I miss anything that you may think which is needed? Did you try Azure yet? Have you ever created any mobile apps? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h3>Your turn. What do you think?</h3>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/creating-azure-mobile-app-with-visual-studio/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fix to RegAsm : warning RA0000 : No types were registered</title>
		<link>https://mail.sibeeshpassion.com/fix-to-regasm-warning-ra0000-no-types-were-registered/</link>
					<comments>https://mail.sibeeshpassion.com/fix-to-regasm-warning-ra0000-no-types-were-registered/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 21 Jan 2016 09:54:00 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[AssemblyInfo]]></category>
		<category><![CDATA[Command Prompt]]></category>
		<category><![CDATA[RegAsm]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11145</guid>

					<description><![CDATA[In this post we will discuss one fix for the issue &#8220;RegAsm : warning RA0000 : No types were registered&#8221;. You may get this warning when you try to register an assebly using RegAsm. if you need to know more about RegAsm, you can see here. Solution to &#8220;RegAsm : warning RA0000 : No types were registered&#8221; Go to your AssemblyInfo.cs. You can see that class under property. What is AssemblyInfo.cs Basically AssemblyInfo.cs is used to document all of the dll&#8217;s or exe&#8217;s you have in your project. It can include the informations about from where the codes comes from, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss one fix for the issue &#8220;RegAsm : warning RA0000 : No types were registered&#8221;. You may get this warning when you try to register an assebly using RegAsm. if you need to know more about RegAsm, you can see <a href="https://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.110).aspx" target="_blank" rel="noopener">here</a>. </p>
<p><strong>Solution to &#8220;RegAsm : warning RA0000 : No types were registered&#8221;</strong></p>
<p>Go to your AssemblyInfo.cs. You can see that class under property.</p>
<div id="attachment_11146" style="width: 490px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/01/AssemblyInfo.png"><img decoding="async" aria-describedby="caption-attachment-11146" src="http://sibeeshpassion.com/wp-content/uploads/2016/01/AssemblyInfo.png" alt="AssemblyInfo" width="480" height="146" class="size-full wp-image-11146" srcset="/wp-content/uploads/2016/01/AssemblyInfo.png 480w, /wp-content/uploads/2016/01/AssemblyInfo-300x91.png 300w, /wp-content/uploads/2016/01/AssemblyInfo-400x122.png 400w" sizes="(max-width: 480px) 100vw, 480px" /></a><p id="caption-attachment-11146" class="wp-caption-text">AssemblyInfo</p></div>
<p><strong>What is AssemblyInfo.cs</strong></p>
<p>Basically AssemblyInfo.cs is used to document all of the dll&#8217;s or exe&#8217;s you have in your project. It can include the informations about from where the codes comes from, and the version details. You can always check <a href="https://support.microsoft.com/en-us/kb/556041" target="_blank" rel="noopener">here </a>for more information regarding AssembleInfo class file. </p>
<p>Open the file and search for ComVisible. You can see ComVisible has been set to false as follows. </p>
<p>[csharp]<br />
[assembly: ComVisible(false)]<br />
[/csharp]</p>
<blockquote><p>
Setting ComVisible to false makes the types in this assembly not visible to COM components.  If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type.
</p></blockquote>
<div id="attachment_11147" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/01/Set_ComVisible_to_true.png"><img decoding="async" aria-describedby="caption-attachment-11147" src="http://sibeeshpassion.com/wp-content/uploads/2016/01/Set_ComVisible_to_true-1024x236.png" alt="Set_ComVisible_to_true" width="634" height="146" class="size-large wp-image-11147" srcset="/wp-content/uploads/2016/01/Set_ComVisible_to_true-1024x236.png 1024w, /wp-content/uploads/2016/01/Set_ComVisible_to_true-300x69.png 300w, /wp-content/uploads/2016/01/Set_ComVisible_to_true-768x177.png 768w, /wp-content/uploads/2016/01/Set_ComVisible_to_true-400x92.png 400w, /wp-content/uploads/2016/01/Set_ComVisible_to_true.png 1698w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11147" class="wp-caption-text">Set_ComVisible_to_true</p></div>
<p>Now if you run your command with RegAsm, you will not get this warning. </p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/fix-to-regasm-warning-ra0000-no-types-were-registered/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Creating Strong Names Using Visual Studio Command Prompt</title>
		<link>https://mail.sibeeshpassion.com/creating-strong-names-using-visual-studio-command-prompt/</link>
					<comments>https://mail.sibeeshpassion.com/creating-strong-names-using-visual-studio-command-prompt/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 21 Jan 2016 09:31:40 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[.snk File]]></category>
		<category><![CDATA[DLL details]]></category>
		<category><![CDATA[Find KeyToken]]></category>
		<category><![CDATA[PublicKeyToken]]></category>
		<category><![CDATA[Strong Names]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11140</guid>

					<description><![CDATA[In this post we will see how we can create strong names using Visual Studio Command Prompt. Here I am going to use Visual Studio 2012. Before going through the steps to create strong name, we will define what exactly strong name is. I hope you will like this. What is strong name? Basically strong name is a container which consists of assembly&#8217;s informations. For example it contains, name of the assembly, culture informations, version number, public key, digital signature. It can be generated by using developer tools like visual studio command prompt from an assembly file. The strong names [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see how we can create strong names using Visual Studio Command Prompt. Here I am going to use Visual Studio 2012. Before going through the steps to create strong name, we will define what exactly strong name is. I hope you will like this. </p>
<p><strong>What is strong name?</strong></p>
<p>Basically strong name is a container which consists of assembly&#8217;s informations. For example it contains, name of the assembly, culture informations, version number, public key, digital signature. It can be generated by using developer tools like visual studio command prompt from an assembly file. </p>
<p>The strong names are unique( And yeah it must be). By creating an assembly with strong names you can make sure that the name is globally unique. You can find some more informations about strong names <a href="https://msdn.microsoft.com/en-us/library/wd40t7ad(VS.71).aspx" target="_blank" rel="noopener">here</a>.</p>
<blockquote><p>
If you need to find the public key of a DLL, you can see here: <a href="http://sibeeshpassion.com/how-to-find-publickeytoken-of-a-dll/" target="_blank" rel="noopener">How to find PublicKeyToken of a DLL</a>
</p></blockquote>
<p><strong>Steps to create strong names</strong></p>
<p><strong>Step 1: Opening visual studio command prompt</strong></p>
<p>To open a command prompt, you can either go to short cuts from the directory as</p>
<p>[html]<br />
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts<br />
[/html]</p>
<p>Or you can go to start->Type Visual Studio-> You can find Visual Studio Tools folder. </p>
<div id="attachment_11141" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start.png"><img decoding="async" aria-describedby="caption-attachment-11141" src="http://sibeeshpassion.com/wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start-1024x282.png" alt="Create_Strong_Name_Key_File_-_Start" width="634" height="175" class="size-large wp-image-11141" srcset="/wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start-1024x282.png 1024w, /wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start-300x83.png 300w, /wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start-768x212.png 768w, /wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start-400x110.png 400w, /wp-content/uploads/2016/01/Create_Strong_Name_Key_File_-_Start.png 1777w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11141" class="wp-caption-text">Create_Strong_Name_Key_File_-_Start</p></div>
<p><strong>Step 2: Run Command Prompt</strong></p>
<p>Just click on the command prompt and run as administrator.</p>
<div id="attachment_11142" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/01/Create_Strong_Name_Key_File_Tools-e1453368327456.png"><img decoding="async" aria-describedby="caption-attachment-11142" src="http://sibeeshpassion.com/wp-content/uploads/2016/01/Create_Strong_Name_Key_File_Tools-e1453368327456.png" alt="Create_Strong_Name_Key_File_Tools" width="650" height="258" class="size-full wp-image-11142" srcset="/wp-content/uploads/2016/01/Create_Strong_Name_Key_File_Tools-e1453368327456.png 650w, /wp-content/uploads/2016/01/Create_Strong_Name_Key_File_Tools-e1453368327456-300x119.png 300w, /wp-content/uploads/2016/01/Create_Strong_Name_Key_File_Tools-e1453368327456-400x159.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11142" class="wp-caption-text">Create_Strong_Name_Key_File_Tools</p></div>
<p><strong>Step 3: Creating .snk file</strong></p>
<p>To create a strong name, you need to run the below command in the command prompt. </p>
<p>[html]<br />
C:\Program Files (x86)\Microsoft Visual Studio 12.0\SDK\v3.5\Bin&gt;sn -k &quot;c:\stron<br />
g.snk<br />
[/html]</p>
<p>Here, the visual studio and framework versions will be changed as your version. And the stron name strong.snk will be created in the C drive root  directory. </p>
<p>Once you run that command, you can see an output as follows.</p>
<p>[html]<br />
Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.33440<br />
Copyright (c) Microsoft Corporation.  All rights reserved.</p>
<p>Key pair written to c:\strong.snk<br />
[/html]</p>
<div id="attachment_11143" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/01/Create_Strong_Name-e1453368508766.png"><img decoding="async" aria-describedby="caption-attachment-11143" src="http://sibeeshpassion.com/wp-content/uploads/2016/01/Create_Strong_Name-e1453368508766.png" alt="Create_Strong_Name" width="650" height="330" class="size-full wp-image-11143" srcset="/wp-content/uploads/2016/01/Create_Strong_Name-e1453368508766.png 650w, /wp-content/uploads/2016/01/Create_Strong_Name-e1453368508766-300x152.png 300w, /wp-content/uploads/2016/01/Create_Strong_Name-e1453368508766-400x203.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11143" class="wp-caption-text">Create_Strong_Name</p></div>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/creating-strong-names-using-visual-studio-command-prompt/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Load Data From Database Using Web API</title>
		<link>https://mail.sibeeshpassion.com/load-data-from-database-using-web-api/</link>
					<comments>https://mail.sibeeshpassion.com/load-data-from-database-using-web-api/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sat, 31 Oct 2015 11:08:57 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Web API]]></category>
		<category><![CDATA[CRUD in MVC]]></category>
		<category><![CDATA[Load Data From Database Using Web API]]></category>
		<category><![CDATA[MVC4]]></category>
		<category><![CDATA[MVC5]]></category>
		<category><![CDATA[Visual Studio 2013]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10141</guid>

					<description><![CDATA[In this article we will learn about Loading Data From Database in MVC using Web API. We will use Visual Studio 2015 to create a Web API and performs the operations. In this project we are going to create a database and a table called tbl_Subcribers which actually contains a list of data. We will use our normal jQuery ajax to call the Web API, once the data is ready we will format the same in an html table. I hope you will like this. Download the source code Load Data From Database Using Web API Background What is a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we will learn about Loading Data From Database in <a href="http://sibeeshpassion.com/tag/mvc/" target="_blank" rel="noopener">MVC </a> using Web API. We will use <a href="http://sibeeshpassion.com/tag/visual-studio/" target="_blank" rel="noopener">Visual Studio</a> 2015 to create a Web API and performs the operations. In this project we are going to create a <em><a href="http://sibeeshpassion.com/tag/database/" target="_blank" rel="noopener"> database </a></em> and a table called <em>tbl_Subcribers</em> which actually contains a list of data. We will use our normal jQuery ajax to call the Web API, once the data is ready we will format the same in an html table. I hope you will like this. </p>
<p><strong>Download the source code</strong></p>
<li><a href="https://code.msdn.microsoft.com/Load-Data-From-Database-59a20734" target="_blank" rel="noopener">Load Data From Database Using Web API</a></li>
<p><strong>Background</strong></p>
<p><em>What is a Web API?</em></p>
<p>A Web API is a kind of a framework which makes building HTTP services easier than ever. It can be used almost everywhere including wide range of clients, mobile devices, browsers etc. It contains normal MVC features like Model, Controller, Actions, Routing etc. Support all HTTP verbs like POST, GET, DELETE, PUT. </p>
<div id="attachment_10874" style="width: 560px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Why-Web-API.png"><img decoding="async" aria-describedby="caption-attachment-10874" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Why-Web-API.png" alt="Why Web API" width="550" height="377" class="size-full wp-image-10874" srcset="/wp-content/uploads/2015/10/Why-Web-API.png 550w, /wp-content/uploads/2015/10/Why-Web-API-300x206.png 300w, /wp-content/uploads/2015/10/Why-Web-API-320x218.png 320w, /wp-content/uploads/2015/10/Why-Web-API-160x110.png 160w, /wp-content/uploads/2015/10/Why-Web-API-400x274.png 400w" sizes="(max-width: 550px) 100vw, 550px" /></a><p id="caption-attachment-10874" class="wp-caption-text">Why Web API</p></div>
<p><em>Image Courtesy : blogs.msdn.com</em></p>
<div id="attachment_10875" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Why-Web-API1-e1446290457816.png"><img decoding="async" aria-describedby="caption-attachment-10875" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Why-Web-API1-e1446290457816.png" alt="Why Web API" width="650" height="454" class="size-full wp-image-10875" srcset="/wp-content/uploads/2015/10/Why-Web-API1-e1446290457816.png 650w, /wp-content/uploads/2015/10/Why-Web-API1-e1446290457816-300x210.png 300w, /wp-content/uploads/2015/10/Why-Web-API1-e1446290457816-400x279.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10875" class="wp-caption-text">Why Web API</p></div>
<p><em>Image Courtesy : forums.asp.net</em></p>
<p><strong>Using the code</strong></p>
<p>We will create our project in Visual Studio 2015. To create a project click File-> New-> Project.</p>
<div id="attachment_10151" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_1-e1440410870120.png"><img decoding="async" aria-describedby="caption-attachment-10151" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_1-e1440410870120.png" alt="CRUD_in_MVC_Using_Web_API" width="650" height="450" class="size-full wp-image-10151" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_1-e1440410870120.png 650w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_1-e1440410870120-300x208.png 300w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_1-e1440410870120-160x110.png 160w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_1-e1440410870120-400x277.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10151" class="wp-caption-text">CRUD_in_MVC_Using_Web_API</p></div>
<div id="attachment_10161" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_2-e1440410926817.png"><img decoding="async" aria-describedby="caption-attachment-10161" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_2-e1440410926817.png" alt="CRUD_in_MVC_Using_Web_API" width="650" height="590" class="size-full wp-image-10161" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_2-e1440410926817.png 393w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_2-e1440410926817-300x272.png 300w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_2-e1440410926817-400x363.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10161" class="wp-caption-text"><br />CRUD_in_MVC_Using_Web_API</p></div>
<p><strong>Create a control</strong></p>
<p>Now we will create a control in our project.</p>
<div id="attachment_10171" style="width: 662px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Control.png"><img decoding="async" aria-describedby="caption-attachment-10171" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Control.png" alt="CRUD_in_MVC_Using_Web_API_Adding_Control" width="652" height="596" class="size-full wp-image-10171" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Control.png 652w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Control-300x274.png 300w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Control-400x366.png 400w" sizes="(max-width: 652px) 100vw, 652px" /></a><p id="caption-attachment-10171" class="wp-caption-text">CRUD_in_MVC_Using_Web_API_Adding_Control</p></div>
<p>Select <em>Empty API Controller</em> as template.</p>
<div id="attachment_10191" style="width: 648px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Select_APIControl.png"><img decoding="async" aria-describedby="caption-attachment-10191" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Select_APIControl.png" alt="CRUD_in_MVC_Using_Web_API_Select_APIControl" width="638" height="430" class="size-full wp-image-10191" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Select_APIControl.png 638w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Select_APIControl-300x202.png 300w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Select_APIControl-400x270.png 400w" sizes="(max-width: 638px) 100vw, 638px" /></a><p id="caption-attachment-10191" class="wp-caption-text">CRUD_in_MVC_Using_Web_API_Select_APIControl</p></div>
<p>As you can notice that we have selected Empty API Controller instead of selecting a normal controller. There are few difference between our normal controller and Empty API Controller. </p>
<p><strong>Controller VS Empty API Controller</strong></p>
<p>A controller normally render your views. But an API controller returns the data which is already serialized. A controller action returns JSON() by converting the data. You can get rid of this by using API controller.</p>
<p>Find out more: <a href="http://stackoverflow.com/questions/9494966/difference-between-apicontroller-and-controller-in-asp-net-mvc" target="_blank" rel="noopener">Controller VS API Controller </a></p>
<p><strong>Create a model</strong></p>
<p>As you all know, we write logic in a class called model in MVC. So next step what we need to do is creating a model. </p>
<p>Right click on Model and click Add new Items and then class. Name it as Subscribers. We are going to handle the subscriber list who all are subscribed to your website.</p>
<p>Now we will create a Database to our application.</p>
<p><strong>Create Database</strong></p>
<div id="attachment_10201" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Create_Database-e1440412525937.png"><img decoding="async" aria-describedby="caption-attachment-10201" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Create_Database-e1440412525937.png" alt="CRUD_in_MVC_Using_Web_API_Create_Database" width="650" height="449" class="size-full wp-image-10201" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Create_Database-e1440412525937.png 650w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Create_Database-e1440412525937-300x207.png 300w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Create_Database-e1440412525937-160x110.png 160w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Create_Database-e1440412525937-400x276.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10201" class="wp-caption-text">CRUD_in_MVC_Using_Web_API_Create_Database</p></div>
<p>Once you created the database, you can see your database in App_Data folder.</p>
<div id="attachment_10211" style="width: 345px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Created_DB.png"><img decoding="async" aria-describedby="caption-attachment-10211" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Created_DB.png" alt="CRUD_in_MVC_Using_Web_API_Created_DB" width="335" height="135" class="size-full wp-image-10211" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Created_DB.png 335w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Created_DB-300x121.png 300w" sizes="(max-width: 335px) 100vw, 335px" /></a><p id="caption-attachment-10211" class="wp-caption-text">CRUD_in_MVC_Using_Web_API_Created_DB</p></div>
<p>Now will add a new table to our database.</p>
<div id="attachment_10221" style="width: 357px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Table.png"><img decoding="async" aria-describedby="caption-attachment-10221" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Table.png" alt="CRUD_in_MVC_Using_Web_API_Adding_Table" width="347" height="294" class="size-full wp-image-10221" srcset="/wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Table.png 347w, /wp-content/uploads/2015/08/CRUD_in_MVC_Using_Web_API_Adding_Table-300x254.png 300w" sizes="(max-width: 347px) 100vw, 347px" /></a><p id="caption-attachment-10221" class="wp-caption-text">CRUD_in_MVC_Using_Web_API_Adding_Table</p></div>
<p>You can see the query to create a table below. </p>
<p>[sql]<br />
CREATE TABLE [dbo].[Table]<br />
(<br />
	[SubscriberID] INT NOT NULL PRIMARY KEY,<br />
    [MailID] NVARCHAR(50) NOT NULL,<br />
    [SubscribedDate] DATETIME2 NOT NULL<br />
)<br />
[/sql]</p>
<p>It seems our database is ready now. </p>
<div id="attachment_10868" style="width: 271px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API.png"><img decoding="async" aria-describedby="caption-attachment-10868" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API.png" alt="Load Data From Database Using Web API" width="261" height="293" class="size-full wp-image-10868" /></a><p id="caption-attachment-10868" class="wp-caption-text">Load Data From Database Using Web API</p></div>
<p>The next thing we need to do is to create a ADO.NET Entity Data Model. SO shall we do that? Right click on your model and click on add new item, in the upcoming dialogue, select ADO.NET Entity Data Model.Name that file, Here I have given the name as SP. And in the next steps select the tables, stored procedures, and views you want.</p>
<div id="attachment_10869" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2.png"><img decoding="async" aria-describedby="caption-attachment-10869" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-1024x711.png" alt="Load Data From Database Using Web API " width="634" height="440" class="size-large wp-image-10869" srcset="/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-1024x711.png 1024w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-300x208.png 300w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-768x533.png 768w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-160x110.png 160w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-400x278.png 400w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2-864x600.png 864w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-2.png 1178w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10869" class="wp-caption-text">Load Data From Database Using Web API</p></div>
<p>So a new file will be created in your model folder. </p>
<p>Now we will create an ajax call so that you can call the web API. We will use normal Ajax with type GET since we need to just retrieve the data.</p>
<blockquote><p> A web API control does not return any action result or any json result, so we need to manually do this. We will use the index.cshtml file as our view</p></blockquote>
<p>We are going to call our web API as follows from the view Index.cshtml.</p>
<p>[js]<br />
 @section scripts<br />
        {<br />
        &lt;script&gt;<br />
            $(document).ready(function () {<br />
                $.ajax(<br />
                    {<br />
                        type: &#8216;GET&#8217;,<br />
                        dataType: &#8216;json&#8217;,<br />
                        contentType: &#8216;application/json;charset=utf-8&#8217;,<br />
                        url: &#8216;http://localhost:3064/api/Subscribers&#8217;,<br />
                        success: function (data) {<br />
                            try {<br />
                                debugger;<br />
                                var html = &#8216;&lt;table&gt;&lt;thead&gt;&lt;th&gt;Mail ID&lt;/th&gt;&lt;th&gt;Subscription ID&lt;/th&gt;&lt;th&gt;Subscription Date&lt;/th&gt;&lt;/thead&gt;&lt;tbody&gt;&#8217;;<br />
                                $.each(data, function (key, val) {<br />
                                    debugger;<br />
                                    html += &#8216;&lt;tr&gt;&lt;td&gt;&#8217;<br />
                                        + &#8216;&lt;a &#8216; + &#8216;href=&quot;mailto:&#8217; + val.MailID + &#8216;&quot;&gt;&#8217; + val.MailID + &#8216;&lt;/a&gt;&#8217; +<br />
                                    &#8216;&lt;/td&gt;&lt;td&gt;&#8217; + val.SubscriberID + &#8216;&lt;/td&gt;&lt;td&gt;&#8217; + val.SubscribedDate + &#8216;&lt;/td&gt;&lt;/tr&gt;&#8217;;<br />
                                });<br />
                                html += &#8216;&lt;/tbody&gt;&lt;/table&gt;&#8217;;<br />
                                $(&#8216;#myGrid&#8217;).html(html);<br />
                            } catch (e) {<br />
                                console.log(&#8216;Error while formatting the data : &#8216; + e.message)<br />
                            }<br />
                        },<br />
                        error: function (xhrequest, error, thrownError) {<br />
                            console.log(&#8216;Error while ajax call: &#8216; + error)<br />
                        }</p>
<p>                    }<br />
                    );<br />
            });<br />
        &lt;/script&gt;</p>
<p>    }<br />
[/js]</p>
<p>Once we get the data in the success part of the ajax call we are formulating the data in an HTML table and bind the formatted html to the element myGrid. </p>
<p>[html]<br />
&lt;div id=&quot;myGrid&quot;&gt;&lt;/div&gt;<br />
[/html]</p>
<blockquote><p> Please be noted that url you give must be correct, or else you will end up with some errors. Your actions won&#8217;t work</p></blockquote>
<p>So we are calling our web api as http://localhost:3064/api/Subscribers. Do you remember we have already created a controller? Now we are going back to that. So we need to create an action which returns the total subscribed list from the database, so for that we will write few lines of codes as follows.</p>
<p>[csharp]<br />
public List&lt;tbl_Subscribers&gt; getSubscribers()<br />
        {<br />
            try<br />
            {<br />
                using (var db = new sibeeshpassionEntities())<br />
                {<br />
                    Subscriber sb = new Subscriber();<br />
                    return (sb.getSubcribers(db).ToList());<br />
                }</p>
<p>            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>Here Subscriber is our model class, to get the reference of your model class in controller, you need to include the model namespace. We are getting a list of data in tbl_Subcribers type. Now we will concentrate on model class. </p>
<p>You can see the model action codes here.</p>
<p>[csharp]<br />
 public List&lt;tbl_Subscribers&gt; getSubcribers(sibeeshpassionEntities sb)<br />
        {<br />
            try<br />
            {<br />
                if (sb != null)<br />
                {<br />
                    return sb.tbl_Subscribers.ToList();<br />
                }<br />
                return null;<br />
            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>This will return the data which is available in the table tbl_Subcribers in sibeeshpassion DB. It seems everything is set. Now what else we need to do? Yes we need to create some entries in the table. Please see the insertion query here.</p>
<p>[sql]<br />
INSERT INTO [dbo].[tbl_Subscribers] ([SubscriberID], [MailID], [SubscribedDate]) VALUES (1, N&#8217;sibikv4u@gmail.com&#8217;, N&#8217;2015-10-30 00:00:00&#8242;)<br />
INSERT INTO [dbo].[tbl_Subscribers] ([SubscriberID], [MailID], [SubscribedDate]) VALUES (2, N&#8217;sibeesh.venu@gmail.com&#8217;, N&#8217;2015-10-29 00:00:00&#8242;)<br />
INSERT INTO [dbo].[tbl_Subscribers] ([SubscriberID], [MailID], [SubscribedDate]) VALUES (3, N&#8217;ajaybhasy@gmail.com&#8217;, N&#8217;2015-10-28 00:00:00&#8242;)<br />
[/sql]</p>
<p>So the data is inserted. Isn&#8217;t it?</p>
<div id="attachment_10870" style="width: 527px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-3.png"><img decoding="async" aria-describedby="caption-attachment-10870" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-3.png" alt="Load Data From Database Using Web API " width="517" height="200" class="size-full wp-image-10870" srcset="/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-3.png 517w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-3-300x116.png 300w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-3-400x155.png 400w" sizes="(max-width: 517px) 100vw, 517px" /></a><p id="caption-attachment-10870" class="wp-caption-text">Load Data From Database Using Web API</p></div>
<blockquote><p><strong>Do you know?</strong><br />
Like we have RouteConfig.cs in MVC, we have another class file called WebApiConfig.cs in Web API which actually sets the routes.</p>
<p>[csharp]<br />
routes.MapRoute(<br />
                name: &quot;Default&quot;,<br />
                url: &quot;{controller}/{action}/{id}&quot;,<br />
                defaults: new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = UrlParameter.Optional }<br />
            );<br />
[/csharp]
</p></blockquote>
<p>So shall we run our project and see the output? Before going to run, I suggest you to style the HTML table by applying some CSSs as follows.</p>
<p>[css]<br />
&lt;style&gt;<br />
        table,tr,td,th {<br />
            border:1px solid #ccc;<br />
            border-radius:5px;<br />
            padding:10px;<br />
            margin:10px;<br />
        }</p>
<p>    &lt;/style&gt;<br />
[/css]</p>
<p>If everything goes fine, you will get the output as follows.</p>
<div id="attachment_10871" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-4-e1446288898428.png"><img decoding="async" aria-describedby="caption-attachment-10871" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-4-e1446288898428.png" alt="Load Data From Database Using Web API" width="650" height="497" class="size-full wp-image-10871" srcset="/wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-4-e1446288898428.png 650w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-4-e1446288898428-300x229.png 300w, /wp-content/uploads/2015/10/Load-Data-From-Database-Using-Web-API-4-e1446288898428-400x306.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10871" class="wp-caption-text">Load Data From Database Using Web API</p></div>
<p>That is all. We did it. Have a happy coding.</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Did you try Web API yet? Have you ever wanted to do this requirement? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/load-data-from-database-using-web-api/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>How to find PublicKeyToken of a DLL</title>
		<link>https://mail.sibeeshpassion.com/how-to-find-publickeytoken-of-a-dll/</link>
					<comments>https://mail.sibeeshpassion.com/how-to-find-publickeytoken-of-a-dll/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 14 Jul 2015 15:07:35 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[DLL details]]></category>
		<category><![CDATA[Find KeyToken]]></category>
		<category><![CDATA[How to find PublicKeyToken of a DLL]]></category>
		<category><![CDATA[Immediate Window]]></category>
		<category><![CDATA[PublicKeyToken]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=7061</guid>

					<description><![CDATA[Introduction In this article we will learn how we can find out the public key token of a DLL that we add as a reference in our project . I hope you will like it. Background Today I was trying to find out a public key of a dll that I added to my MVC project. I came to know that we can find out this by using our visual studio itself. Here by I am sharing you that information. I am using Visual Studio 2012. Using the code To find out the DLL information, you need to run your [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>In this article we will learn how we can find out the public key token of a DLL that we add as a reference in our project . I hope you will like it.</p>
<p><strong>Background</strong></p>
<p>Today I was trying to find out a public key of a dll that I added to my MVC project. I came to know that we can find out this by using our visual studio itself. Here by I am sharing you that information. I am using Visual Studio 2012.</p>
<p><strong>Using the code</strong></p>
<p>To find out the DLL information, you need to run your project, since this process will work only in debug mode. you need to put a break point somewhere in your cs page. </p>
<p>And when the break hits, you need to go to the immediate window by pressing Alt+Ctrl+I .</p>
<p>Now a window will be opening, there you need to type<br />
[csharp]<br />
?System.Reflection.Assembly.LoadFile(@&quot;C:\SVenu\TestApp\TestApp\bin\CellSetGrid2.dll&quot;).FullName<br />
[/csharp]</p>
<p>Then you can see output in the immediate window as follows.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/How_to_find_PublicKeyToken_of_a_DLL2.png" alt="" /></p>
<p>If you are not in debug mode or you are in design mode, you will get a warning as follows.</p>
<p>&#8220;<em>The expression cannot be evaluated while in design mode.</em>&#8221;</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/How_to_find_PublicKeyToken_of_a_DLL.png" alt="" /></p>
<p>You can always check the entire details of DLL by giving the following command.</p>
<p>[csharp]<br />
?System.Reflection.Assembly.LoadFile(@&quot;C:\SVenu\TestApp\TestApp\bin\CellSetGrid2.dll&quot;)<br />
[/csharp]</p>
<p>Then you can see output in the immediate window as follows.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/How_to_find_PublicKeyToken_of_a_DLL3.png" alt="" /></p>
<p><em>Please be noted that the output given here will be different according to your DLL</em></p>
<p><strong>Conclusion</strong></p>
<p>That is all. I hope you liked this article. Please share me your feedback.</p>
<p>Kindest Regards<br />
<a href="http://sibeeshpassion.com/" target="_blank" rel="noopener">Sibeesh Venu</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/how-to-find-publickeytoken-of-a-dll/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
