Wednesday, March 29, 2017

New Features–Out Variables in C# 7.0

Prior to C# 7.0,  For out keyword, we need to define that variable earlier and then we were able to pass that variable as out reference arguments. But now with C# 7.0, You don’t need to declare the variable but you can use the variable which you have used in arguments.

Following is a code showing both ways passing out variables.

In the above code, You can see that I have created get employee static method which put some values in this out variables. First I have shown the old way of doing this. Where I explicitly defined the variables and then passed it to function while in the new way of doing you don’t need to explicitly define variable. You can write this as an argument and then, later on, you can use the same variable in next statements.  Now when you run the application, the new and old way both produce the same output.


csharp7-out-varibles-example

You can find complete source code of this examples at following location on Github at- https://github.com/dotnetjalps/CSharp7NewFeatures
Share:

Visual Studio 2017 New Features Series

Visual Studio 2017 is recently launched by Microsoft and it is one of great IDE I have ever seen. It contains lots of features and this blog post contains the link to all features post that I have written for Visual Studio 2017.

A new start page for Visual Studio 2017
Code Navigation features in Visual Studio 2017 



Share:

Code Navigation features in Visual Studio 2017

This blog post is a part of Visual Studio 2017 New feature Series

TL;DR:

With Visual Studio 2017 there are lots of new Code Navigation features introduced. We are going to look all the options available in Visual Studio 2017.

Navigation your code with Visual studio 2017:

Visual Studio 2017 have newly refreshed code navigation features which help you moving from point A to B easily and fewer distractions. There are mainly four new features available.

Go to Implementation(Ctrl+F12):

It helps you navigate from any base type to implementation of the concrete type.

GotoImplementation

Go To Line(Ctrl+G):

It helps moves cursor from current line to specified line number.

go-to-line-visual-studio-2017

Go To All(Ctrl+T):

It helps you navigate directly to any file/type/symbol/member. You can move from any files to anywhere with this feature easily.

go-to-all-visual-studio-2017

Go To File(Ctrl+ 1, Ctrl + F):

You can easily navigate between files with this feature.

go-to-file-visual-studio-2017

Go To Type(Ctrl+1, Ctrl + F):

You can move to any type with this feature. It searches classes/interfaces/enums and delegates and moves your current cursor selected type.

go-to-type-visual-studio-2017

Go To Member(Ctrl+ 1, Ctrl + M):

You can move between members for a particular class. It searches Global Variables and Global Functions, Class Member variables and member functions, Constants, Enum items, Properties, and events.

go-to-member-visual-studio-2017

Go to Symbol(Ctrl + 1, Ctrl + S):

You can move to any symbols, search result includes Go to Type and Go to Member.

go-to-symbol-visual-studio-2017

Find All References(Shift + F12):

In the earlier version of Visual Studio Find All References was the plain list without any syntax highlighting and coloring. Now with Visual Studio 2017 it has got coloring and splits all the information into their respective columns. This column can be also customized so you will only see what you want to see in Find All References Window.

find-all-references-visual-studio-2017

So Visual Studio 2017 now got lots of features and that will make code navigation very easy. It will definitely increase developer productivity and made life easy.
Share:
Tuesday, March 28, 2017

A new start page for Visual Studio 2017

This blog post is a part of Visual Studio 2017 New feature Series
Recently Microsoft has released a new version of Visual Studio 2017 and as usual, there are tons of features available with Visual Studio 2017. Visual Studio has always been one of my favorite IDE. We are going to look into all the features one by one. The first thing when you launch a New instance of the Visual studio will launch a start page. So in this blog post, we are going to explore what’s new in start page of Visual Studio 2017.

A new start page for visual studio 2017

The first thing once you load visual studio 2017 will have a start page. It has been divided into three columns. The first column contains Get Started and Recent sections. The second column contains Open Project and New Project section and the third column contains Developer new section. By default when you load Visual Studio it looks like following.

visual-studio-2017-start-page-default

