I'm trying the latest Entity Framework Migrations beta 01 release. It works fine using Visual Studio Power Shell. But when I'm going to run the PS command "Update-Database" using C# code, it gives me the errors -

"Missing Required Parameter 1 "AssemblyName" in code line "" " and "System.Management.Automation.RemoteException"

Then I tried the PS command "Update-Database "EntityFramework". Then it says,

"Could not load file or Assembly"

I used System.Management.Automation.Runspaces.Pipeline class to invoke Power Shell command. Can some one help me.

Thank you.

有帮助吗?

解决方案

I know I already answered your question offline, Lasantha, but for the benefit of everyone else on StackOverflow...

The PowerShell commands that we ship with Migrations are very specific to the NuGet/Visual Studio environment and will not work outside of it.

If you are interested in running Migrations from code, Rowan's Running & Scripting Migrations from Code post is a great resource for getting started.

其他提示

Brice's link is a very good resource, it got me started as well and led to this answer:

https://stackoverflow.com/a/14339379/219187

Just use ScriptUpdate(null, null) to update to the latest migration.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top