Ask your technical questions on forums or here :
ASP.NET or MVC | C# | Windows Phone
Microsoft Technology Journals by Abhimanyu K Vatsa
HOME ABOUT RAZOR BOOK SPEAKING MVC ASP.NET JQUERY VIDEOS EBOOK ARCHIVE
Showing posts sorted by relevance for query code first migration. Sort by date Show all posts
Showing posts sorted by relevance for query code first migration. Sort by date Show all posts

25 Oct 2013

Custom Code First Conventions - EF 6 New Feature

In this blog post you will learn a new feature ‘Custom Code First Conventions’ introduced with Entity Framework 6. This is 'Code First' only improvement. EF 6 comes with number of cool new features and improvements, so I decided to write blog posts and cover some of the new features.

23 Nov 2013

Customize User's Profile in ASP.NET Identity System

Note: You should read this post instead, I found below walkthrough will not work on ASP.NET Identity 2. I will re-work on this post soon.

In this post you will learn how to customize User’s Profile and add some more fields like FirstName, LastName, EmailID etc with ASP.NET Identity System. In my last post I listed some of the great new features introduced with Identity system.

9 Aug 2012

Code First Approach in Entity Framework

Introduction

Entity Framework is the Microsoft preferred method of data access for .NET applications. It supports strongly-typed access through LINQ. Entity Framework also allows developers to program against a conceptual model that reflects application logic rather than a relational model that reflects the database structure. Entity Framework can be used from an ASP.NET Application, (using Entity Data Source) or in ASP.NET MVC etc. In this article we will be creating this using MVC App and we’ll be using Visual Studio 2012 for demo.

17 Oct 2012

What happens when database doesn't match conventions / using OnModelCreating() feature?

This is just basic article and I’m not going to say anything new here but I will say things in my way. The very well-known question newbies ask about MVC and Entity Framework is, how does a conceptual database model target the names?

4 Mar 2013

Code First Approach & Database Migration & Server Side Validations & Client Side Validations in MVC4: Video in Hindi

In this video you will learn how to create simple Feedback Submission Form. In the journey, I will explain the use of Code First Approach and Code First Database Migrations and also Sever Side Validations and Client Side Validations to validation the data entered by the user.

4 Oct 2012

Monthly Blogging Report: September 2012

Consolidating all blog posts monthly are very refreshing as it gives me chance to go back and see what I did in last month and for readers gives the chance to see what he not followed up.

28 Sep 2012

Playing with Entity Framework's Code First Database Migration

In this video you will learn how to use Entity Framework's Code First Database Migration. I'll create simple console application and will add 'Student' model and then a DbContext in the project.

21 Sep 2012

Code First Database Migrations in MVC: in Hindi

In this video you will learn how to use Migration feature in MVC Apps. I will create a new MVC Project using Code First Approach and then I will make some changes in model to look at the errors and then will use the Migration feature to migrate/update the database. Video is in Hindi Language.

5 May 2017

Migrating Azure VMs on VNet from Azure Service Management (Classic or ASM) to Azure Resource Manager (Resource Manager or ARM)

In this post you will find code snippet to migrate your classic Azure VMs that is part of virtual networks. That is, you will learn Migrating Azure VMs on VNet from Azure Service Management (Classic or ASM) to Azure Resource Manager (Resource Manager or ARM). Without too much discussion, let's start step by step.

You need to have PowerShell installed. In the process of migration you first need to sign in your subscription using modern way that is ARM to prepare migration and then sign in your same subscription using classic approach that is ASM to perform migration and commit.

Step 1.
Let's login ARM

Login-AzureRmAccount

Step 2.
Store subscription id into a variable

$SubID = "1345e4-4561-1bd7-55c1-e3848012qw4r"

Step 3.
Select subscription using above variable

Select-AzureRmSubscription -SubscriptionID $SubID

Step 4.
Now, let's prepare the migration on ARM, this operation may take few minutes.

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

Step 5.
Now, in order to know the progress just use below command, you should see RegistrationState to Registered. Once you see Registered, you are good to go ahead.

Get-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

Step 6.
Let's login ASM now

Add-AzureAccount

Step 7.
Then, select the subscription using subscription id that we stored in variable above.

Select-AzureSubscription -SubscriptionID $SubID

Step 8.
Now, let's get virtual network name that we will in next step.

Get-AzureVNetConfig -ExportToFile "C:\Users\Abhimanyu K Vatsa\Desktop\VNetConfig.xml"

Now you copy the value of VirtualNetworkSite name="demo-vnet-name"

Step 9.
Store the virtual network name in a variable. Remember, we are migrating virtual network that will automatically migration everything that is associated with this network, including network itself, vms, storage, load-balancer, subnet, nic etc.

$VNetName = "demo-vnet-name"

Step 10.
Let's run most powerful command that prepares the move and it may take few minutes.

Move-AzureVirtualNetwork -Prepare -VirtualNetworkName $VNetName

Step 11.
If you login to portal now, you will notice a new resource group is create with same name but -Migrated as post-fix. Don't worry, if you see everything doubled. Because these are exact same copy of your resources that was in classic. Once you run commit command (given below) your all classic resources will be removed and you will have migrated resources on ARM and every thing working as it was working earlier. Note, this operation may also take some time.

Move-AzureVirtualNetwork -Commit -VirtualNetworkName $VNetName

Or if you feel something going wrong, you can abort it using below command:

Move-AzureVirtualNetwork -Abort -VirtualNetworkName $VNetName

I used these commands several times and never faced any challenges, but still recommend you to run it yourself before your migrate production resources.

Hope this helps.

24 Nov 2013

Customizing User's Profile to add new fields in brand new database table

In this post you will learn how to customize User’s Profile and add new fields/properties/columns (FirstName, LastName and EmailID) in a brand new table with ASP.NET Identity System.

25 Nov 2013

Seeding ASP.NET Identity Database

In this post you will learn how to seed User’s Profile database tables (AspNetUsers and UserProfileInfoes, we created in last post) with dummy data.