Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dotnet add package Microsoft.EntityFrameworkCore.Design
- dotnet add package MySql.Data.EntityFrameworkCore.Design
- <ItemGroup>
- <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
- </ItemGroup>
- MySql.Data.EntityFrameworkCore.Design
- Microsoft.EntityFrameworkCore.Tools
- Scaffold-DbContext `"server=localhost;port=3306;user=root;password=mypass;database=sakila" MySql.Data.EntityFrameworkCore -OutputDir sakila -f`
- RunScript(migrationBuilder, @"PathToYouScript");
- private void RunScript(MigrationBuilder migrationBuilder, string scriptFilePath)
- {
- var migratorPath = Path.Combine("..", scriptFilePath);
- if (!File.Exists(migratorPath))
- {
- migratorPath = Path.Combine("..", "..", "..", "..", scriptFilePath);
- }
- migrationBuilder.Sql(File.ReadAllText(migratorPath));
- }
Add Comment
Please, Sign In to add comment