Earlier quoted context omitted.
> 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 toge…
You just add middleware before you register any controllers (or, leave out all that stuff entirely)
Understanding the .NET ecosystem: The evolution of .NET into .NET 7
251–260 of 357 posts
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#252Earlier quoted context omitted.
You don’t have to use migrations, it’s an optional feature. It works equally well to just generate entities from an existing database, that is migrated/set-up in any other way (as long as the schema is not crazily complex).
Not my project/not affiliate but Evolve is wonderful for handling db migrations
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#253Earlier quoted context omitted.
For performance, .NoTracking() and not calling .SaveChanges() on every loop already does wonders. I usually call .SaveChanges() when i % 20 == 0
We'll need tracking (if I understand correctly, we need previous values). When calling SaveChanges often, how do you handle rollback in case something fails?
Works faster than with .Tracking. The SQL script runs in your transaction, so rollback runs as usual.
The i%20==0 condition with .SaveChanges() is used with .Tracking(), yes.
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#254Earlier quoted context omitted.
Everything but the debugger sadly
I 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.
I'm not sure why they do not open source the debugger. I suppose it is obvious to some extent that some companies (JetBrains) are able to charge for high quality tooling. Microsoft makes a trickle of money from Visual Studio professional.
Though the objective function and decision variables are somewhat opaque, this is clearly an optimization problem.
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#255C# is still one of my favorite programming languages (including syntax, semantics, and standard libraries). Although it is a bit complex now, it has also created many excellent designs such as async, await, and so on.
VS and VS Code are also IDEs that I still use today, although I rarely write C# code.
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#256Earlier quoted context omitted.
I'm interested in this case! I have a bit app: Razor, MVC, EF, custom nuget packages, reflection, very advanced expressions ( linq) and my IoC is Autofac ( .net 4.7.2). 101 projects in one solution. Have you got any pointers on gotchas? Did a quick attempt ( 1 evening) and got blocked on my nugets+ Autofac.
> 101 projects Yikes. This is in C# I assume? If in VB, I'd run one project through Instant C# and see how many problems you encounter. There are lots of VBisms that are simply not in C# (like statement for one, xml literals, etc...). Run the simplest project through the `upgrade-assistant` tool. It'll convert it to .NET Core. I saw the sibling post recommend .NET Standard, but if you don't plan on using anything leg…
It's c# yeah. But I believe the project is much cleaner and frankly better to understand than all other projects i've encountered for this size. I'm using DDD, so DDD knowledge is a requirement to navigate this in a breeze :) :
- https://snipboard.io/D03VWg.jpg - General overview of the architecture. Small fyi: Connectors => Autogenerated nugets to call the api's
- https://snipboard.io/9M24hB.jpg - Sample of Modules + Presentation layer
- https://snipboard.io/ybp6EH.jpg - Example of Specifications related to catalog ( = products )
- https://snipboard.io/lE9vcK.jpg - How specifications are translated to the infrastructure ( here I'm using EF, so I'm using Expressions a lot), but plain old SQL is also supported. A query is basically a list of AND/OR Specifications where a hierarchy is possible. This would translate to "(QUERY 1 ) AND ((QUERY 2) AND (QUERY 3))" in the Infrastructure layer.
- https://snipboard.io/7rVBpk.jpg - . In general, i have 2 List methods ( one for Paged queries and one not for Paged queries)
Additional fyi: Is V2, so has some legacy code. Uses my own STS. Has 2 gateways ( the ShopGateway that is used to develop new sites and the BackendGateway for the Backend). Enduser frontend is in MVC for SEO purpose, Customer backend is in Angular ( SPA). The basket is a NoSql implementation on top of SQL server.
The enduser frontend supports a hierarchy of themes ( so it's insanely flexible to create variations of pages for other clients).
There are more projects involved outside of this solution, eg. nuget repo's usable accross solutions (JWT, Specifications, ...) and "plugins" for a standalone project that is installed for end-users for syncing local data. So it's +101 projects :)
It's used for eg. https://belgianbrewed.com/
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#257Earlier quoted context omitted.
I'm interested in this case! I have a bit app: Razor, MVC, EF, custom nuget packages, reflection, very advanced expressions ( linq) and my IoC is Autofac ( .net 4.7.2). 101 projects in one solution. Have you got any pointers on gotchas? Did a quick attempt ( 1 evening) and got blocked on my nugets+ Autofac.
Getting all your private nugets onto .NET standard 2.0 first will help immensely. You can add precompiler directives for anything strictly incompatible. After that it’s just the usual dependency hell that plagues every modern ecosystem. Also have a look at the MS upgrade/migration guides for .NET. They’re exhaustive and extremely helpful.
I'll have another try later this year probably :p
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#258Earlier quoted context omitted.
You just add middleware before you register any controllers (or, leave out all that stuff entirely)
This works in practice, but comparing to Python, it's like pulling in Django when all I need is in the standard library (although some people do and their projects are successful, that's for sure). I just don't want to bring a whole industrial grade CNC machine to do something a handsaw would be perfect for.
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#259Earlier quoted context omitted.
I'd kill for anything close to EF for Node. Selecting complex structures from a database in any of the existing JS ORMs is just painful.
I've enjoyed the ORM in adonisjs: https://docs.adonisjs.com/guides/models/relationships#preloa... Having used it on an actual product and dealing with some of the pain points, it's my go-to since the typescript version (v5) came out. The ORM uses Knex.js internally, which is very simple to drop into if you just want a query builder. Having Knex be accessible also makes it simple to just write your query in plain sql…
Re: Understanding the .NET ecosystem: The evolution of .NET into .NET 7
#260Earlier quoted context omitted.
> 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.
I'd kill for anything close to EF for Node. Selecting complex structures from a database in any of the existing JS ORMs is just painful.