Joschi
Joschi
CC#
Created by steven preadly on 7/4/2024 in #help
✅ how can i improve this code ?
Also #code-review may be more applicable if you don't have a specific question.
78 replies
CC#
Created by steven preadly on 7/4/2024 in #help
✅ how can i improve this code ?
$code
78 replies
CC#
Created by neSHa on 6/30/2024 in #help
Dictionary translation
You could start by assuming bold text is english and non bold text the translation. But this will break on declinations like kneel, knelt and so on and also an plurals like knavery. You could then try to do more passes detecting and handling as many edge cases as possible. But somehow I don't think you will get around having to clean up your data manually in the end.
8 replies
CC#
Created by Arch Leaders on 6/28/2024 in #help
Restrict register endpoint using ASP.NET Core Identity
I believe you could write a policy and conditionally apply the requirements based on the requested route in the AuthorizationHandler
14 replies
CC#
Created by Jason_Bjorn on 6/27/2024 in #help
LINQ help
Did they by any chance elaborate on why? Because for IList<T> implementations shouldn't it be possible to just yield the content in reverse order using the index?
26 replies
CC#
Created by Jason_Bjorn on 6/27/2024 in #help
LINQ help
Reverse() indeed completely enumerates the IEnumerable<T> and copies the result into a new T[]. It then returns the elements of the newly created array in reverse order.
26 replies
CC#
Created by Angius on 6/27/2024 in #help
`Microsoft.Extensions.Logging` and Serilog compatible timing library?
And you can log traces to serilog if you really want to with Serilog.Tracing
4 replies
CC#
Created by Angius on 6/27/2024 in #help
`Microsoft.Extensions.Logging` and Serilog compatible timing library?
You could also just use traces and start a new Activity.
4 replies
CC#
Created by Adam on 6/27/2024 in #help
Making my functions more generic
An minor improvement would be to use dict.TryAdd() instead of the if followed by add
24 replies
CC#
Created by prodijay on 6/26/2024 in #help
What return method is appropriate for controller actions for SPA frontend?
You should return the most appropriate http response. For a post request that created some resource that would be 201 Created. https://ochzhen.com/blog/created-createdataction-createdatroute-methods-explained-aspnet-core For delete endpoints you could just return a 200 OK or maybe 204 No Content
3 replies
CC#
Created by Eb3yr on 6/25/2024 in #help
Looking for more performant alternatives to reflection for iterating through properties of a class
But if you create those value of off some seed, why not directly sum them then and there as well?
5 replies
CC#
Created by Eb3yr on 6/25/2024 in #help
Looking for more performant alternatives to reflection for iterating through properties of a class
Or use a source generator to generate the code for you.
5 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
We found the problem today. As one may expect it was not directly related to the implicit operator. That was just a fluke / not fully rebuilding as it seems. The problem occurred, when the operation threw a DBUpdateException. Which then lead Serilog.Exceptions to reflect and deserialize the complete DBContext. Which of course itterated over all datasets, fetching the entire database. But all this happened, before it even logged that an UpdateError occurred or the exception bubbled to the top, which made it hard to find. That's a known problem and Serilog.Exceptions.EfCore provides a destructerer, which seemingly needs to be set explicitly in code.
18 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
I know it's sparse, I don't have access to discord and the code on the same machine
18 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
My best guess would be something in some middleware. But I have no idea what this "something" could be.
18 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
No the project is sadly not public. - It is always happening. - I hope I find some time to test this. - It takes in a DTO, converts it to the db model, saves it to the db and returns the newly saved object back to the controller, but we don't reach that point.
18 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
However I'm not sure if it really sends back the data for all the different tables or just the complete table for the original MyDbObject.
18 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
The observation being the correct INSERT command being generated and send to the DB first, followed by a series of SELECT [x].Property... (all the properties of the given table) FROM [DB].[TABLE] AS [x] statements without any parameters. We know it is really send back to the client, because we discovered some malformed data in our tables thanks to some EFCore Converter crashing in the process of converting the database value. And also the RAM constantly going up.
18 replies
CC#
Created by Joschi on 6/24/2024 in #help
✅ EFCore fetching all data in nearly all tables after a single insert
We log the EFCore SQL commands in development.
18 replies
CC#
Created by Mawral on 6/15/2024 in #help
Difficulty with Blazor Server chat app
Iirc. singleton services in blazor server share state between connections.
5 replies