Code Based Code First Migration

How to implement Code First Migrations without Package Manager Console commands. I want to implement Code First Migrations logic by using code. I don't want to write Following commands

PM    >      Enable-Migrations
PM    >      Add-Migration
PM    >      Update-Database

Please tell me the best practice.

Thanks in advance

Answers


Have a look at using the migrate.exe tool that is supplied when you install EF package.

http://msdn.microsoft.com/en-gb/data/jj618307.aspx

You could theoretically call this from your code.


I'm not sure why you would be adverse to the first two, but the last I totally understand. You are looking for the DBMigrator class. You can use this to check how many migrations need to be run, and do the migration to any version. If you can do it with Update-Database, you can do it in code. I've referenced a similar example below.

Triggering EF migration at application startup by code


Need Your Help

double array to sent from TCP client

c++ arrays windows sockets tcp

in this days I'm working on a TCP communication between to computers, I would send an array composed by 6 double elements. Usually I used the function send, that accept a char* that has to be send....