3 ms·
I find myself writing at least 5-10 times as much code compared to Python/Django. With the Django ORM once you design your models you already have at least 80%
by bayesian_horse 5y ago
I find myself writing at least 5-10 times as much code compared to Python/Django. With the Django ORM once you design your models you already have at least 80% of the logic for a CRUD REST API, form validation, CRUD admin interface (if you want that), and you can easily integrate all sorts of third party features for almost no effort. Migrations are a bit saner because of the App separation, data migrations are a possible.
- atraac 5y agoYou can achieve nearly the same thing by creating your Entities, generating migration from them with a single command, migrating your db with another one(or from code on startup) and returning them directly from Controller's method using DB Context. It's honestly not that much more work. It's far from a recommended approach though... Granted, Django Admin is pretty nice and although there are few nugets that try to achieve that I never found them as easy as in Django.
- bayesian_horse 5y agoAt least in the codebase I work on, I need to create an IRequest/IRequestHandler/Validator class triplet for every single endpoint, each in its own files, including all the lines with single braces and using statements for all the magic extension methods and dependency injection constructors. And often I need to add new ViewModels because the mapping doesn't work correctly. DRF is much more convenient.
- atraac 5y agoWell this is because you decided yourself to go that route. Amount of work would be the same in Django if you decided on this particular architecture there. It doesn't change the fact that if you want to do a simple CRUD you can do it equally easy in almost every popular web framework these days, just yolo that shit into your Controller and be done with it. What you're doing is way more maintainable though, especially if you work with an actual team.
- NicoJuicy 5y agoThat's not EF. That's typical cqrs, lol. Here's a scaffolder as an example if you want to automate things like that: https://github.com/ArmandJ77/CQRSAndMediator-Scaffolding https://github.com/ArmandJ77/CQRSAndMediator-Scaffolding
- NicoJuicy 5y agoI don't think you know it very well. You need to add the correct attributes to your class for form validation ( eg. Required / StringLength ) Then scaffold a MVC controller or an api controller ( It will add the class to your DbContext) Then add-migration / update-database for your migration. And it's done
- bayesian_horse 5y agoWhich leads us to the topic of documentation and on-boarding. And it's still a ton of more code to write, read and maintain.
- NicoJuicy 5y ago? No it's not. Autogenerated migration files that you don't need to touch and 1 class to describe the model + 1 auto inserted line in the DbContext
- sebazzz 5y agoYou can't compare Django to EF Core. Django is more like Visual Studio Lightswitch, which has been killed off.