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

Support for EF Core #5

Closed airomero closed 4 years ago

airomero commented 8 years ago

Hi, is there any plan to support EF7? EF7 is more stable now and we love EFReversePoco, so it'd be so nice to start playing with both together. Thanks!!

sjh37 commented 8 years ago

It's on my todo list. However, I want to get a few things out of the way before I look at EF7 / EF Core 1.0.

  1. Data Annotations
  2. Support other database, such as PostgreSql and MySql.
reader-man commented 8 years ago

@sjh37 Thanks on your great project.

I started on a new GUI, to handle All the properties of the reverse poco, and any other new one that might get added in the future, and handle the multiple model/poco projects in one solution, but it looks that the new projects/assignments/finance will delay that, when the time comes, its what i can give as gift to your great idea/work.

But please, add SQLite in the middle, as its almost a defecto in devices like mobiles. and when you look at EF7, try to a have a look at it from the perspective of PCL, especially the Xamarin.Forms PCL, when code is generated.

sjh37 commented 8 years ago

Cool. Thanks and no problem, will do.

sjh37 commented 8 years ago

I cover all the options in detail in module 2 if you have a pluralsight subscription.

reader-man commented 8 years ago

Thanks, your Tutorial is on my schedule of "To-See".

alteredstudio commented 8 years ago

Watched your PluralSight Tutorial. My co-workers and I want to use it on Core 1.0 when it comes out next month. Can't wait for EF7 support. When I can scaffold controllers and views in MVC6 from the POCO class this will be amazing. Thanks for making such a game changing plugin!

airomero commented 8 years ago

Hey! Any update on this one? EF core is RTM and we can't wait for EFRPoco to support it!

sjh37 commented 8 years ago

Hi. Nothing started with EF7.

reader-man commented 8 years ago

@sjh37 While its your decision alone, but i suggest: if there going to be a move to EF7, that its better to be in another repository, with a different name, because of the too much difference, and because EF7 is still a child that might change its directions, and last, EF6 will stay dominant till people leave the windows desktop applications and the old ASP.Net, and that will take a long time, if it happens.

cyberbobcity commented 7 years ago

I just learned about your generator! Really cool. Do you know if the resulting class built with your generator and EF6 can be used with Asp.Net Core and EF7?

sjh37 commented 7 years ago

I've never tried, but it can't be too far off.

ErikEJ commented 7 years ago

@cyberbobcity You can use EF6 (and the code generated by this tool) with ASP.NET Core.

reader-man commented 7 years ago

Yes, that's what i am doing right now, and its working perfectly. and by doing like that, we don't wast the project owner time, to think of re-doing it(EntityFramework-Reverse-POCO-Code-First-Generator) to work with .netstandard.

Then

Then

Then

then

Now when ever you want to re-generate your entities, go to solution 'SolutionA-POCO', and run the .tt(s). and your .netstandard projects will refresh with the new regenerated entities.

connecting the old with the new

marekvse commented 7 years ago

Hi @reader-man. I'm puzzled as to how you did this without retargeting the project to full .net framework?! I tried to move the generated .cs class to my Core project targeting netcoreapp1.1 and that yielded lots of errors due to Entity.DbSet being in a completely different namespace in core and some of the other classes not even existing in the new namespace... ??

marekvse commented 7 years ago

OK everybody loving this tool too much to give it up for cross-platform compatability when using the Angular 2 template as I've been trying to do (and finally succeeded). I do not think this tool can actually be run on .NET Core targeting netcore 1.1 (really not sure how @reader-man supposedly did that) but if you don't mind Re-targeting, in my case re-targeting the current Angular 2 project template with hot-reload etc. which after doing so throws an exception on UseWebpackDevMiddleware, then know that it has a fix. It is apparently a bug in .net which can be fixed by adding the System.Net.Http package to your project. At least it worked for me. This is the source of the info: https://github.com/aspnet/JavaScriptServices/issues/802 .

reader-man commented 7 years ago

@marekvse, Well sorry, for the late reply, as i am too busy on several projects in the same time, desktop/asp.net core/mobile/several sicknesses :). if i did not forget this page open, i would have not noticed the replies, as i am monitoring too many projects on github, that my inbox has lots of daily clutter.

lets begin answering: first i am mainly talking about generating POCO classes as seen from the Picture, not the DataContext, as that is the main problem in my projects that have hundreds of tables, and i wanted to port them to .netstandard, to have them work on multiple platforms/technologies.

and i am using several github open source projects, after i ported most of their code to .netstandard, as seen from the pics under:

01 entity called company b

02 abstracted entity a

03 abstracted entity b

04 dbcontextscope efcore

plus, i am still working on an old Reverse Poco version v2.17.1, because i have my own needs, and have changed its code, so currently its serving me ok, and till now, did not need to upgrade, which will take time, which i don't have.

for the DataContext, i will be working on it these days, and see if that is possible or not, strictly on .netstandard 1.6, and if need be, go to .net core 1.1.

my wish is for .netstandard 2.0 beta comes out, as it will speed porting and ease it.

reader-man commented 7 years ago

