sjh37/EntityFramework-Reverse-POCO-Code-First-Generator

HasTrigger is not working with synonymous tables

iahmed9312 opened this issue ยท 7 comments

After updating to EFCore7 (HasTrigger) is now required before inserting to a table, and thankfully POCO is updated since v3.8.0 . However, I have added table (that has trigger) as synonymous from another database but (HasTrigger ) is not added by POCO.

sjh37 commented

Hi. HasTrigger was added to v3.8.1 and enhanced in v3.8.2.
See release v3.8.2 notes

Please show me the SQL to create the trigger for the table, and the SQL for the table so that I may test it.

sjh37 commented

I also wanted to check you have set Settings.TemplateType = TemplateType.EfCore7 in your .tt settings file.

Thank you for your reply.

The template is set to Settings.TemplateType = TemplateType.EfCore7

To replicate my situation please follow the steps:

  1. Create new database (Database1)
  2. Create table (Table1)
  3. Create trigger for Table1

If you run POCO in Database1 it will run correctly and it will add (HasTrigger to Table1)

To get to my issue please follow the steps:

  1. Create a new database (Database2)
  2. Create new Synonym pointing to Database1.dbo.Table1

Now if you run POCO on Database2 it will run correctly except it will not add (HasTrigger to Table1)

I hope it is clear.

Please note you have to change FilterSettings.IncludeSynonyms = true in your .tt settings file

sjh37 commented

Try the attached file. It only works on SQL Server currently. Let me know if it works for you.
EF.Reverse.POCO.v3.zip

Thank you very much, it is working perfectly!

sjh37 commented

Released in v3.9.0