12 ms·
Been using .NET for years now for backend web development after having taken a break from C#. It is such an improvement over the old .NET framework. When I star
by cyral 4y ago
Been using .NET for years now for backend web development after having taken a break from C#. It is such an improvement over the old .NET framework. When I started building my first backend with it, I was surprised how much was included and "just worked". Need to add authentication? Few lines. OAuth? Also built in. Response caching? Yes. ORM? EF Core is pretty good. Need to use env variables to override your JSON config? You are going to have to build a... just kidding that works with one more line too.
Coming from NodeJS, the amount of stuff that could be added with a single line from an official package was great. No more worrying about hundreds of unvetted dependencies.
- sylens 4y agoIt really is like finding enlightenment after having to figure out which third party package is best for every little thing in Node. Visual Studio is a pretty powerful IDE as well.
- LelouBil 4y agoJetbrains Rider is great for .NET too, although I didn't try backend developement with it.
- alexzeitler 4y agoI’m using it for backend work day in and day out and it’s a joy.
- andix 4y agoIt’s awesome. What I enjoy most is, that all the different tools feel the same, and you can use the same kind of IDE also for web developmen, JavaScript and SQL. Rider also has webstorm and datagrip bundled as a plug in, so you can also do everything in one IDE. I prefer though to use the standalone tools for that, they have just less features than rider/IntelliJ, but i would consider that a plus. Less menu items, less tool windows.
- cyral 4y agoThe Datagrip integration is so cool whenever I need to write raw SQL queries inside Rider
- warent 4y agoI'm a web developer that has used VS Code for years, but these past few months have been using Rider for developing a Unity project. One thing that really stands out to me about Rider is the "Refactor" (Ctrl+Shift+R) feature; extremely useful. It allows you to just build things rapidly without worrying much about patterns/naming because once your vague ideas solidify and you realize where you went wrong, it's really easy to just Ctrl+Shift+R and make any codebase-wide adjustments instantly. It's also great about picking up sub-optimal implementations or patterns with helpful warnings, and you just Ctrl+. to have it auto-fix for you. Using these Rider features combined with Github Copilot, I was able to pretty easily learn intermediate level C# because it's like having a mentor working along side you.
- Semaphor 4y agoI migrated a while ago from VS + ReSharper to Rider. Mainly backend work. It’s been great.
- dingi 4y agoExcept botched C# style rules. Rider still insists on Java style guidelines for .net projects. And sometimes, it spawns a never ending background process that only way to get rid of is to restart the app. Otherwise, it's okay. edit: been using Rider on Linux since a few years now
- sebazzz 4y ago> Rider still insists on Java style guidelines for .net projects. No, it uses Resharper as the backend.
- moonchrome 4y agoI've been using Rider style rules for two years now exclusively in a VS based team and aside from some linebreak rules I need to tweak here and there I've seen no issues ? But I use a .editorconfig tuned stylecop and roslynator on all projects so maybe that overrides some defaults. Mind sharing which Java style rules are you seeing ?
- dingi 4y agoRider highlights pascal cased class methods/attributes and suggests to use camel case, for example. I haven't changed any style settings. This is Rider default. Maybe its a Linux thing.
- moonchrome 4y agoThat's just a few .editorconfig lines away from begin consistent for the whole team.
- older 4y agoYes, since VS2022 became 64-bit app it is much more pleasant to use now.
- nonethewiser 4y agoIt better be at a 30GB install size.
- zip1234 4y agoA 2TB nvme drive is less than $200. If VS is saving significant dev time, people would install it even if much larger install.
- waboremo 4y agoI'm not sure it's 10x as nice as competitors, which is the context here. If it were just about space who cares, but when your competitor does the exact same at a much smaller size and ultimately better price too, it's a little confusing what is going on with VS.
- Rapzid 4y agoIt needs to be 10x nicer to make up for a 10x disk space footprint? What if it were only 1GB and the competitors were only 100Mb? Would it still need to be 10x nicer?
- pjmlp 4y agoThe competitor doesn't ship a full OS SDK for all kinds of development. Go see how much GB, Apple or Android development stacks require.
- Nullabillity 4y ago$ pacman -Qi emacs | grep Size Installed Size : 111,46 MiB
- pjmlp 4y agoI guess if anything you is Emacs Lisp, targeting the Emacs OS, then ok.
- 4y ago
- SiVal 4y agoCan you install it [edit: the .Net 7/8 platform that sounds interesting, not the IDE] for free on a Linux server and get the same benefits? (This isn't advocacy, it's a literal question about something I don't know.)
- SgtBastard 4y agoYes: https://learn.microsoft.com/en-us/dotnet/core/install/linux https://learn.microsoft.com/en-us/dotnet/core/install/linux Also VS Code, an open source IDE with first class support for .NET languages: https://code.visualstudio.com/docs/setup/linux https://code.visualstudio.com/docs/setup/linux
- all2 4y agoAlso emacs has a pretty good csharp language server integration. I personally use the Spacemacs "dotnet" layer.
- osigurdson 4y agoYes, everything is completely free, open source.
- Kipters 4y agoEverything but the debugger sadly
- lll-o-lll 4y agoI know! How crap is that? As a result, no debugging on a Raspberry PI. It turned me right off C# outside of work. There are plenty of other languages that are better suited for hobby development.
- Rapzid 4y agoThe why is Visual Studio. The VPs running that div are a bunch of Muppets who are constantly trying their best to destroy the OSS .Net projects reputation. The cynic in me suspects all the drama was directly related to Scott Hanselman suddenly losing interest in bloggin.
- magicalhippo 4y ago> ORM? EF Core is pretty good. We're moving to .Net, and I was surprised by how poor the built-in DB stuff is. It's like either assembly or Python, but nothing in the middle. That said I've also been impressed about how nice it is to get stuff going. I used C# back in the .Net 1.1 days and yeah massive difference in ergonomics.
- alexzeitler 4y agoWhat would you like build-in db stuff to be like?
- magicalhippo 4y agoWell I mean DataTable and friends can handle master-detail for example, but you gotta do a lot of plumbing to set it all up, especially with autoincs involved. Was kinda expecting it to be less work. Ideally I'd like to supply some selects, fill up some DataTables with master-detail data, manipulate it and commit changes. But yeah, maybe I gotta check out the latest EF stuff and see if I can't convince the others...
- edandersen 4y agoDataTables are a construct from .NET Framework 1.1. You owe yourself (and would be doing your employer a massive favour) to check out EF Core.
- magicalhippo 4y agoWell that'd explain why they feel clunky :D Will def look at it more carefully.
- zip1234 4y agoEF Core: 1. load order and related line items 2. edit anything 3. call SaveChanges() Definitely check it out if you haven't recently!
- andix 4y ago
- AbuAssar 4y agonestjs provides a comparable experience for nodejs as well
- anonzzzies 4y agoWhen you update .NET libs years later, we still don’t have to change any code in our own software. With anything nodejs, even months and sometimes weeks, updates of any kind means everything breaks. Not sure how anyone builds things with it that don’t need updates outside security fixes. Smaller companies might have software running years or decades that only need security updates and not new features. A lot of our stuff is over 10 years old and needs only security updates; none of that is node (or in the npm ecosystem for that matter) as we simply have shot ourselves in the foot with that too many times already.
- dns_snek 4y agoIt's been a few years (2018?) since I used NestJS but back then our experience with it was far from stellar. It lacked documentation beyond the basic "getting started" examples (just checked, it doesn't seem like they've improved much on that front), it had quite a few footguns and as soon as we strayed off the beaten path, things tended to become painful, especially on the GraphQL side of things and general 'plumbing' like interceptors, schemas, and data validation. Internal error handling was sometimes abysmal too, a misconfiguration of certain dependencies in `AppModule` could leave the application in a broken state on startup where it wouldn't bind to its port and no error messages were printed to console. On a few occasions I had to spend an hour or more reading and understanding NestJS source code to resolve those issues, which could have been avoided if they had better internal validation and error logging in place. That's not to say it was all terrible, some aspects of it were genuinely good, but the overall experience and many hours of needless pain it caused left a really bad taste in my mouth. Back then, at least, it felt like a Lego set where the pieces didn't all quite fit together. Depressingly enough, it seemed like NestJS was the best that Node.js world had to offer which made me quit the ecosystem altogether.
- andix 4y agoThe new asp.net took a lot of good concepts from the node ecosystem and feels really modern. It has a lot of batteries included. I think .net is an awesome platform to build backends. I wouldn’t use it for frontend though. Razor and Blazor never really convinced me.
- atraac 4y agoBlazer Server is perfect for internal applications and dashboards though. It's just so easy to use, especially if you plug in any of the community made component libraries like MudBlazor. I had pure backend devs actually happily make frontend for once. It's essentially Phoenix's LiveView but in C# and that uses already proven SignalR.
- andix 4y agoFor me Blazor is a mess. It’s component system is even worse then Angular, a complete OOP-mess. Yes it’s easy to use, but some things don’t work and it takes ages to find out why. I prefer next.js for the frontends.
- drdaeman 4y ago> I was surprised how much was included and "just worked". A simple HTTP server? Maybe I'm missing something, but when I needed it I hadn't found one. I believe, the closest it has is System.Net.HttpListener which is a very different thing from your typical Golang's net/http.Server or python's http.server.HTTPServer. I believe at some point they had switched from HTTP.sys to Kestrel, so at least it doesn't need the admin privileges anymore. But this whole thing is so much related to ASP.NET it's pretty hard to figure out how to create a simplest HTTP server without anything else forced upon you (no services, no "web applications", no router, just plain and simple bare HTTP protocol handler). So my impression is that maybe .NET can make certain complex things easy, but it has some issues with keeping simple things simple.
- SgtBastard 4y ago… how often are you hand-parsing HTTP requests and hand-crafting HTTP responses one character at a time? Productive devs want the request/response wrapper objects and routing constructs to handler methods to get work done and can still drop down into fine-grained request/response crafting as and when required.
- drdaeman 4y ago> how often are you hand-parsing HTTP requests That's exactly what I don't do, and what I want to see available in a standard library. But I quite frequently implement custom request handling before any routing happens (if there's even any routing). That's super easy to do in Go, Python or Rust, but when I needed something comparable in C# I haven't found any similar composable independent pieces that I can join together in a way I see fit.
- SgtBastard 4y agoAs a sibling commenter mentioned, there’s a minimalist functional web server available out of the box, that can later have other more complex components added on: https://learn.microsoft.com/en-us/aspnet/core/tutorials/min-web-api?view=aspnetcore-7.0&tabs=visual-studio https://learn.microsoft.com/en-us/aspnet/core/tutorials/min-... It’s .NET 101 stuff.
- emodendroket 4y agoI'm definitely a fan of the "batteries included" approach, but I am ambivalent on EF because I feel like it is still a bit too magic and gets abused. Though it's not like it's a big deal to use whatever else you prefer instead (I am a big fan of the inline SQL with Dapper approach).
- setr 4y agoI stuck to DB-First model + LINQ + SaveChanges() and largely managed to keep out the magic quite successfully for a .NET6 web project last year. Records are fantastic when composing queries. I didn't touch inheritance or any fancy mapping strategies -- one table, one class. The only bit of framework-specific / hidden magic debugging I really had to do was the realization of AsSplitQuery() when creating objects composed of independent datasets, AsNoTracking() for a decent perf bump, and single group-by's are fine but when you start nesting them it gets really hairy really quickly -- they usually ended up becoming views. Otherwise change-tracking worked wonderfully for batch-updating (but everything I did was short-lived) and outside of group-bys, the LINQ -> SQL mapping (and vice-versa) was extremely predictable, in both EF Core generating the SQL I expected, and creating the correct LINQ from the SQL I knew I wanted. 9/10 would use again; inline sql is for nerds
- ithrow 4y agoWhat is DB-First model ?
- Merad 4y agoThere was a specific feature in the .Net Framework version of EF called “database first” that would analyze your existing database and generate an xml file describing it that EF would use to generate models on the fly. It was pretty horrible and thankfully isn’t supported by modern EF Core. However the term database first stuck and it’s really come to refer to any any scenario where you manage your database using a tool other than Entity Framework migrations. Could be a dedicated migration tool, Sql Server database project, whatever. Then you either create EF models to match the tables or use a tool to generate them.
- JohnCurran 4y agoI have been having a ridiculous time trying to find out just how to override an appsettings json variable (DBConnection string) with an environment variable. Could not find any good answer. What is the right way?
- JenrHywy 4y agoYou can have multiple appsettings files and are additive. Eg, you can have appsettings.production.json which only contains an override for the connection string in the base appsettings.json.
- dns_snek 4y agoI believe GP is asking about using runtime environment variables passed in through the shell or injected when starting a Docker container, i.e. the 12factor.net approach.
- password4321 4y agoProbably not the right way, but if all else fails just prefix with System.Environment.GetEnvironmentVariable("NAME") ?? ...
- Merad 4y agoConfiguration is applied in layers. If you’re using the default setup you get the following layers applied in this order: 1. appsettings.json 2. appsettings.{env}.json 3. user secrets (only in Development environment) 4. environment variables 5. command line args You can full customize the setup if you desire, there are packages to support things like external secret stores. If you Google ‘Asp.Net core configuration” there’s a MS page that goes into great detail on all of this. Anyway, your env vars must match the name as you’d structure it in a json object, but with the periods replace with double underscores. So ConnectionStrings.MyConnection becomes CONNECTIONSTRINGS__MYCONNECTION, FeatureFlags.Product.EnableNewIdFormat becomes FEATUREFLAGS__PRODUCT__ENABLENEWIDFORMAT, etc.
- JohnCurran 4y ago
- gofreddygo 4y agoComing from 10 years of spring and NodeJS development, last year of .NET has been incredible. I share that "batteries included" experience. So much useful functionality is just packed right in. And there's a lot of backward compatibility and support. So much better than spring and NodeJS.