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
704 stars 231 forks source link

Multi-targeting #540

Open sjh37 opened 4 years ago

sjh37 commented 4 years ago

From @TimSirmovics

I am playing around with a library that multi targets .NET Standard 2.0 and .NET Framework 4.72, using EF Core for the .NET Standard version and EF 6 for the .NET Framework version. I put two version of the generator (Ef6 and EfCore) in the same folder and set GenerateSeparateFiles = false so that all of the entities would generate with the same namespace (I could also put them in a seperate folder and set the namespace but this was ok for now). After generation I would wrap the entire generated file in #if NETSTANDARD2_0 and #if NET472 blocks respectively which seemed to work ok. The only issue is I had to manually re-add these after each regeneration. I'm not sure if this is a common requirement but is it possible to add an option specifing .NET targets for the output file(s)?

chris-eg commented 4 years ago

Have the same issue, at the moment im editing the ttinclude so that when the template is EFCore3 it adds the #if NETSTANDARD2.0 and when the template is EF6 it adds #if NET472 but a way to specify #if wappers in the tt would be very helpful