Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HasTriggers not added with EFCore 7 #1688

Closed
lsiepel opened this issue Feb 10, 2023 · 6 comments
Closed

HasTriggers not added with EFCore 7 #1688

lsiepel opened this issue Feb 10, 2023 · 6 comments
Labels
question Further information is requested

Comments

@lsiepel
Copy link

lsiepel commented Feb 10, 2023

From this issue: #1345 i learned that adding HasTriggers (due to this breaking change ) while reverse engineering is supported. Unfortunately, i have a case where this does not seem to work.

Offcourse, let me know if you need anything else to analyse this problem.

When i apply this schema and json, the
Schema: https://1drv.ms/u/s!AnMcxmvEeupwjqVc431dzHgq-GUX6Q?e=zzLDvA
Contains three tables: with Gebruikersgroep and Autorisatieonderdeel both holding a trigger that performs actions agains Autorisatie when an insert is in play.

efpt.config.json

   {
"CodeGenerationMode": 2,
   "ContextClassName": "TestDBContext",
   "ContextNamespace": null,
   "DefaultDacpacSchema": null,
   "FilterSchemas": false,
   "IncludeConnectionString": false,
   "ModelNamespace": "Models",
   "OutputContextPath": "Data",
   "OutputPath": "Models\\TestDB",
   "PreserveCasingWithRegex": true,
   "ProjectRootNamespace": "TestDB.Data.EFCore",
   "Schemas": null,
   "SelectedHandlebarsLanguage": 0,
   "SelectedToBeGenerated": 0,
   "Tables": [
      {
         "Name": "[dbo].[Autorisatie]",
         "ObjectType": 0
      },
      {
         "Name": "[dbo].[AutorisatieOnderdeel]",
         "ObjectType": 0
      },
      {
         "Name": "[dbo].[Gebruikersgroep]",
         "ObjectType": 0
      }
   ],
   "UiHint": "DatabaseServer.TestDB",
   "UseBoolPropertiesWithoutDefaultSql": false,
   "UseDatabaseNames": true,
   "UseDbContextSplitting": false,
   "UseFluentApiOnly": false,
   "UseHandleBars": true,
   "UseHierarchyId": false,
   "UseInflector": false,
   "UseLegacyPluralizer": false,
   "UseManyToManyEntity": false,
   "UseNoConstructor": false,
   "UseNoDefaultConstructor": false,
   "UseNoNavigations": false,
   "UseNoObjectFilter": false,
   "UseNodaTime": false,
   "UseNullableReferences": false,
   "UseSchemaFolders": false,
   "UseSpatial": false,
   "UseT4": false
}

Versions:

  • EF Core version in use: EF Core 7.0.2
  • Is Handlebars used: yes
  • Is T4 used: no
  • Is .dacpac used: no
  • EF Core Power Tools version: 2.5.1277
  • Database engine: SQL Server
  • Visual Studio version: Visual Studio 2022
@ErikEJ
Copy link
Owner

ErikEJ commented Feb 10, 2023

You can set HasTriggers in partial class - suggest you create an issue in the EF Core repo, this is not something that can be fixed in Power Tools

@lsiepel
Copy link
Author

lsiepel commented Feb 10, 2023

I thought that according to this comment it was supported. Just out of curiosity, can you share some light why this would need to be fixed in EF Core and not in powertools?
I thought that if power tools checked the schema and stumbles accross some triggers, they would be added to the model generated files.

Thanks for the workaround suggestion with the partial classes.

@ErikEJ
Copy link
Owner

ErikEJ commented Feb 10, 2023

@lsiepel Possibly not for your special case

@lsiepel
Copy link
Author

lsiepel commented Feb 10, 2023

Still don't know why it is special and why this cannot be fixed here.

@lsiepel lsiepel closed this as completed Feb 10, 2023
@ErikEJ
Copy link
Owner

ErikEJ commented Feb 10, 2023

@lsiepel I have not investigated deeply, but please create an issue in the EF Core repo - EF Core Power Tools build on top of the built in EF Core tooling.

@ErikEJ ErikEJ added the question Further information is requested label Feb 10, 2023
@ErikEJ ErikEJ closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2023
@ErikEJ
Copy link
Owner

ErikEJ commented Feb 16, 2023

If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants