Sunday, July 19, 2020

Web API : CRUD operation using repository pattern .net framework

In this article I am going to explain how to create Web API CRUD (create, read, update, delete) operation using repository pattern .net framework.

 

In previous I have explained how to create First Web API Hello World application with repository pattern and how to return data in JSON format from ASP.NET Web API.

 

Here in this article I am going to create Web API with CRUD operations for Article with Title, description and tags fields.

Prerequisites

-          -Visual Studio 2019

Tuesday, July 14, 2020

What is DATABASE MASTER KEY in SQL?

In this article I am going to explain What is Database master key (DMK) in SQL.

*DMK = Database Master Key

The database master key is a symmetric key used to protect the private keys of certificates and asymmetric keys that are present in the database. When we created DMK, it is encrypted by using the AES_256 algorithms and a user-supplied password.

Every database can have a separate DMK and each database can have only one DMK. 

Sunday, June 28, 2020

SQL SERVER : OFFSET and FETCH example

In this article I am going to explain OFFSET and FETCH in SQL Server.

OFFSET and FETCH are introduced in SQL Server 2012. These are used with Select and Order By clause to provide the result set.

OFFSET can only be used with Order By clause.  OFFSET specifies the number of rows to be exclude from the query. Before use the OFFSET make sure value must be equal to zero or greater than otherwise it will give error. Values can’t be negative.

FETCH is optional. FETCH specifies the number of rows to return after the OFFSET. Similar to OFFSET, values can’t be negative. Value should be equal to zero or greater than otherwise it will give error.

Friday, June 26, 2020

SQL SERVER : Get Random Records from database table

In this article I am going to explain how to get random records from SQL SERVER database table.

 

When I am working on multiple choice question application, I have got requirement every user have different questions on every test attempt. If I am going to attempt the ASP.NET test, get ASP.NET unique questions from ASP.NET category.

Tuesday, June 9, 2020

SQL SERVER : Store and Retrieve different languages data from Table

Here in this article I am going to explain how we can store and retrieve the different languages (other than English) data from SQL SERVER table.

 

When working on an application get requirement to store the data of other language than English (multilingual) in database. If you have get any such requirement, you can achieve this following two things:

Set Unicode compatible datatype (ntext, nvarchar, nchar) for table column

Use N (capital) as a prefix before inserting data/text

 

Example :

First of all, create a table. I have created table to store admin users name.



Create table tblAdmin (
EnglishName NVARCHAR(100),
HindiName nchar(100),
JapaneseName ntext
)

 

Now insert data into table.

insert into
tblAdmin(EnglishName,HindiName,JapaneseName) values(N'Vijay Saklani', N'विजय सकलानी',N'ビジェイ・サクラニ')

Get the data from table and check the saved data.

Select * from tblAdmin

 

SQL SERVER : Store and Retrieve different languages  data from Table

If you will insert the into table without prefix N, data will not be useful. It will be inserted in question mark (????) form and become garbage. Let’s check with this also:

insert into tblAdmin(EnglishName,HindiName,JapaneseName) values('Vijay Saklani',
'विजय सकलानी','ビジェイ・サクラニ')

 

Check the inserted data now.

 SQL SERVER : Store and Retrieve different languages  data from Table



Tuesday, June 2, 2020

[Error Solved]: @angular/material/index.d.ts' is not a module

Here in this article I am going to explain how to resolve the @angular/material/index.d.ts' is not a module error.

 

After upgraded currently working Angular application to Angular 9 and Angular Material 9, I get the error :

@angular/material/index.d.ts' is not a module

 

Now the question arise why this error comes and how to fix this error.

 

Reason:

Wednesday, May 27, 2020

How to add Material in Angular project

In this article I am going to explain how to add Material in Angular project.

 Angular material is an UI component library.  It is an alternative to bootstrap for Angular application. It provides modern UI components that work across mobile, web and desktop. It is Versatile, Fast and Consistent. You can read more about material component from its website : https://material.angular.io/


Prerequisite :

Visual studio code

Saturday, May 23, 2020

Angular CLI commands

In this article I am going explain the all Angular CLI commands.

 The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications. You can use the tool directly in a command shell, or indirectly through an interactive UI such as Angular Console.

Follow the below given command as per your requirement :

Friday, May 15, 2020

SQL SERVER : Store Multilingual (Hindi, Japanese etc.) data in Table

Here in this article I am going to explain how we can store the multilingual (Hindi, Japanese etc.)  data in SQL SERVER table.

 When working on an application get requirement to store the data of other language than English (multilingual) in database. If you have get any such requirement, you can achieve this following two things:

Saturday, April 25, 2020

Routing in ASP.NET Web API


Here in this article I am going to explain Routing in ASP.NET Web API.


What is Routing?
Routing is a mechanism that handle the incoming request from browser and figure out what to do with that request.

If you are familiar with MVC, you are happy to know Web API routing is very similar to MVC routing. In ASP.NET Web API, controller handles the HTTP requests and call the action method of controller.

Thursday, April 16, 2020

