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

EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
https://www.reversepoco.co.uk/
Other
700 stars 230 forks source link

HasTrigger is not working with synonymous tables #813

Closed iahmed9312 closed 9 months ago

iahmed9312 commented 10 months ago

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 10 months ago

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 10 months ago

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

iahmed9312 commented 10 months ago

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.

iahmed9312 commented 10 months ago

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

sjh37 commented 9 months ago

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

iahmed9312 commented 9 months ago

Thank you very much, it is working perfectly!

sjh37 commented 7 months ago

Released in v3.9.0