ok guys @sjh37, @marekvse, @ErikEJ, @cyberbobcity, @airomero, , thank god, managed to make the simplest entity/table to read data from a database with a DataContext in a NetStandard 1.6 project.

so now, the POCOs are in a NetStandard project and the DataContext in another NetStandard 1.6. and i am initiating them from a .NetCore 1.1 ASP project. as seen: 01 datacontext in netstandard

Had To change several things in Mr. Simon Hughes @sjh37 .tt files.

also added support classes to help in converting between old EF to new EF Core. Not all Support Classes work, some of them are just surrogates for later to be filled/fixed, as i wanted to make sure that its possible before investing more time in it, if any one wants to help further, he's welcome.

Made a simple table with only integer fields as i couldn't fix the errors coming from the varchar/nvarchar fields.

thanks to projects like URF + DbContextScope.EfCore, that i also had to port them to NetStandard, this was possible.

All my current projects are here if people are interested, i don't know if i will have time to add them to github or not, as i never used it, i don't know if it will take too much time to learn and use.

Make a folder in "D:\" drive, and decompress the files in the same order and same names like the included picture "02 Projects Structure.png", as they are interconnected, and i don't know if problems will arise if changed their placement.

also, the file "Simple Table.txt", has the structure of the table, as if u use different types, u might get errors.

The Folders: A: D:\4_PrjB\ConstructionToolsB\ConstructionToolsB.sln This is the main Solution, that has the POCO Projects + DataContext Project + ASP.Net Core Project. The main projects you should concentrate on are: D:\4_PrjB\ConstructionToolsB\BAL\DOM\Company D:\4_PrjB\ConstructionToolsB\DAL\ContextDAL\CompanyDAL

B: D:\4_PrjB\ConstructionToolsB-POCO\ConstructionToolsB-POCO.sln This is the where to run the .tt files, as it uses Old plain EF 6, to generate the POCO classes & the DataContext classes, and its .csproj are moved to "A" Solution folder and in the NetStandard projects, so they can generate the files and get collected immediately by the NetStandard projects.

C: D:\4_Prj\CommonLibrariesCore\Main\Src Main Common Libraries

D: D:\4_Prj\CommonLibrariesCore\zOtherTools Open Source Projects, ported to NetStandard.

The Helper projects: D:\4_Prj\CommonLibrariesCore\Main\Src\Common\Uti\OldNet D:\4_Prj\CommonLibrariesCore\zOtherTools\DbContextScope\src\oldNetEF D:\4_Prj\CommonLibrariesCore\zOtherTools\DbContextScope\src\OldNetEFContext

Well I tried my best to explain most of the needed stuff, the rest is code that you can look into.

Regards. and thanks again to @sjh37 for this great tool, especially when compared to the new .Net Core tools.

reader-man commented 7 years ago

Sorry forget to say that

the .tt files that have changed to work for NetStandard, have the sentences above the changes: //Added By Me //Changed By Me

while there are other changes done other than these ones, but they are not related to NetStandard, and they are located in: D:\4_PrjB\ConstructionToolsB\BAL\DOM\Company D:\4_PrjB\ConstructionToolsB\DAL\ContextDAL\CompanyDAL

the .tt files are v2.17.1.

ErikEJ commented 7 years ago

@reader-man Have you tried the SQLite Toolbox Reverse engineer GUI (works with SQL Server, SQL Compact and SQLite) https://twitter.com/ErikEJ/status/834405829889638402 ?

reader-man commented 7 years ago

@ErikEJ Many Thanks, i will give it a try in the coming days. šŸ‘

The main thing about EF-Reverse-POC-Gen, is the huge number of customization/properties, that lend itself easily in complex developer needs/configurations.

So, while i did simple reversing in the past, but when i saw Mr. @sjh37 project, it was not just love at first site, but also addiction :), and by having it an option in ur project, its definitely a big plus by me.

Regards.

marekvse commented 7 years ago

Same here.. Simple reverse-engineering tools are total pain. Simon's Reverse POCO solves so many problems with those that I have not seen anything remotely comparable with it.

sanddigital commented 6 years ago

I'm just trying to find out if there is any progress on Ef Core 2.0 support? And if there is anything I can do to help make this happen?

I've traced back to here from: https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/issues/322

Thanks

sjh37 commented 6 years ago

Hi, a big help would be to take the generated code for northwind, and convert it for use with ef core, send it to me, i'd run a diff to see whats changed, then I could implement the change in the generator to match what you had done manually.

kinetiq commented 6 years ago

Just throwing my support on EF Core 2.0 support.

Love this tool for EF 6... EF Core has been out for over a year now, and is become ever-more usable. It will probably be the new standard when EF Core 2.1 comes out, and I am really missing my EFRPCFG. Thanks!

ahakobyan commented 6 years ago

@ErikEJ The workaround the SQLite Toolbox Reverse engineer is not working for Visual studio anymore. @sjh37 POCO support on EF core is highly required. Thanks for your job guys!

ErikEJ commented 6 years ago

@ahakobyan Correct, my "EF Core Power Tools" is now an even better option, it also includes optional code customization (not quite like this template, of course)

Curdie commented 6 years ago

I am also really looking forward to moving some of my projects to EF Core. Really love this tool and rely on it every day.

ClassyCircuit commented 6 years ago

EF Core support would be great, I also would like to use it.

kinetiq commented 6 years ago

@sjh37 At this point, if you crowd funded the conversion, I bet you could make bank. :)

sjh37 commented 6 years ago

@kinetiq I already have most of the code for it from a contributor. I just need to digest and incorporate it properly. Lots of things went missing in EF core, such as the pluralisation service for one, so that had to be re-created, which I have now :-)

dyardyGIT commented 6 years ago

Any ideas when ef.core version release? Really nice!,

ErikEJ commented 6 years ago

In the meantime you can use EF Core Power Tools (not as powerful as this template) https://github.com/ErikEJ/SqlCeToolbox/wiki/EF-Core-Power-Tools

viveknuna commented 6 years ago

@sjh37 Any updates on this?

sjh37 commented 6 years ago

I will start work on this w/c 9th April.

LaurenceFrost commented 6 years ago

Great to hear that EF Core support is on the way. I use this superb tool virtually every day of my working life, and EF Core does not appeal to me until I know I can use this great tool along-side it. Your tool really is THAT GOOD :)

sjh37 commented 6 years ago

I am on holiday and will start working on this when I get back.

sjh37 commented 6 years ago

Update Coding is well underway and being done on this branch: https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/tree/EF.Core Currently refactoring everything so can generate for EF6 or Core, plus a few other architecture changes such as making it ready to read from other databases such as Oracle, MySql, PostgreSQL. So far so good, no stumbling blocks apart from having to include pluralisation within the generator as this is no longer supported by EF.Core.

f2calv commented 6 years ago

@sjh37 Sorry to bug you but any progress update on this? ...happy to help with testing

sjh37 commented 6 years ago

@f2calv Hi Alex, I've refactored it, and refactored it. I'm basically re-writing it from scratch. About half way through. Still lots of work to do. This is not a tweak of v2, but a full rewrite. I've moved it to a private repo for now as it's still in bits, and don't want any contributions to it. Slowly coming together. No ETA as it depends on how much free time I get.

sjh37 commented 6 years ago

I'm actually in the middle of adding temporal table support to the generator for EF 6....

kachalkov commented 6 years ago

one question is how the whole EF Core T4 going work together as T4 is not supported in .NET Core :( we are looking at any options and the only one which seems to work out of the box is this one:

https://github.com/iQuarc/Geco

dhazel commented 6 years ago

Thanks for the great tool! I also am looking forward to the EF.Core version.

sjh37 commented 6 years ago

I started getting contributions to the ef.core branch even though Iā€™m in the middle of refactoring & changing it. So I closed the branch and move it to a private repo so I could continue on without people wanting to continually change it before Iā€™ve even finished. So donā€™t worry if you've seen the ef.core branch being removed, itā€™s 100% going ahead, just other things keep getting in the way.

Itā€™s been on hold as things have been crazy busy my end work wise, including applying for a new job. So have had my head down in architecture, Togaf, design patterns, DDD, hexagonal architectures, you name itā€¦

Iā€™m also writing a C# 7.x course for a popular on-line training provider, and they have deadlines to meet, so again this has pushed ef.core back.

No news on T4, and Iā€™m still going to progress on that, and if that doesnā€™t pan out, Iā€™ll investigate Roslyn and/or adding an extension to the ā€˜dotnetā€™ command, something like ā€˜dotnet reversepoco settings.fileā€™. However someone guys from Turkey have sent me a modified version of the generator that works in Ef.core and utilises T4...

Really sorry Iā€™ve not managed to progress as fast as Iā€™d like.

kachalkov commented 6 years ago

No worries Simon, job is important and sort out other things first! T4 for EF core would great! Best regards, Alex

svernyi commented 6 years ago

@sjh37 How's progress been with the T4 file from those blessed Turks? How much beer do I need to buy you? Good luck, mate.

kinetiq commented 5 years ago

Just wanted to chime in that I hope we get EF Core support at some point. I would pay money for it.

darrenprunty commented 5 years ago

Looking to use this tool for a new upcoming project but would like to try and use Core if possible. Will need to use .NET for the interim until it's ready.

Any indication?

sjh37 commented 5 years ago

Good news: I'm back working on it. Bad news: Still a few months away yet. I've basically ripped it apart, completely refactored it and am currently in the middle of putting it back together. The new version will work with ef6/core, plus will have the ability to support other databases too. Sorry it's taken so long, wish I hadn't signed up to create another online course, but that is done now so my focus is back on efcore.

cyberbobcity commented 5 years ago

Whatā€™s the new course? On Nov 13, 2018, 9:43 AM -0600, Simon Hughes notifications@github.com, wrote:

Good news: I'm back working on it. Bad news: Still a few months away yet. I've basically ripped it apart, completely refactored it and am currently in the middle of putting it back together. The new version will work with ef6/core, plus will have the ability to support other databases too. Sorry it's taken so long, wish I hadn't signed up to create another online course, but that is done now so my focus is back on efcore. ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

kinetiq commented 5 years ago

Glad to hear it!