DEV Community

loading...

Discussion on: Which would be better for career: Laravel or .NET Core?

Collapse
dgvai profile image
Jalal Uddin Author

Can I get some opinions from you brother, since you have used both of them?

  1. Does .NET uses clean code strategy/pattern like Laravel does?

  2. Does .NET have ORM like Eloquent ORM in laravel? So far I have known something like Entity framework, is it same one like Eloquent?

  3. Does .NET has DB migration builders like Laravel has, which will be compatible for any DB which I will define in config?

I would be pleased if you reply :) Thanks.

Collapse
theonlybeardedbeast profile image
TheOnlyBeardedBeast

I think lanzorg answered a lot, regarding to the migrations it is even easier for .neg you just change the model and call a cli command, it automatically generates migrations. Entity framework is amazing, really EZ to do complex queries. There are a lot of adapters for different databases to use width entity framework.

Collapse
lanzorg profile image
lanzorg • Edited

The webapi template of ASP.NET uses OpenAPI and the HATEOAS pattern by default now for really clean architecture, Laravel and Lumen don't and it's kinda a pain to do GraphQL or gRPC APIs. Laravel has recently created Jetstream for seamless frontend development but it's still pretty young. Furthermore, ASP.NET Blazor with SSR and WebAssembly is so productive and don't think we can do better.

The coolest stuffs in Eloquent are practically all built in the C# language itself. Migrations exist since the first ASP.NET releases. There are interactive CLI tools like Laravel too, but a lot of devs create them inside Visual Studio because managing thousands of models/entities and their relations is much easier graphically.

I think Taylor created Laravel because .NET was closed source and Symfony was too corporate for him, but now that .NET is fully open source... Moreover, VSCode that is FOSS has an amazing .NET support, most of the time better than the expensive PhpStorm + Laravel Idea combo for PHP/Laravel.

Thread Thread
dgvai profile image
Jalal Uddin Author

My day 2 of learning .NET Core,
*. I have been creating Models like a normal class and defining its props, then adding the repository and it's interface class, that's ok until you go into multiple model and you see code duplication.
*. I wanted to know, that, all models do have some default props like ID, created_at, updated_at and some CRUD ops, like create, find, update, delete, etc, and those I have to implement here (in my beginner case) manually by creating classes. Isn't there any NuGet Packages that does handle this ORM so it saves production time?

Thread Thread
theonlybeardedbeast profile image
TheOnlyBeardedBeast • Edited

crate a base class which has all these properties you need everywhere, then all the new models should extend this base class. You can create a base generic repository using generics. But basically the entity framework contains all these operations if you succesfully created a databasecontext, you can easily do all the things.

I created a snippet for you with these things: github.com/TheOnlyBeardedBeast/sni...

You just need to update the generic repository so it should be based on the BaseEntity class, and then you can add additional logic to the update methods (updating updatedAt property) or you can add a findById method