Open ajcvickers opened 6 years ago
The first thing I'd like to see is how to prioritize object creation or specify dependencies. When generating the SQL script, the SQLGenerator will create table objects and then create foreign key constraints. However, when creating views, the body of the SQL will have dependencies on underlying tables or views. How can we provide this hint to EF?
In the customcodegenerator, I can change a CreateTable statement to a CreateView statement by testing for my new annotation IsViewAttribute. I can then extend m SQLGenerator to handle CreateView. What I don't see is how to specify that the table Zoologists needs to exist before the view vwSpecialists; and that, uspAuditData needs to exist before creating any table object with an Instead of Trigger. example: migrationBuilder.CreateProcedure(ProcedureType.StoredProcedure,"audit.uspAuditData"); migrationBuilder.CreateProcedure(ProcedureType.InsteadOfInsert,"dbo.customers"); migrationBuilder.DependencyMap.Add("dbo.customers","audit.uspAuditData");
update-database -script outputs in alpha order.
Specifically to show how the model can be annotated, the model differ can diff those annotations, and migrations operations can be created.