Get Started and Recent Section of Start Page:
Get Started section of Visual Studio 2017 contains how you can get started with Visual Studio. It contains a variety of links including how to get started with Visual studio to how to extend visual studio.

get-started-section-with-visual-studio-2017

The recent section contains recently open projects. It is divided into two part Today and Last week. Today section contains the link to the project that is opened today in Visual Studio.  Last week section contains projects that are used during last week.

Open and New Project Section:
The open section contains four things.
  1. A link to connect Visual Studio team services from where you can directly connect to a team services project and open it from there.
  2. Open Project/Solution: - Open project or solution works in same as the earlier version of Visual Studio. It open project or solution available on your computer.
  3. Open Folder: - It will open a folder available on your computer and then display all the code files available in that particular folder.
  4. Open Web Site: This works same as earlier of Visual Studio. It opens an ASP.NET Web Sites available on your local computer.
open-project-visual-studio-2017

New Project is brand new in Visual Studio 2017. By default, it shows the recent project's templates you recently used and also there is search box to search the templates available in Visual studio 2017.
new-project-in-start-page-visual-studio-2017

Even you search templates via putting some text in the search box like following.
new-project-in-start-page-visual-studio-2017

So now to create a new solution or project you don’t have go to file menu. You can directly create a new project from start page itself.

Developer News Section:
This developer new section contains new feeds from various sites.

developer-new-section-in-start-page-visual-studio-2017

Customize Start page in Visual Studio 2017:

Like earlier edition of Visual Studio, you can also customize the start page of Visual Studio 2017. There is an option available for the same under Tools-> Options menu. Select environment and Goto Startup following dialog will come.

customize-start-page-visual-studio-2017


Here you configure options like At startup what should be shown. You can also setup time to download the content of developer news. Also, you can also use customize start page.

That’s it. Hope you like it. Stay tuned for more!!.
Share:
Monday, March 27, 2017

New Blog theme- new technologies

This blog has been quite for the some time. I was busy doing some professional commitments but now I decided to write blog post regularly. As there are lots of interesting stuff happening in technology world. There are tons of new technologies coming up and lots of new things to learn.

New blogger theme:

Recently blogger.com has launched few new theme and I also decided to have new blogger theme on my blog. I have used “Contempo” theme for my blog. This time I have done some experiments I have not changed anything except the background feature. Let’s see how it goes with SEO and other stuff.  Here is new look of my blog.

image

Hope you will like it.

New Technologies to blog :

There are lots of stuff happening in technology and I started learning those technologies and I’m going to share my learning experience with you guys for sure. So do except blog post on following topics.
  1. Visual Studio 2017
  2. ASP.NET Core 1.1
  3. C# 7.0
  4. Entity Framework Core
  5. .NET Core cross platform
  6. Docker
  7. Node.js
  8. Golang
  9. SQL Server 2016
  10. MongoDB
  11. Azure and Different Azure services
  12. Angular 2/4.
  13. React
  14. Vue.js
I outlines few of technologies there but still there are lots of happening so Please put your comments that what technologies I should learn and blog about.

As always, Again thank you very much for the your support and love. Without your support this blog would have not have been exist. Thanks all as always.

Happy blogging and journey continues.
Share:

A Review of Stellar Phoenix SQL Database Repair

SQL Server is a database server developed by Microsoft, the primary function of which is to store and retrieve data in the database MDF and NDF files. It retrieves data as requested by several software applications running on same or different computer across a network. Plus, it has a lot of concurrent users. Aimed at various enterprise segments, it caters to different workloads ranging from a small single-machine to large Internet-facing applications.

Although data on it is stored in a safe and secure manner, yet there are instances when it’s MDF and NDF files get damaged or turns inaccessible due to one or more reasons. Moreover, this happens irrespective of the SQL Server versions that can be 2016, 2014, 2012, 2008, etc. When they get damaged, they come up with several and unique error messages. Such a situation restricts you from accessing the stored data of the database. This creates the necessity for using a third-party software that can repair both these files and extract the complete data out of it. Here, Stellar Phoenix SQL Database Repair would serve the purpose. Let’s look at how.

