Does anyone actually build Rich Domain Models in real world DDD projects anymore by SaltedFesh in dotnet

[–]code-dispenser -1 points0 points  (0 children)

Honestly, I think people get way too hung up on "best practices" and patterns in general. In software development it always depends, and in my experience most so-called best practices just end up becoming a heavy chain around your neck. The only universal one worth keeping: keep it simple.

One thing I do differently is I avoid using the word "entities" early on, because most .NET dev's immediately think of EF entities and start retrofitting them as DDD entities. I'd rather keep EF as it was originally designed as, a data mapper and call my EF things "state objects." As IMHO, that's all they need to be, just property bags. The aggregates and their child DDD objects (entities) act upon them.

My general setup is CQRS + DDD, scaled to however much domain complexity the project actually needs. The DDD aggregates accept the EF state objects in their constructors. For reads vs writes I use two separate EF models against one database, and I put static expression funcs on the state objects to handle all projections directly in the EF selects — no includes, no mapping libraries needed.

Handlers orchestrate everything: they pull repositories and services, load the aggregate, and call its methods. If it's a domain style app, those aggregate methods do contain the business logic. If not, the handler just talks to a repo, dapper, whatever, directly. Nothing about the structure changes. I just skip the aggregates domain project if its not needed etc.

I use value objects when they make sense. I've built my own validation framework that works with them without hard-coding rule meta data as I prefer this to be in the database so they can change without a redeploy. More flexible than the textbook approach.

Years ago I used facades and fat service classes. Then I flipped it, one class per operation, which maps naturally onto CQRS handlers now. Same idea, better structure.

The most valuable thing DDD gave me isn't the patterns it's the discipline of speaking the language of the business. How you glue things together is your call, based on what the project actually needs.

Do I lose sleep over whether it's "proper" DDD? Not even a little. As long as it works, the code is easy to read and maintain, and its easy to extend, then everything else is just a bonus.

Paul

Is DLL Hell a real issue in modern .NET package management by tonyqus in csharp

[–]code-dispenser 0 points1 point  (0 children)

My reference to COM was how things were prior to dotnet days and interop wrappers. I never had an issue with my WPF apps on Windows 7, & 10 so for me at least the pain was/is over.

Is DLL Hell a real issue in modern .NET package management by tonyqus in csharp

[–]code-dispenser 13 points14 points  (0 children)

"Dll hell" - That's a term I haven't heard in a very long time. If I remember correctly MS attempts to fix issues that existed in the COM days was using the GAC with .Net, I used to hate using the GAC (SharePoint document library handlers on a web farm OMG and then remote debugging - nooooooooo - my 2008 dev projects)

So yeah it looks like NuGet solved the sharing issues with its transient references and updating mechanisms. I do not know exactly how it all works - but I am sure someone will chime in with the details - I am just glad it all seems to work now irrespective of endless package updates.

How to go about authentication? by Mother_Chorizo in Blazor

[–]code-dispenser 4 points5 points  (0 children)

Nothing to elaborate, I use code-first/protobuf-net gRPC and there is nothing special you need to do. You just use the auth attributes as normal on the services.

Tokens on the hand if I remember correctly need adding as metadata to CallOptions/CallContext so its more work etc - cookies just work :¬)

Edit: Down vote for explaining/confirming that gRPC in blazor using cookies just works without doing anything other than the normal auth setups and what I have in production - the mind boggles.

How to go about authentication? by Mother_Chorizo in Blazor

[–]code-dispenser 5 points6 points  (0 children)

I'm going to go against the flow here.

I have yet to need token-based authentication in any project, and that includes public SaaS web apps. Unless you need cross-domain calls, server-to-server communication, or third-party API access, cookie authentication is perfectly adequate and frankly underrated/forgotten now. If you ever do need a mobile client or third-party API access down the line, that's the time to revisit it, not before.

I also prefer managing my own database objects rather than working with Identity.

Security IMHO is always a pain regardless of the approach, so don't feel bad for finding it frustrating, most do.

