Angius
Explore posts from serversAdding Blazor to an existing Razor Pages project
I decided that messing around with SSR and JS for the admin panel is not worth the hassle and I'll just make it with Blazor. I don't care about the bundle size, I don't care about SignalR connections, seems to be a perfect fit.
I think I did everything correctly, but I'm still getting errors out the wazoo.
but going to
/panel
results in the following:
With the whole log being https://pastie.io/bcixjg.yml3 replies
`Microsoft.Extensions.Logging` and Serilog compatible timing library?
I'm currently using https://github.com/nblumhardt/serilog-timings to log how much time a given operation took. It was nice and all when I was using a static logger, but I wanted to switch to an injected
ILogger
instance.
Problem is, SerilogTimings
works on a Serilog.ILogger
instance, not MEL.ILogger
which feels kinda smelly to me.
Is there any other library I could use with Serilog and MEL that would let me easily time whatever operations?4 replies
Getting route data from a WebAPI without Swagger
The way I'm currently generating TS clients, is I use NSwag to get the OpenAPI spec, then I have a tool written in JS that parses that json and generates TS clients. I was thinking of eliminating some steps from that, though.
The way I see it, I should be able to make a console app that references my WebAPI project, and somehow get the route data from there. All nicely typed and all. Bypassing Swagger completely.
Can't figure out how, though
15 replies
✅ SkiaSharp canvas scale not scaling
I have a method that takes an
int[,]
array with ones and zeroes. Based on that, I want to create an image, that is optionally resized and blurred.
Creating the image at 1:1 scale works, blurring it works as well, but for the love of me I cannot get it to scale...
5 replies
Is there any way to *conditionally* set a property with EF `.ExecuteUpdateAsync()`?
Right now, I'm doing
but I'm not sure how would I do something similar, as in, something that avoids setting
x.Name = x.Name
, with the Execute method. Something like
but no such thing seems to exist.20 replies
❔ Azure DevOps repo remote unpack failed
I have a Git repo set up, it's an UE5 project which means large binaries, and Azure repos have unlimited size, so that's why not Github.
I'm trying to push the project over SSH, but I'm getting some weird errors
23 replies
❔ Windows - system restore on PC shutdown
Not a C# question, I know, but I've no idea where else to turn to lol
Students at my school do all sorts of stuff with the PCs. Weird wallpapers, meatspin in autostart, weird bat files, installing Roblox, all kinds of stuff like that. Not everything can be prevented with just an admin password, AFAIK.
Back in college, they had some system set up that would roll back the PC on shutdown (or was it startup?) to a set restore point. So all the software and stuff was still there, but all the settings would be rolled back, and all the newly-installed stuff would be removed.
I'd like to use something like that in this school as well, but for the love of me I cannot remember the name of the soft
12 replies
❔ Properly including XML templates in a class library
I'm writing a library for generating
.epub
files. Since they're just glorified zips with XML files inside, I'll need to generate that XML somehow. The easiest way is to just have some templates with the XML and placeholders, and run a .Replace()
on them or use some templating library.
Question is, how do I store those templates properly? Using triple-quoted string constants would be the easiest, but some of the XML is quite large. I could just store loose files and load them with File.ReadAllTextAsync()
, but not sure how well that'd work in the class lib context. Not to mention, I'd like those templates to be available at all times, I'd rather avoid reading them from the filesystem each time I want to generate an epub.
Using DI somehow is an idea, I could read the templates once and inject them as a singleton or something, but how do I even make DI work in a class lib, not knowing if the user of the library even uses DI in the first place?
I'd consider source generators and just reading files on compile time and adding them to some Template
const in each class that needs it, but source generators can't read files...
Any ideas would be welcome21 replies
❔ Ownership-based permission system...?
So, in my ASP.NET 7 app I have a system of user clubs. Each club can have a founder and members, and each member can also be a mod for that community. The roles of a founder and moderator are represented as an enum on the join table.
Now, I want to restrict some stuff to given roles. Like, only the founder can edit the settings of the club, and only the moderators or founders can kick or ban users. And you need to be a member to post there, etc.
Currently, I just add one more
.Where()
to each query that checks for the given role, but maybe there's some better solution? Some middleware or something that'd let me just slap [Authorize(PolicyNames.ClubFounder)]
onto a controller and be done with it?13 replies
Banned Symbols Analyzer partial ban [Answered]
I currently ban
DbContext.Set<T>()
methods in my project using https://github.com/dotnet/roslyn-analyzers/tree/main/src/Microsoft.CodeAnalysis.BannedApiAnalyzers
but I'd like to ban them only partially. Meaning, I want to disallow concrete types, but allow generic parameters. For example
is that even possible?7 replies