Developed and marketed by Stellar Data Recovery, Stellar Phoenix SQL Database Repair is a software the purpose of which is to repair the damaged or corrupt MDF and NDF files of Microsoft SQL Server and save all the extracted data in multiple formats such as MS SQL, HTML, XLS and CSV. Here, we present to you a review on this product for you to get in-depth details about it. With this, you can check whether the software achieves your purpose of perfectly repairing the database files and recovering the entire data; and, that whether you can use it in case the primary MDF and secondary NDF files of the SQL Server database gets damaged or turns corrupt.

First, it is imperative to acquaint with its salient features as well as benefits. Let us look at the features and benefits embedded in the software.

Features & Benefits:


· It can repair the damaged or corrupt MDF and NDF files of your SQL Server database.
· It can search for MDF files on the PC and repairs it successfully.
· It can retrieve almost all the database components ranging from Tables, Triggers, Views, Rules, Keys, Indexes, to Defaults.
Note - The Keys that can be recovered are Primary Keys, Unique Keys, Foreign Keys, and Identity, while the Indexes that can be recovered are both Clustered as well as Non-clustered indexes.
· It can recover both ROW and PAGE compressed data of the SQL Server database files.
· It has an exceedingly fast Scan feature with which you can scan the damaged MDF and NDF files.
Note - With this, you can identify and fix the issues quickly and recover all the data objects without fail.
· It allows you to preview the objects that can be retrieved and appear as a scan result after the end of the scanning process.
· It connects to the server automatically when interrupted for completing the repair process and restoring the data.
· It can even recover the Deleted records by using the remarkable feature embedded in the software.
· It offers you the option to move and save database files to Live SQL Database after the repair process gets over.
· It gives you the option to save the fixed database files in multiple formats such as CSV, XLS, and HTML in addition to MS SQL.
· It supports the latest released version i.e. MS SQL Server 2016 in addition to lower releases such as MS SQL Server 2014, 2012, 2008, and all others.

Now, to be able to execute these features and avail the benefits of this software when you have a damaged or corrupt MS SQL Server, your system must fulfil minimum system requirements, which are as follows

· The system must be embed with Pentium Class processor only.
· The supported operating system are Windows 10, 8, 8.1, 7, Vista, and XP as well as Windows Server 2008/2003.
· The system must possess a minimum of 1 GB memory; however, the recommended size is 2 GB.
Lastly, the free space in the system hard drive should be at least 50 MB to get the software installed correctly.

Note - These system specifications are easy to achieve and almost all Windows systems possess these minimum system specifications by default.

Working:

The working of the software is described here and takes you through the steps to repair the corrupted MDF & NDF files of MS SQL Server.

Select, Repair, and Save are the three most important steps that you need to carry out with this software to successfully repair the damaged SQL database files.

· Select – As displayed in the image below, with the ‘Select Database’ option that is present in the interface of the tool; you need to select the damaged database file from any location in your system. However, if you do not know the same, you must use the ‘Search in Folder’ and ‘Find’ tab to search and find all the database files. If you want to locate the file in subfolders as well, you must mark the option ‘Search in subfolders.’ Further, to scan for and recover the deleted records, you must check the ‘Include deleted record’ option.

image

· Repair – Once you have selected the database MDF file, you must click on the ‘Repair’ button to scan the MDF file. With this, you get a list of all the recoverable objects as shown in the image below. Further, you can select the ones for which you require a preview.

image

· Save – Finally, there is a message that the selected SQL database file has been successfully repaired, and the software prompts to click on the OK tab to save the file in a new database. This is the third and last step that you have to follow with the software. When you do this, you get options to save the file in MS SQL, HTML, CSV, and XLS that you can select as per your choice. Next, it gives you the option to save in ‘New database’ and ‘Live database’, and again you can choose as per your requirement. Finally, the retrieved objects of the SQL Server database file get saved. The images below display the ‘Saving’ step.

