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
711 stars 227 forks source link

how to add interceptor? #835

Open javadinasabVahid opened 8 months ago

javadinasabVahid commented 8 months ago

I could not override the configuration Please help me

sjh37 commented 8 months ago

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

What is it you are trying to do?

javadinasabVahid commented 8 months ago

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?

sjh37 commented 8 months ago

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}}