Migrating database from ASP.NET Identity to ASP.NET Core Identity

As you know ASP.NET Core Identity (table structure) is different from what we had earlier in ASP.NET Identity. Actually the identity system which we have today with .NET Core is very mature and continuously evolved be it ASP.NET Membership, ASP.NET Identity 1, ASP.NET Identity 2 and now ASP.NET Core Identity.

Recently I had to migrate few application to ASP.NET Core and similar its identity database. Because the table schema is changed, i had to re-think and create migration script which I would like to share with you today.

It is very simple and easy, just three step and I had everything ready:

STEP 1 : Change name of existing tables
STEP 2 : Create ASP.NET Core Identity tables
STEP 3 : Migrate data from old tables (ASP.NET Identity) to new tables (ASP.NET Core Identity)


You should also watch my video, where I demoed migration.

Lambda two tables and three tables inner join code samples

In this blog post you will learn inner join using lambda queries. There will be two samples, in first sample you will see how you can join two tables and in second sample you will see how you can extend even further to join three tables and so on.

I will sample in-memory data, but the same implementation will work with IQueryable (lazy query) too.

Here's the code snippet:-

namespace ConsoleApp1 { classProgram     { staticvoid Main()         { var table1 = new List<Table1>();             table1.Add(new Table1 { Id = 1, Name = "Name 1", Address = "Address 1" });             table1.Add(new Table1 { Id = 2, Name = "Name 2", Address = "Address 2" });             table1.Add(new Table1 { Id = 3, Name = "Name 3", Address = "Address 3" });             table1.Add(new Table1 { Id = 4, Name = "Name 4", Address = "Address 4" });
var table2 = new List<Table2>();             table2.Add(new Table2 { Id = 1, Email = &q…

How to move web.config connectionStrings in a separate web.config file ?

In this post you will learn how to create a separate web.config file in ASP.NET or MVC to store development and production versions of connection strings.

Step 1. Create a PrivateConn.config file on root with below code

<connectionStrings>   <addname="DataConn1"connectionString="Data Source=server;Initial Catalog=database1;Persist Security Info=True;User ID=sa;Password=xxxx;MultipleActiveResultSets=True;App=EntityFramework"providerName="System.Data.SqlClient" />   <addname="DataConn2"connectionString="Data Source=server;Initial Catalog=database2;Persist Security Info=True;User ID=sa;Password=xxxx;MultipleActiveResultSets=True;App=EntityFramework"providerName="System.Data.SqlClient" />
Step 2. Open main web.config file (on application root) and then define new config file path, as given below

<configuration>   ....other codes....   <connectionStringsconfigSource="PrivateCo…

How to move web.config appSettings in a separate web.config file ?

In this post you will learn how to create a separate web.config file in ASP.NET or MVC to store development and production versions of application settings.

Step 1. Create a Private.config file on root with below code

<appSettings>   <addkey="data1"value="value1"/>   <addkey="data2"value="value2"/>
Step 2. Open main web.config file (on application root) and then define file path with appSettings start tag, as given below

<configuration>   ....other codes   <appSettingsfile="PrivateSettings.config">     <addkey="webpages:Version"value=""/>     <addkey="webpages:Enabled"value="false"/>

Can test automation replace manual testing?

Short and simple answer, NO. It cannot. Let's talk why, we cannot replace manual testing.

Consider, a form screen showing a extra textbox or a wrong color in any control or a wrong modal, but the entire functionality works fine otherwise. Such things would easily be missed if you have a 100% automated test cases with 100% test coverage, because automated testing looks more at what is expected and less at what is not expected.

We see a ton of software's around for test and its automation, and they are divided into different categories:

1. Test Management Tools - Azure DevOps, PractiTest, TET (Test Environment Toolkit), TETware etc
2. Functional Testing Tools - Selenium, Soapui etc
3. Load Testing Tools - Azure DevOps, Jmeter, FunkLoad, ANTS etc

Any tool you select has list of features and they power up software testers or testing. Manual testing will stay and advocate manual testers to develop skills like scripting which can make them more efficient and do a better job.

Both manual …

Reading NS records in C# using ARSoft packages

In this post you will learn about reading NS records in C# using ARSoft packages. This package is handy to read domain NS records. Here's a sample code which will help:

using System;
using System.Linq;
using ARSoft.Tools.Net;
using ARSoft.Tools.Net.Dns;
namespace ConsoleApp14
    class Program
        static void Main(string[] args)
            var dnsMessage = DnsClient.Default.Resolve(DomainName.Parse(""), RecordType.Ns);
            var nsrecords = dnsMessage.AnswerRecords.OfType<NsRecord>();
            foreach (var record in nsrecords)

Here's the output of the above code:

Hope this helps.

Customizing "Edit Top 200 Rows" in SQL Server Management Studio

It is a very common requirement that, sometimes we want to change the edit top 200 rows query. This is very much possible and easy in SQL Server Management Studio.
Right click on table and select "Edit Top 200 Rows"Press "Ctrl + 3" on rows in edit mode windowNow you can see the query which returned 200 rows allowing you to editOn this query window, right click to execute the query on window itself And voila, you have records based on your query to edit those on window :)

Hope this helps.

Popular posts from this blog