User have four options to save the database.
· MSSQL
· CSV
· HTML
· XLS

image

After selecting MSSQL, two options are there
· New Database
· Live Database

image

image

Choose any options from these two and save the database.

image

Conclusion:

Now you know the features, system requirements, and working of the Stellar Phoenix SQL Database Repair software, you can analyze the tool and check whether it meets the purpose. A better way to try this utility is to download its demo version. You can then register the software if you find it satisfactory. Given its efficiency in repairing the SQL database file with precision and speed, I would give it an 8.5 on 10.
Share:
Saturday, January 28, 2017

How to upgrade your ASP.NET Core application from 1.0 to 1.1

TL;DR;

In this blog, We are going to learn how we can upgrade your ASP.NET Core application from 1.0 to 1.1.  Now Microsoft has release 1.1 before few months, So in this blog, we will see how you can upgrade your ASP.NET 1.0 application to ASP.NET 1.1 core application.

Where to download 1.1 SDK and Tooling for Visual Studio 2015:

You can download 1.1 SDK and Tools from the following link.

https://www.microsoft.com/net/download/core?tduid=(42c8fb30096a508e70a0e7f0d6bdaf55)(256380)(2459594)(TnL5HPStwNw-1.6L2HANlqPr5.uZiHJ1MQ)()#/current

where-to-download-tooling-and-sdk-for-core1.1

Here different tooling is also available for the Visual Studio 2015 and Visual Studio 2017. For this blog post, We are going to use Visual Studio 2015.

How to upgrade to ASP.NET core 1.0 to ASP.NET core 1.1:

So let’s get started. I’m going to create a new ASP.NET Core 1.1 application and then we will move it to ASP.NET 1.1. So let’s create an ASP.NET core 1.0 application and then let’s upgrade it to 1.1. I have created a new application like following.

creating-new-aspnet-core-app-to-upgrade-to-11

Once you click ok it will have a dialog selecting application type and I’m going to select web application.

web-application-aspnet-core-11

Once you click Ok, It will create an application like below and you can see that it’s an ASP.NET Core 1.0 application.

aspnet-core-1.0-app-in-solution-explorer

And here’s how it’s project.json looks like.
{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

And here’s how the global.JSON looks like.
{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}
So the first thing we need to is to upgrade the global.json to latest version like below.
{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-1-003177"
  }
}


So here in project.json, you can see that all packages belong to 1.0. Now there is multiple ways we can do upgrade either we can manually upgrade all packages via manually upgrading it or we can do it with Visual Studio tooling. I’m going to use Visual Studio tooling as that is the easiest way to do it. You can do this via Right Click your application and Select “Manage Nuget Packages for this solution”. It will load the following dialog. You need to goto Update tab of that dialog.

upgrade-nuget-package-to-1.1

You need to select upgrade all packages and update your application. Once you did with that there is once place where you need to manually upgrade it in project.json. GoTo following part of project.json.
"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dotnet5.6",
      "portable-net45+win8"
    ]
  }
},
Now upgrade netcoreapp1.0 to 1.1 like below.
"frameworks": {
  "netcoreapp1.1": {
    "imports": [
      "dotnet5.6",
      "portable-net45+win8"
    ]
  }
},
Now once you do that and build your application. You might get the error like following.

error-for-runtime-application-net-core

That is because of windows runtime is not there for 1.1. So you need to add following in project.json.
"runtimes": {
  "win10-x64": {}
},
Now once you add that in project.json. It will restore the runtime for your operating system and it will start building your application.
And here’s how my project.json looks like after upgrading all stuff.
{
  "dependencies": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.NETCore.App": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },


  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "runtimes": {
    "win10-x64": {}
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

And in solution explorer, you can see that now it’s targeting to 1.1.

targeting-11-upgrade-to-11-solutionexplorer

That’s it. It’s pretty easy to upgrade your application to latest build. Hope you like it. Stay tuned for more!!
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews