Author Archives: unwrapdotnet

Checklist of Points While Migrating Existing Applications to ASP.Net

Checklist of points while migrating existing applications to ASP Net

In 2016, Microsoft redesigned the core architecture of ASP.NET to meet the emerging trends in web application development. It released ASP.NET Core as an open source and cross-platform framework for developing web application, web services, and cloud-based applications. Hence, you can use ASP.NET Core as an open source framework to curtail web development cost significantly. Also, you can run the ASP.NET Core applications in three distinct platforms – Windows, Linux and MacOS. You even have option to deploy the applications in a number of ways.

Microsoft further allows you to migrate your existing applications to ASP.NET Core. While migrating to the redesigned version of ASP.NET, you have to follow the multiple step process recommended by Microsoft. Also, you can use Visual Studio 2017 to upgrade your existing applications to ASP.NET Core. But you must remember that ASP.NET Core is comes with a myriad of new features and enhancements. Hence, it becomes essential to prepare a checklist of points to upgrade the existing applications to ASP.NET Core smoothly.

Checklist of Key Points for Upgrading Existing Applications to ASP.NET Core

Unified Programming Model

ASP.NET Development allows you to create both web applications and web APIs using a single framework – ASP.NET Core MVC. In addition to supporting model-view-controller (MVC) programming paradigm, ASP.NET Core MVC also comes with several robust features like routing, filters, dependency injection, web APIs, tag helpers, Razor view engine, and model binding and validation. You must understand the important features of ASP.NET Core MVC, and follow specific steps to upgrade your existing ASP.NET MVC applications properly.

Deployment Options

In addition to supporting three major platforms, ASP.NET Core allows you to host and deploy the applications in a number of ways. You still have option to publish the applications to IIS. But ASP.NET Core enables you to publish the applications as self-contained apps containing all resources required to run seamlessly on multiple platform runtimes. At the same time, you can even deploy the application in the cloud, and choose from popular cloud platforms like Microsoft Azure and Amazon Web Services (AWS). Hence, you must decide the right deployment option to run the application smoothly and make it deliver richer user experience.

Targeted Framework

Unlike ASP.NET, ASP.NET Core supports three major operating systems. But ASP.NET is a mature and popular web framework. While developing cross-platform web applications, you have to target .NET Core instead of .NET Framework. You still have option to create Windows-based web applications by targeting .NET Framework. Hence, you have option to choose from two targeted frameworks – .NET Framework and .NET Core – while using ASP.NET Core. But .NET Core does not support some of the legacy APIs provided by .NET Framework. Hence, you must check the compatibility of the APIs used by your existing application with .NET Core and ASP.NET Core.

Web Server

As mentioned earlier, ASP.NET Core allows you to choose from multiple deployment options. It even allows you to choose from several web servers. You can deploy the Windows-based applications on a cross-platform and lightweight web server like Kestrel. Likewise, you can also deploy the applications on WebListener which supports both .NET Framework and .NET Core. However, each web server has its own pros and cons. For instance, Kestrel does not support multi-port binding, whereas WebListener does not require you to use a reverse proxy server. That is why; you must choose the right web server before migrating the existing applications to ASP.NET Core.

Integrated Development Environment (IDE)

While migrating to ASP.NET Core, you can take advantage of a robust IDE like Visual Studio 2017. The latest version of Visual Studio is cross-platform. But it was originally developed for Windows platform. Hence, you have to look for alternatives while using platforms like MacOS or Linux. You can always accelerate cross-platform ASP.NET Core application development by opting for Visual Studio Code. You have option to download specific edition of Visual Studio Code according to your targeted platform. Also, the IDE is designed with features to deliver optimal coding and debugging experience across Windows, Linux, and MacOS.

Multi Step Migration Process

Microsoft requires you to follow multi step migration process to port the existing applications to ASP.NET Core. You must understand the migration process clearly to understand the changes included in the revamped version of ASP.NET. Also, you need to understand the right way to migrate identity and authentication. At the same time, you also need to follow the process exactly to migrate various HTTP modules to HTTP middleware. You must spend some time to learn the migration process to upgrade your existing applications to ASP.NET Core in a faster and more efficient way.

Tools to Analyze Application Portability

As mentioned earlier ASP.NET Core is completely different from ASP.NET. It does not support several language features and APIs provided by ASP.NET. Hence, you must assess the portability of the existing application using .NET Portability Analyzer. You have option to choose from three distinct editions of .NET Portability Analyzer – Console Application, Visual Studio Extension and .NET Core Application. As a command-line interface (CLI) based tool, the Console Application enables you to assess application portability on Windows using command shells.

At the same time, Visual Studio Extension enables you to evaluate application portability using the robust IDE. But .NET Core Application, unlike other editions, supports three major platforms. It further targets .NET Core instead of .NET Framework. .NET Core Application determines the portability of the application to a specific platform by analyzing the assemblies stored in various folders. It further determines application portability by sending the required information to a web service – .NET Portability Service. You must determine the portability of your existing application to a particular platform before starting the migration process.

However, you must remember that Microsoft has been updating ASP.NET Core to meet the emerging trends in web development. The company recently released beta preview versions of ASP.NET Core 2.0. ASP.NET Core 2.0 will come with new project templates, server constraint configuration options, and option to set the maximum number of HTTP/HTTPS requests for the application. Hence, you must keep in mind the features provided by both current and upcoming versions of ASP.NET Core while migrating the existing applications.

Advertisements

What is difference between ROW_NUMBER() , RANK() and DENSE_RANK()?

All of these three functions are used to calculate RowID for the result set returned from a query but in slightly different way.

Row_Number(): This function will assign a unique id to each row returned from the query.

Consider following Query

DECLARE @Table TABLE (

Col_Value varchar(2)

)

INSERT INTO @Table (Col_Value)

VALUES (‘a’),(‘a’),(‘a’),(‘b’),(‘b’),(‘c’),(‘c’);

 

SELECT

Col_Value,

ROW_NUMBER() OVER (ORDER BY Col_Value) AS ‘RowID’

FROM

@Table;

After executing it we will get

Col_Value RowID
A 1
A 2
A 3
B 4
B 5
C 6
C 7

As we notice, each and every row has a unique ID.

Rank(): This function will assign a unique number to each distinct row, But it leaves gap between the groups. Let me explain with a query, we will use the same query we used above with Rank().

SELECT

Col_Value,

Rank() OVER (ORDER BY Col_Value) AS ‘RowID’

FROM

@Table;

This query will return

Col_Value RowID
a 1
a 1
a 1
b 4
b 4
c 6
c 6

As we can see rowid is unique for each distinct value, but with gap. What is this Gap?

This Gap represents number of occurrence. For example: – value ‘a’ is repeated thrice and has rank ‘1’ the next rank will be 1+3=4. Same with the next value 4+2=6 and so on.

Dense_Rank(): This function is similar to Rank with only difference, this will not leave gaps between groups.

So if we use same query used for Rank then:-

SELECT

Col_Value,

DENSE_RANK() OVER (ORDER BY Col_Value) AS ‘RowID’

FROM

@Table;

We will get

Col_Value RowID
a 1
a 1
a 1
b 2
b 2
c 3
c 3

So it is clear that, it generates unique id for each group and without repetition.

As we are clear now what these functions do we can use them in different scenarios based on our need.

For Example: – Row_Number() can be used if we want to skip and fetch some records. Take a look on this query:-

WITH AllRecords

AS (

SELECT

Col_Value,

ROW_NUMBER() OVER (ORDER BY Col_Value) AS ‘RowID’

FROM

@Table)

SELECT

Col_Value,

RowID

FROM

AllRecords

WHERE

RowID >= 4

AND RowID <= 5;