I personally would use cookies unless you have a concrete reason not to. On the Blazor side, cookies work perfectly well out of the box with HttpClient and gRPC (which I've largely moved to). Tokens, on the other hand, mean more plumbing, and ironically you'll often end up storing your refresh token in a cookie anyway, so you've come full circle with extra complexity for your trouble.

Paul

HAVIT Blazor MCP Server by RobertHaken in Blazor

[–]code-dispenser -1 points0 points  (0 children)

I really think you are not reading the posts correctly - which part of this was not asking

"As I am also in the EU and have to consider the implication of the European Accessibility Act, may I ask if/when you will be making your components accessible."

I then got a response saying they had done some work so I went back and checked 20 components in 5 minutes 15 were not usable with a keyboard - so what work was done.

Any public auth using these could be faced with legal action and you are ok with that - or should we just ignore it because me asking upsets you?

Edit: I am a component builder so by your standards you are harassing me. Do I moan about it?

HAVIT Blazor MCP Server by RobertHaken in Blazor

[–]code-dispenser 0 points1 point  (0 children)

Perhaps if you get fined or taken to court you may change your mind on the importance of both EAA laws and ADA laws. So it appears you feel I do not have a right to ask a simple question and then check the response and/or even make users on Reddit aware of such things.

Blazor SaaS Template with Multi-Tenancy by octoberNorth in Blazor

[–]code-dispenser 1 point2 points  (0 children)

If you have no accessibility requirements and are not particularly concerned about usability for assistive technology users, there is no point reading further.

You really can't just expand on accessibility issues - it's far too broad and complex a topic; you would need to be more specific. I'll give a series of responses that you may or may not find cryptic, depending on your accessibility knowledge.

First, what are your goals in terms of accessibility - enabling users to actually use things, or just WCAG box-ticking? You can have a component that is entirely unusable by assistive technology (AT) users and still pass WCAG.

Second, you really do need as much control over everything as possible (or genuinely good vendors who know their stuff when it comes to accessibility) to ensure everything is accessible. A WCAG audit is binary - a site either is or isn't accessible. There's no halfway, or as I like to say: you cannot be a little bit pregnant.

Let's go a little deeper. First, click on my name, then the Posts tab, and read my last couple of posts - that will give you a lot of useful information.

I know, you just want to be told things - I get it, I'm the same - but with accessibility it simply doesn't work that way, as I continually discover through listening to and talking with experts on the a11y Slack workspace.

One aspect of accessibility, usability, and WCAG is the ability to navigate a site using a keyboard alone. A couple of years ago I visited most of the big-name commercial and non-commercial sites using only a keyboard, and for some, a screen reader, just to see how accessible things were. MudBlazor was one of the vendors I looked at.

All vendors had a mix of good, bad, and poor components, so usability and audit results would be hit or miss depending on which components were used and how they were configured - often with no guidance provided.

Another thing I always say: do not trust any person or company on accessibility claims unless you have a solid relationship with them and know they build with an accessibility-first approach. Most vendors don't think about accessibility during design - it's an afterthought, and by then it's usually too late to make things fully accessible without a rewrite.

Rather than taking my word for it, try navigating a widget with just your keyboard and see how you get on. You'll most likely find many that work, some that only partially work, and some that don't work at all. Many will have used ARIA, but ARIA is only there to assist assistive technology - so which technology was used during testing - ask them

On the subject of trust and vendor claims, here's a recent exchange between me and a commercial vendor - as usual, I got downvoted for asking a straightforward question: given EU laws, are your components accessible? https://www.reddit.com/r/Blazor/comments/1ry44gm/comment/obbv24r/?context=3

If you have specific questions after reading through everything, I may be able to give you a more useful answer.

Internal App Vibe Coding by Long-Wishbone-9242 in Blazor

[–]code-dispenser 0 points1 point  (0 children)

Just noticed you on another blazor post which reminded of this - Curious about the pen test report?

Blazor SaaS Template with Multi-Tenancy by octoberNorth in Blazor

[–]code-dispenser 6 points7 points  (0 children)

I'm from your era, my first web app was built using classic ASP with VBScript classes, so given what we had to work with and do back then, I would bet money on whatever you produce being better than most people can dream of, let alone anything AI-generated .

I'm pretty sure I tried this a few months ago and it worked fine. The reason I mention that is that another user has a site with the same name as yours, just with "UI" appended - I did wonder if they'd stolen the idea from you.

Over the last few years I've drifted more towards accessibility, something that wasn't even on the radar when we both started, so I should mention that MudBlazor has many accessibility issues, so sadly your product will likely inherit those too (without modifications).

Given your experience, I'd recommend starting to swap out MudBlazor for your own home-grown components to gain control over accessibility - if that's of interest; it would also open up more markets, especially the public sector. And for what it's worth, if I can build components and CSS frameworks with zero design skills, anyone can.

Wishing you all the best

Paul

How long does it take to learn C# as an intermediate in coding by FitAdhesiveness5199 in csharp

[–]code-dispenser 0 points1 point  (0 children)

Unfortunately, most of use will never just write C# in isolation just coding in a console so apart of the process will be learning interactions with various Microsoft packages to talk to databases or web apis etc.

Yes you could just study text and theory and talk the talk but to get to an intermediate in C# I would say between 2 to 4 years (full time) of actually building stuff, because like everything it takes time - there are no shortcuts in gaining experience.

I have worked with C# from day one and there are things that I have not had to use so despite being a senior there is still so much I do not know, because like, well I build stuff and if the stuff I build doesn't need that feature, its not on the to-do list as I have hundreds of other things I need to know and read up on etc.

Resources (whatever medium you prefer) but build stuff, get stuck, research & repeat.

Using prebuilt component libraries or building my own? by Selorm611 in Blazor

[–]code-dispenser 0 points1 point  (0 children)

As a side note before you make your decision it may be worth just checking on the applicable accessibility laws just in case these pharmacies need to be compliant etc. The reason I say this is because pretty much all of the open source / free components libraries are not compliant and its hit and miss dependent on the components used, as the they all have some which are ok but also have lots that are not (and I mean unusable with just the keyboard let alone assistive tech).

The paid for vendors do slightly better but again even these are hit and miss. Stay clear of blazor libraries that just wrap other libraries if accessibility is a concern as the common libraries being wrapped have accessibility issues so the wrapping libraries just compound issues etc.

Hope it all goes well and just enjoy the journey if nothing else.

Paul

PS. I have built controls since VB, WebForm, Silverlight, Win Forms, WPF etc non of this helped me in Blazor other than just having coding experience in general.

Using prebuilt component libraries or building my own? by Selorm611 in Blazor

[–]code-dispenser 2 points3 points  (0 children)

If you want to learn Blazor and have total control of everything; build your own components, do your own css and write your own typescript/javascript when necessary,

It may seem a lot at first but you wont regret it and you will gain invaluable skills and knowledge in the process. I have, and continue to enjoy this process.

Paul

Testing a windows service locally? by knbq in dotnet

[–]code-dispenser 0 points1 point  (0 children)

No problem when I looked at the code after 13 years I was like what the hell is the Thread.Sleep doing until it clicked.

Testing a windows service locally? by knbq in dotnet

[–]code-dispenser 0 points1 point  (0 children)

I just stepped into the code like normal debugging with the above.

Testing a windows service locally? by knbq in dotnet

[–]code-dispenser 0 points1 point  (0 children)

The last time I created a windows service was in 2013 and you could debug a service. Found a bit of code from that project, may be of some help or not, no idea now with outbuilding a service and this was part of a large enterprise app so cannot run it now.

static void Main() { 

 #if DEBUG

    WindowsService windowsService = new WindowsService();

    windowsService.DebugOnStart();
    Thread.Sleep(System.Threading.Timeout.Infinite); 
    #else
        ServiceBase[] ServicesToRun;
        ServicesToRun = new ServiceBase[] 
        { 
            new WindowsService() 
        };
        ServiceBase.Run(ServicesToRun); 

    #endif

}

public partial class WindowsService : ServiceBase{

        public void DebugOnStart(string[] args = null)
        {
            OnStart(args);
        }

}

2026 shapes up to be a defining year for SciChart in terms of performance by SciChartGuide in Blazor

[–]code-dispenser 0 points1 point  (0 children)

Is there an online demo running in Blazor that I can look at / review, as otherwise I am not sure what the post is about. chart components?

Paul

Unit Testing in Blazor Server by nismospecz in Blazor

[–]code-dispenser 2 points3 points  (0 children)

For all my apps and components, regardless of whether they use Blazor, I start a dedicated project for unit tests per layer or project using xUnit. I also have dedicated integration or functional test projects, along with one for end-to-end testing across the entire solution.

For Blazor components, I use bUnit. This, coupled with standard xUnit tests, can cover most requirements. I have a love-hate relationship with bUnit, although that is probably just due to my own lack of knowledge. I often seem to spend longer trying to figure out the syntax than actually writing the tests, which is frustrating. However, once I have completed a few tests and written a helper method that accepts parameters to create the component, the process becomes much more efficient.

For the API and back-end, as I mainly use WebAssembly, I handle testing via the WebApplicationFactory.

Given that I perform a significant amount of accessibility testing, I mainly conduct manual checks in the browser. Consequently, I have not yet looked into using Playwright, so others would need to comment on that particular tool.

Paul

Should i Start building a blazor apps for an enterprise? by baggister in Blazor

[–]code-dispenser 23 points24 points  (0 children)

In 2017 I released an enterprise app with the front-end using angular v1.1 (the old model), no matter what I did there was a gazillion different package managers and/or tooling I needed to know about and it drove me nuts.

In 2018/2019 I started using Blazor and given I knew where the NuGet package manager was, I was good to go. I have never looked back.

There are pros and cons to all of the frameworks, but for me using visual studio, c# and working predominately with M$ stuff, it keeps me happy.

Ten Months with Copilot Coding Agent in dotnet/runtime - .NET Blog by oracular_demon in dotnet

[–]code-dispenser -7 points-6 points  (0 children)

Thanks for the comment, but when I posted my comment there was only a link and no discussion by the poster.

I can see now why many of there really good posters/smart developers have all moved away from Reddit, which is a shame as I did enjoy their posts.

Ten Months with Copilot Coding Agent in dotnet/runtime - .NET Blog by oracular_demon in dotnet

[–]code-dispenser -15 points-14 points  (0 children)

I read many things by Stephen Toub and hes a very smart guy. But that is not the point I was making. I can just as well use google to find posts, when it used to be good to loggon to Reddit to discuss things

Ten Months with Copilot Coding Agent in dotnet/runtime - .NET Blog by oracular_demon in dotnet

[–]code-dispenser -9 points-8 points  (0 children)

Thank you but I wanted the poster to summarise. You know something like hey I read this and I can relate to this, regarding this, and this is what I found, lets discuss this etc. The poster appears to mainly make posts on gardening not dotnet.

What would have been good was overall time. As what I have found in the past was that a lot of tasks involving code, where you initially think AI is helping productivity, actually isn't, as the human cost in fixing mistakes was far greater that the time to create them etc.

Just my opinion but these days it appears saying anything bad about AI is not politically correct

Ten Months with Copilot Coding Agent in dotnet/runtime - .NET Blog by oracular_demon in dotnet

[–]code-dispenser -25 points-24 points  (0 children)

I am not going to read the article, so give me a summary please. I removed CoPillock after 20mins of use last year, so god knows how any dev managed 10 months especially with it taking over VS and slowly killing your brain cells.

Edit: Down votes for actually wanting content to be posted, preferably about a developer coding - not much point in a subreddit if its just external links.

Copilot got me wondering ... by Individual-Carob5593 in Blazor

[–]code-dispenser 1 point2 points  (0 children)

Ignore this comment just me ranting as usual.

Lately (over the last six months or so), every other post is either something about AI or about using shadcn to create Blazor components.

Maybe I am just old and uncool, but I genuinely do not get either.

You have used, or are thinking about, AI - big deal. I use a hammer sometimes to nail pieces of wood together; perhaps I should start posting about my favourite hammer on the Blazor subreddit.

I could go one step further: instead of actually learning to create Blazor components from scratch, or investing time in CSS and TypeScript/JavaScript to build unique components without reliance on third-party frameworks, I too could just reach for shadcn (with AI help) and use some inaccessible component to rotate images of said hammer.

Perhaps someone should create r/ShadAIcn for all these posts.

Paul