EntityFramework-Reverse-POCO-Code-First-Generator icon indicating copy to clipboard operation
EntityFramework-Reverse-POCO-Code-First-Generator copied to clipboard

how to add interceptor?

Open javadinasabVahid opened this issue 1 year ago • 3 comments

I could not override the configuration Please help me

javadinasabVahid avatar Mar 25 '24 03:03 javadinasabVahid

There are interceptors in your <database>.tt file. You will see them called as a delegate such as:

  • Settings.TableRename
  • Settings.UpdateTable
  • Settings.UpdateColumn
  • etc

What is it you are trying to do?

sjh37 avatar Mar 25 '24 10:03 sjh37

Thanks for the guide.

I meant this piece of code

`protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder);

optionsBuilder.AddInterceptors(new IgnoreTrackingInterceptor());

}`

How to use AddInterceptors?

javadinasabVahid avatar Mar 25 '24 12:03 javadinasabVahid

Hi @javadinasabVahid

I don't have a callback for that, so you will have to tweak the .ttinclude file.

Search for optionsBuilder.UseLazyLoadingProxies();{{#newline}} There will be a few results, two each for EFCore3, EFCore6, EFCore7, EFCore8

Try adding in your line above

{{#if UseLazyLoadingProxies}}
            optionsBuilder.UseLazyLoadingProxies();{{#newline}}
{{/if}}

sjh37 avatar Mar 25 '24 13:03 sjh37