This will retun only those rows with RowID  4 and 5. This function is very useful in paging data in SQL instead of in code till SQL SERVER 2012.  In SQL Server 2012 Microsoft introduces new feature Offset Fetch similar to what we did in above query.

 

In SQL Server 2012 above query will be written as

SELECT

Col_Value

FROM

@Table

ORDER BY

Col_Value OFFSET 3 ROWS FETCH NEXT 2 ROWS ONLY;

This will skip first 3 rows and will fetch next 2.

Similarly We can use Dense_Rank() when we need to calculate rowid with Select Distinct.

SELECT

DISTINCT

Col_Value,

DENSE_RANK() OVER (ORDER BY Col_Value) AS ‘RowID’

FROM

@Table;

Will return:-

Col_Value RowID
a 1
b 2
c 3

Or when we need a report where ranks clashes. For example:- two students scored same marks and shares same division.

We can use Rank() if we don’t want consecutive numbers.

Hope this article helped you.

How to set formats into excel file from C# code

We will set “Font” , “Currency”, “Date” and “Percentage” formate into Excel from C# .
For creating excel, we will use “Microsoft.Office.Interop.Excel” dll .

Read the rest of this entry

Time to get familiar with crystal reports!!

So, Here is the reporting tool your client and you looking for “Crystal reports”. It contains built in features that allow users to design reports easily. These features include templates, ready-to-use data drivers, and flexible charting capabilities.

You can browse through data, sort it, filter it, apply custom groupings and explore the generated reports, and share the reports through the internet or through a secure server, can access data from most widely-used databases and can integrate data from multiple databases within one report using Open Database Connectivity ( ODBC ) and much more.

Those are just some of my reasons. One thing though – That its not the complicated tool but the people who complicates it. So if you know how to exploit it then it will unlock a world in which you can only
astonish and say to yourself, “why didn’t I do this before?”

Read the rest of this entry

How I applied Bundling in my application

While trying to optimize my old asp.net application, I found that lot of java script files and css files are affecting the performance of my web applications.To optimize the performance of an application I found that bundling and minification can significantly improve the performance. It can be applied on MVC as well as in ASP.NET web forms. So I decided to take a hand on this. Before applying bundling and minification, it is good to understand the basic logic behind this.

Read the rest of this entry

Basics of OOPS Concept in JavaScript

Javascript is one of the most popular programming language that is used to create interactive effects with web browsers. Like .net, java, php, c++ etc javascript is also a Object Oriented Programming Language but it does not supports OOPS in same way as all other languages does.
For eg. In javascript there is no classes but there’s a way in javascript through which we use classes concept.

Read the rest of this entry

Highlights of Web Services

A world of web, where an organization provide its services like health care, banking, financial etc over the internet to end users.

To grow up business, organizations want to provide their services to more and more end users in simple ways.

So organizations use web app, mobile app, ipad app etc so that one can use their services easily and quickly.

This is where web services comes into picture. Communicating amongst all these entities (web app, mobile app, ipad app etc) without affecting their existence is made possible by web services.

Read the rest of this entry

Basic points to be considered when starting with SQL Server – – Part 4

Hello Friends, Yesterday I was fetching some records from table and Then I thought about ‘*’.

Is asterisk is our friend or enemy ?

Read the rest of this entry

ASP.NET Web API — Part 1

Hello All,

For Asp.net Web API, I am going to write a series of technical articles. Few of them will cover conceptual point, few will cover demos and in few of them, I will try to dig deep into it by covering important technical point like routing, hosting, security stuff.

So in this series of articles, Lets start with light node, what is ASP.NET Web API and why we should go for it.

Read the rest of this entry

Reflection

Hi, just thought to share little knowledge on reflection with you all, as per being a developer, I was very curious to find how visual studio is giving intellisence, that took me to learn reflection and I found its really good to know about it.so I will start with using a pattern, in this way you will get to know about two things. 🙂

Reflection and Abstract Factory pattern.
Read the rest of this entry

%d bloggers like this: