In this section, I’ll introduce you with one of my favorite tools i.e. Linqpad. you can download the same from https://www.linqpad.net/. This is extensive tool for .NET programmers. LINQPAD is The .NET Programmer’s Playground. Here, you can do bunch of stuffs like executing LINQ query against SQL, Azure, XML, any object or against any other database. You can add your SQL connection like shown below.
As you can see in the below screen shot, I have simply pulled the movies from my movie review db.
Then, If i have to see the relationship between the tables, then i can simply go ahead and click on the highlighted link shown in the table above. Like in this case, when i clicked on “MovieReviews”, it produced the below result.
Behind the scenes it also generated the actual SQL statement as shown below in the screen shot.
You can also execute SQL statement as shown below in the screen shot. only thing you need to change here is the language from the dropdown.
In this section, we’ll talk about WEB API Management. Now, from the high level, it’s look very much like Managing WEB API. Here, we need to talk about two things.
1) You build a Web API and decide to do business with that means you want to sell that API, already bunch of people doing the same. Like you want to sell services like messaging service, phone call service may be anything. So, you will monetize that.
2) Scenario 2nd is you will be indirectly monetizing the APIs means you will be doing business indirectly. Fine example for the same is; you partner with some business and they get access to your service. Basically, it will help other companies for the integrated experience.
So, once you decided that you are going to experience one of these scenarios. Then, WEB API Management is best for you. Out of the box, it also helps to keep documentation side by side. Consider a scenario if you have given tons of API without documentation; this will be worst scenario to handle. So, from a developer perspective if you are writing any API and you want to put the documentation then and there. Then, WEB API management is again a good choice.
One more scenario which I would like to emphasis here, let’s suppose you want to launch marketing Campaign and you don’t have analytics embedded with API; then you can’t even think of doing that. However, with Website you can do the same exclusively by incorporating google analytics and other stuffs. But, if you are writing any API from scratch then you need to think of key management, access, analytics in the backend and other important things. But, with turnkey service API Management all these things will go away. So, I can have any WEB API hosted anywhere on any service provider; but Azure WEB API Management will sit in front of that. So, as you see below in the screen shot, developers develop/write APIs that calls their APIs via Azure proxy. And this is where all magic happens, like analytics and other much needed behavior for WEB API done here.
Now, from Azure portal you can create WEB API management as shown below in the screen shot.
Once, the API management, portal created, you can go ahead and click on Manage link. This will open new dashboard for API Management as shown below in the screen shot.
Now, here you can do all sort of things like adding new API or importing an existing API and set bunch of rules here on the same and then monitor the same on timely basis.
Then, you can add operations to it like shown below with documentation to that.
Once, it got added successfully, then you it will bring you back to the orignal screen as shown below with API added.
Next thing i need to do is to add the same in the products. Now, this is the place where you can change the behavior or apply policies. Here, you will add your APIs to the product. Below is the screen shots for the same.
Now, once i added the API to the products page. I need to publish the same as well.
Once done, then i will click on developer portal link; then this will open developer’s dashboard for the same. So, as i said there are two things publisher and Developers. We have published our API 1st and now its available for developer’s portal.
Now, when you click on APIs link, it will list your newly added API.
Now, below you can see variety of options to call the API means from different backend. One point to note here; in order to make a request you need to have a valid subscription id else this will result 401 error message as shown below
However, you can achieve the same from the azure window itself.
In this segment we’ll talk about creating mobile service in the cloud and then using the same in our App. During the course we’ll use bunch of different kinds of technologies. We’ll talk about these technologies individually once we progress along the path. So, without wasting time 1st let’s go ahead and create Mobile service in Azure. As you can see I’m in the Azure portal
where in currently i am not having any mobile service created. I’ll go ahead and create this link as shown below and create new mobile service.
Now, let’s go ahead and explore the service. So, here a framework has been installed on the IIS server hosted on windows azure which connects to the backend server. This provided REST based endpoints which means by using this REST endpoint we can perform some operation. As you can see below in the screen shot, our service is created and with manage keys option i can go ahead and off-course and associate key with this service.
Now, let’s have a look at the dashboard for the service. This is essentially a very usual dashboard we have used earlier with Azure.
we’ll be exploring more this dashboard later. But, for now let’s look at the DB section which is also created with this service.
Now, let’s look at the dashboard of the db server. Here, you can get all the performance related parameters and also connection string for connecting to the database.
Now, let’s open SQL Server management studio and connect to the database what we created in Azure. However, while connecting to the azure portal via SSMS; firewall may obstruct connection to happen as shown below.
In order to fix the same, you can go back to the azure portal click on manage server and include your IP in the trusted IP List.
Once that is done, you can go ahead and login via SSMS as shown below
As you can see below in the screen shot, currently no table is created here.
you can also login online SSL management portal.
Now, let’s go to mobile service dashboard and click on windows project as shown below and then download the starter app.
With this i would like to wrap this session. In the next session, we’ll explore the app which we have downloaded from Azure and will do some really cool stuff with that. Till then stay tuned and Happy Coding.
In today’s discussion, we’ll delve further to some more interesting features on ASP.NET 5. So, lets begin the show. Now, Let’s talk about the different CLR Types available with this project. So, when i talk about different CLRs; There are actually 2 versions of CLRs. 1st one is the usual one which has the full blown version of CLR which we have been using since it’s inception. Another one is the minimized version or also known as cloud optimized version of CLR. Now, let’s go ahead and check project settings.
As you can see in the above screen shot; my default setting is against full blown CLR which is running on the X86 machine. Now, if you see the drop down shown below. you will notice that i also have the option for cloud optimized version.
Now, let’s change the environment to cloud version and then run the app and inspect the output of the greet controller which we created in previous section. It should print my name there.
Now, let’s go ahead and debug this controller. So, now when i refresh the page it will hit the breakpoint as shown below.
Here, when I go in the modules section as shown below in the screen shot. It will list the complete flow. So, here you can see from where all the binaries loading. Basically modules are nothing but have one to one mapping with assemblies.But, you can also have multiple module per assembly. Now, this module window is showing me what all modules are loaded in the application.
Now, one point to note here that all these modules are coming from one location that is from user’s location as highlighted above. Let’s jump to this location for a minute and inspect the same.
Now, when I go inside there; i can see that there is nuget package file or NUPKG file which is around 14 MB.
This is complete Core CLR. Can you imagine. Now, what i can do is i can simply take this file and copy to different system my .NET Core version is ready. This bin directory here is the extracted version of this nuget package as shown in the below screen shot.
Also, when you go to the runtime folder and go to full blown CLR folder as shown below.
You will notice that size of the NUPKG file is very less compared to Core CLR version. Confused?
In case of full blown CLR, all components get loaded from GAC (Global Assembly Cache) not from here. But, it doesn’t mean that there is no centralized repository for Core CLR. So, if you go to below location; you will find packages folder.
So, now this will be the centralized repository for your Core CLR.
So, whenever, we install any dependencies it will sit here in this packages folder. So, ASP.NET 5 completely embraces nuget package. We manage dependencies via nuget package. We can have CLR stored through nuget package. Hence, these packages folder are referred as Global Package Cache.
Now, project.json is not only used to have the nuget dependencies only. we can have different project dependencies also listed here within the same solution. For example, let’s go ahead and add class library project to the solution folder. Make sure you install Vnext version of class library which means this class library project can have all the flexibilities of dynamic compilation what we have been using so far.
Once you added the project. Your solution will look like shown below. So, even the new project gets added under the src folder.
You will also notice that this new class library project also added new project.json file which also lists the dependencies accordingly for running Class library project.
Now, if i have to use this project in my web project; then i just need to include this newly created project in the dependencies section of project.json file of web project as shown below.
Now, when you don’t provide the version name against the package or project it will pull the latest one. Let’s go ahead and create some method in the class library project to return some meaningful thing.
Let’s use the same in Greet controller.
With this i will wrap this session. In the next section we’ll delve further into new features of ASP.NET 5. Till then stay tuned and Happy Coding.
In this section, i will demonstrate how to publish your ASP.NET APP on Linux VM using Docker extension of Visual Studio 2015. So, before we begin, we must need VS 2015 RC candidate installed on our machine. Then, we do need Docker extension for visual studio installed on our machine. You can install the same from Extension and Updates as shown below in the screen shot.
Then, I need to create new ASP.NET 5 website as shown below in the screen shot.
Once, site got created successfully; then simply rt-click on the website and say Publish as shown below.
Then, It will provide the below options.
Now, if you don’t have any subscription, then you need to create one and provide the details in the next screen. For privacy reason, my details are hidden.
Then, it will give the below confirmation message.
When you say ok here, it will build the app and prepare for hosting. You can check the status of the same in the output window when Azure is provisioning things for you. This process will take some time.
Once, its completed. It will show the confirmation message as shown below.
Now, I will come to and say publish, this time it will come in connections tab with below VM credentials.
Then you can click on validate Connection for confirming every thing is correct. once verified, then you can go ahead and click next and publish the app.
while building the app, you can check the status in the output window.
Once done. It will launch the same in the browser. Also, it launched in my new Project Spartan browser as i’m running on windows 10 machine.
In this section, we’ll delve further in the new ASP.NET 5 project. When you take a closer look at the ASP.NET 5 project, you will see that there are many things which are carry forwarded like Model, View, Controller, clean separation of concerns and may more. But, there are also some significant changes around ASP.NET 5. Now, the root of the website is no longer the root of the project. By default, root will be WWWroot folder. The idea behind this to maintain the clean separation between the files at the web-server retrieved and sent to the client and the files which contains the logic and configuration. Static files like JS, CSS, HTMLs can live in WWWroot folder.
Now, lets suppose when i run the app and tried to see the image which i have placed in My Imgaes folder, then it will give me 404 error.
On the other hand, if i go ahead and add the same folder in WWWroot folder and try to navigate the same then it will produce me the result.
so, the point is all static files are served by root folder and logical stuffs served by project space as we initially saw, when i added controller in the controller’s folder and it took effect. One more thing you might have observed that there is no web.config file now in the solution. Also now there is no Global.asax file; however the same is replaced by startup.cs file. But, we’ll see this later. 1st let’s see project.json file. This file now manages many aspects of website.
First thing which you will notice here that root folder is set to WWWroot here. So, this is the place which is telling website that this is the root folder. So begin the show from here. This you can change as well or rename if you like to. Now, this configuration file is in JSON format. This is also telling the ASP.NET runtime what dependencies project is going to need. In this new ASP.NET 5 system there is a new way to manage dependencies. No need to reference assemblies and store the lists of referenced assemblies in the project file. Instead we refer to nuget packages as dependencies and these dependencies are listed in our project.json file. Now, there are couple of reasons for this change. One reason is to simplify the dependency management. Another good reason for this is that ASP.NET is moving away from VS dependency. So, in future i can use any text editor to build the ASP.NET App.
Now, these dependencies can be both the ways. One way which we used already shown below in the screen shot.
Now, the UI of this also changed. Initially we used to have Modal window. Now, this is more like complete screen giving wider visibility. I can also see the installed templates like
Also, i still have the flexibility of different nuget source.
2nd Option is via project.json file. Let’s suppose i am planning to install some custom package. Then i can do like shown below as well
However, whatever package you install; you can find its references under “References“. Below, in the screen shot you can see that there are two versions of runtime here. 1st one is the core version and 2nd one is the cloud optimized version.
Now, let’s collapse the same and drill into it.
Now, here dependency management system will keep your assemblies in nice tree structure. So, it nicely tells which package are dependent on which package.
Now, as far as Framework and runtime is concerned as you can see below in the screen shot; i have both frameworks listed here.
So, whenever i am building the solution i am building against both of these frameworks. By building against both i am actually ensuring that it will work well against both the frameworks. This also means whenever i am switching platform my code won’t break there.
But, let’s go ahead and break something here. You remember in the last segment i created one new controller with a notepad. Now, let’s modify the same and refresh the app.
so, as you can see that it says that GetCallingAssembly() which is part of System.Reflection is not supported in the cloud optimized version. But, let’s suppose i overlooked this error and refresh the app.So, it actually produced me desired result.
But, when i explicitly build the project and checked the output window, then it gave me below error message.
so, building with error but application is working fine with full blown CLR. Now, if you have decided that you don’t want CORE CLR version. so, you can just comment the Core CLR section in the project.json file as shown below in the screen shot.
Now, as soon as i commented the above section, below references got refreshed automatically.
Now, when i build the app then it will build fine.
But, suppose you want the other way means you would like to keep the cloud optimized version also and build should also succeed. For this scenario i need to refer the conditional build as shown below.
With this i would like to wrap this 2nd session ASP.NET 5 New Features. We will delve further in the coming series. Till then stay tuned ad Happy Coding.
In this section, we’ll see that major changes on ASP.NET 5. The very 1st change is on the lines of Project system. Projects are now based on File System. So, all you need to do is add something to a project say new source code file is just to place the file in the right directory. So, you can edit the source code file, save the file and build just happens dynamically. Thanks to new Roslyn compiler which compiles the source code in memory which allows for faster build and faster refresh.
The project structure itself changed from previous versions. Also one point to note while building application, we’ll be having two different options of choosing runtime. 1st is the full blown runtime as 4.5.1 or greater than that or 2nd option we can have cloud optimized runtime also called core CLR. Here, all the pieces like JIT Compiler, Garbage Collector are packaged and designed keeping high throughput and low memory consumption in mind. And now the application can have this cloud optimized environment embedded with the application which makes it easier to have true side by side version and by embedded it means you can deploy the .net framework by copying the nuget package. So, the idea behind this cloud version of .NET runtime is; it should be platform independent which means it can also run on MAC and LINUX machine.
Another great fact about the new changes in ASP.NET 5 is the unification. So, now
MVC 6 = ASP.NET MVC + WEB API
In MVC 6, WEB API is merged with MVC. This means we will now have one set of controller class, one set of attributes, model binders etc. Also, it no longer relies on the namespace system.web which means it is easy to self host and run the core CLR. Now, with these changes in place it doesn’t mean that your existing projects won’t work in VS 2015; It will work as smooth as it was in earlier versions. Now, lets go ahead and start the demo. I already have RC version of VS 2015 installed on my 2ndry machine. Lets go ahead and create new project
now, the below window is very much familiar to previous version. Here, i am interested in the new templates introduced. Hence, i am going to create a new project with ASP.NET 5 Website. This project will give me all the required components to run an app as shown below in the screen shot.
so, below shown window will be the new window for ASP.NET 5 project.
And when i run the same, it will produce me the below output. Very traditional MVC APP.
One point to also note that now folder organization in the file system and solution explorer is same as you can see in the below screen shots.
This also means whatever changes i do in the file system under src folder it will take effect in VS. Let’s create myImages folder in the file system with one image there. As soon as i added the image in the file system, it gets automatically synced with Solution Explorer.
Now, lets create one controller say GreetController but from the notepad; this is just to prove the point that we don’t need to build the app to take the code changes effect.
Now, after saving the same when i refresh the browser, then it will return me new controller’s output. so, this is called dynamic compilation.
Thanks for joining me for the 1st Edition of ASP.NET 5. We’ll delve further in coming topics. Till then stay tuned and Happy Coding.
I just installed Windows 10 on my 2ndry machine. And to my surprise when I installed the same; I was expecting new Microsoft Browser by default; unfortunately this was not there. But, when I delved around Spartan documentation; I found the trick to enable the same.
Steps to enable Spartan(Microsoft Edge) on Windows 10 preview.
Type this “about:flags” in IE browser. This will open the following set of commands in the browser.
Then, select “Enabled” under “Enable Experimental Web Platform Features,” and restart the browser.
After doing above settings, you need to restart the PC to sync the settings. Once you restart, you will notice project Spartan logo on start screen which you can apply to taskbar as well as shown below.
Here comes project Spartan. Awesome experience doing hands on with Windows 10. Specially Project Spartan.
Thanks for joining me.
1,236 total views, no views today
Subscribe For Latest Updates!
Signup for My View newsletter and get notified when I publish new articles for free!