how run dotnet.exe ef <command>
commands programmatically in .net core?
for example add migration i'm running in terminal dotnet ef migrations add newmigration
, indeed create migrations folder migration classes, create new migration (for example) programmatically c# code?
don't suggest process.start("cmd bla-bla")
since code should cross-platform , dotnet ef
runs code entityframeworkcore package anyway. question code?
ef core api isn't designed scenario, if want anyways, you'll need repeat logic "dotnet-ef.dll" gather project context , compilation output, , instantiate , use migrationsoperations
manually.
see https://github.com/aspnet/entityframework/blob/1.0.0/src/microsoft.entityframeworkcore.design.core/design/migrationsoperations.cs , https://github.com/aspnet/entityframework/blob/1.0.0/src/microsoft.entityframeworkcore.design/internal/operationexecutor.cs
use caution: these "internal" apis, means usage may break version version. "dotnet ef" going change great deal between current release (1.0.0-preview2) , next release. (for example, entire tooling implementation change. see https://github.com/aspnet/entityframework/issues/5334).
Comments
Post a Comment