SleepWellPupper
SleepWellPupper
CC#
Created by xdd on 2/16/2025 in #help
Web api
I don't have a good project but that's a cool dog, thanks for posting.
6 replies
CC#
Created by Jacko on 2/10/2025 in #help
Securing a plugin system:
Using: <PackageReference Include="DotNetIsolator" Version="0.1.0-preview.10032" /> Here's a MVE for WASM sandboxing in dotnet. Maybe this is useful to you. Steve Sanders has a video on his YT channel on the package. https://github.com/SleepWellPupper/ConsoleApp1/blob/4d638be8f6f895532718b82bcb04647ea468d5d0/ConsoleApp1/Program.cs#L233-L304
43 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
It does, so you don't have to worry about the finalization stuff.
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
forget about that public void Dispose() => foo.Dispose(); is fine if your disposable dependency (_transferUtility) is managed (i.e. implements IDisposable itself).
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
yep, that makes sense. Still, you could inject both IAmazonS3 and TransferUtility and not deal with disposal in your service.
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
if you resolve your service from a di container then that would be responsible for disposal. Other than that, your Dispose implementation is fine.
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
What I mean by "injecting TransferUtility instead of IAmazonS3" is that you replace your constructor parameter from IAmazonS3 to TransferUtility and leave the disposal to whatever is creating your S3Service
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
What're you trying to paste?
25 replies
CC#
Created by C@NYON⭐ONL!NE on 2/6/2025 in #help
✅ Will I fall into a gotcha with this constructor?
Since S3Service is newing up the TransferUtility, it owns its lifetime. Therefore, you should either implement IDisposable on S3Service, or move ownership by injecting TransferUtility instead of IAmazonS3.
25 replies
CC#
Created by Jacko on 2/3/2025 in #help
Question about Dependency Injection:
How will they register plugins? Are you going to load them via reflection and then register into your container?
74 replies
CC#
Created by Faker on 2/5/2025 in #help
✅ meaning on dependency injection in C#
Hey @Faker I see you're on quite the learning journey from all your posts. If you want to read more about DI, I can highly recommend this book: https://www.oreilly.com/library/view/dependency-injection-principles/9781617294730/ It is in my opinion one of the best books any dotnet (or OOP in general) developer should read.
14 replies
CC#
Created by Jacko on 2/3/2025 in #help
Question about Dependency Injection:
The answer is in tebes replies and my linked article: Are you writing a library/framework to be consumed by 3rd parties? Use MEDI. Are you writing a library/framework/application to be consumed by you/your company alone? Use your container of choice.
74 replies
CC#
Created by Jacko on 2/3/2025 in #help
Question about Dependency Injection:
My meaning was that MEDI is inferior to anything that isn't "exactly what ServiceCollection (the implementation) provides". For me that means - Decorators - conditional registration - registration validation & analysis - generic registration which MEDI does not support, and SimpleInjector does. So SI it is for me.
74 replies
CC#
Created by Jacko on 2/3/2025 in #help
Question about Dependency Injection:
This is correct but also the crux of the problem as not a single large third party DI container can correctly implement the abstraction; it is leaky as hell. So the only real option for library authors is to stick to MEDI and application authors can go write a bunch of integration logic to use their container of choice (thanks MS) https://blog.simpleinjector.org/2016/06/whats-wrong-with-the-asp-net-core-di-abstraction/ specifically:
there will definitely be behavior differences between the Autofac DI container and the Microsoft DI container. We’re not trying to behave identically – if you choose to use Autofac as your backing container, you’re also choosing the Autofac behaviors. The difference in behavior you found is one of probably many
and
Considering that Microsoft’s DI Container is heavily influenced by Autofac’s design, it is a telling sign that even Autofac can’t comply with the abstraction.
You will likely inevitably run into issues like those described in the article. That said, I will choose SimpleInjector as my container of choice because it is objectively superior to MEDI given my usecases.
74 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
44 replies
CC#
Created by Fine Action. on 1/30/2025 in #help
just got visual c# step by step by john sharp 2022 release, anyone else?
I'm also like this. Do you have an ISBN for the book you're reading?
11 replies
CC#
Created by Fine Action. on 1/30/2025 in #help
just got visual c# step by step by john sharp 2022 release, anyone else?
WHat's the "yellow book"?
11 replies
CC#
Created by workani on 1/31/2025 in #help
✅ How to avoid creating same CRUD Commands/Queries for different entities | MediatR, ASP.NET
That is, create a set of generic crud commands/queries and then use them with the entity type you're interested in at the time.
54 replies
CC#
Created by workani on 1/31/2025 in #help
✅ How to avoid creating same CRUD Commands/Queries for different entities | MediatR, ASP.NET
You could also use generics:
class GetAllQuery<T>;
record GetAllResponse<T>(IReadOnlyList<T> Entities);
class GetAllQuery<T>;
record GetAllResponse<T>(IReadOnlyList<T> Entities);
54 replies
CC#
Created by Cyclomatic on 1/29/2025 in #help
IoC and messy factory methods
I don't know what you mean by that.
25 replies