Use the add-Migration and personalize the migration.
Sometimes it is useful to add a migration without making changes to
template. In this case, adding a new migration creates
code with empty classes. You can customize this migration to
perform operations that are not directly related to the RU model
Core.
Example of migration
customized:
public partial class MinhaFuncao : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
var function = @"
CREATE FUNCTION MINHAFUNCAO(@ST VARCHAR(1000))
RETURNS VARCHAR(1000)
BEGIN
RETURN('Minha função')
END
";
migrationBuilder.Sql(function);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
Hello George, I did so: public class Applicationdbcontext : Dbcontext { protected override void Onmodelcreating(Modelbuilder modelBuilder) { Database.Executaesqlcommand("sql script of the function here"); } } ?
– iago soares
@iagosoares is valid yes, can even as a response, would be another option :)
– George Wurthmann
Thank you George! Sorry for the reply formatting, I’m still learning rsrs
– iago soares