ASP.NET Web API : Return data in JSON format


In this article I am going to explain how to return data in JSON format from ASP.NET Web API.


As you know ASP.NET Web API by default return the data in XML format when we run the API in browsers. Here, we are going to learn to change the return data/response to JSON.
You can achieve this from WebApiConfig.cs file. You can find this file under App_Start folder. Firstly, add the namespace to config file
using System.Net.Http.Headers;
 and add the below given code in this file:
 config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));

Complete code of WebApiConfig.cs

Monday, April 6, 2020

Create First Web API Hello World application with repository pattern


In this I am going to explain how to create First Web API Hello World application with repository pattern.

In previous article I have explained Introduction to ASP.NET Web API.

I am using Visual studio 2019 and .net framework to create this application.

Implementation:


STEP 1 : Open VS 2019. Click on create a new project and select ASP.Net web application (.Net Framework).
Create First Web API Hello World application with repository pattern


Create First Web API Hello World application with repository pattern

STEP 2 : Configure new project window will be open. Enter the project Name, select location and click on Create button.

Create First Web API Hello World application with repository pattern

Tuesday, March 10, 2020

Create Web API Hello World First application

In this article I am going to explain how to create Web API first Hello world application.

In previous article I have explained Introduction to Web API.

I am using Visual studio 2019 and .net framework to create this application.

Implementation:
STEP 1 : Open VS 2019. Click on create a new project and select ASP.Net web application (.Net Framework).
Create Web API Hello World First application


Create Web API Hello World First application

STEP 2 : Configure new project window will be open. Enter the project Name, select location and click on Create button.

Create Web API Hello World First application

STEP 3 : Create a new ASP.NET Web application window will be open. Select Empty and check the Web API from add folders & core reference. If you want to create MVC + Web API, then select the MVC option. 

Sunday, March 8, 2020

Introduction to ASP.NET Web API


Here in this article I am going to give you introduction of ASP.Net Web API.


ASP.NET Web API
API stands for application programming interface. ASP.NET Web API is a framework developed by Microsoft, which is used to build HTTP based services. It processes the information/data between two applications and returns the data in XML or JSON format. API can be accessed by a broad range of clients like browsers, mobile, IOT, desktop application etc. It is an ideal platform for building RESTful services.

Thursday, March 5, 2020

Introduction to Web API


In the world of web, API is playing a big role. API stands for application programming interface.

What is Web API?

Web API is a framework which is used to build HTTP based services. It processes the information/data between two applications and returns the data in XML or JSON format. API can be accessed by a broad range of clients like browsers, mobile, IOT, desktop application etc.
Web API can be build using different technologies .net, java, Python, Ruby etc.

Saturday, January 18, 2020

[Solved] SQL SERVER (Error Message) : Invalid object name 'string_split'.

Sunday, January 5, 2020

SQL SERVER : Split comma separated string value


In this article I am going to explain how to split the comma separated string value in Sql Server.

Microsoft release the Sql Server 2016 in year 2016 and introduced new built-in table value function string_split. This function can be used to split a string value by a specified separator character and returns the result value inform of table. So we no need to write our user defined function to split the string value as we have doing earlier.

Tuesday, October 15, 2019

SQL SERVER : Take database backup automatically


In this article I am going to explain how to take automate daily backup of SQL Server database

As you know database is the heart of any software driven application and nobody want to lose it on any cost. So the main purpose of the database backup is to create a copy of database that can be recovered if something goes wrong with database. There can be many reason of database failure like database got corrupt, virus.

To avoid the loss of data we need to take the database backup regularly/daily basis. It is not possible to take the backup daily manually.

Saturday, September 28, 2019

Windows Task Scheduler: How to Create Basic Task


Here in this post I am going to explain how to create a basic task in Windows Task Scheduler
Few days ago I have wrote an article on Windows Task Scheduler. You can read this to know why we use the task scheduler.

To create basic task follow the steps given below:

STEP 1: Open Task Scheduler
Go to windows start button and type task scheduler.

Tuesday, September 24, 2019

SQL Server Installation Rule Error: “Oracle JRE 7 Update 51 (64-Bit) Or Higher Is Required For Polybase”


Here in this article I am going to explain how to resolve the error rule “Oracle JRE 7 Update 51 (64-Bit) Or Higher Is Required For Polybase”.

Error :
This error occurred when we are installing the SQL Server. I got this error during installation of Sql Server 2016 or above version. For more information about error click on failed link button.

Oracle JRE 7 Update 51 (64-Bit) Or Higher Is Required For Polybase


Reason:
SQL Server 2016 introduced Polybase feature for external data. It enables SQL Server instance to process Transact-SQL queries that read data from Hadoop. Check out this article for more info of Polybase.

Monday, September 16, 2019

Window Task Scheduler


Task scheduler is a component of windows. It is available in all version of windows. It helps us to trigger the script or programs at specified time or when defined conditions met. In simple words if you don’t want getting bored doing same work daily, like taking database daily, sending birthday/marriage anniversary emails etc. Create basic task scheduler and define when it to be triggered.