Thalnos
Thalnos
CC#
Created by Pastafartian on 4/21/2025 in #help
Struggling with Securing Environment Variables in Deployed Desktop Apps
"AWS Secrets Manager" seems to be it
18 replies
CC#
Created by Pastafartian on 4/21/2025 in #help
Struggling with Securing Environment Variables in Deployed Desktop Apps
I'm pretty sure AWS has a keystore equivalent to Azure Key Vault where you can store secrets securely and read them from there
18 replies
CC#
Created by Thalnos on 4/10/2025 in #help
✅ Help with an Algorithm on time intervals
Dictionary<(TimeOnly, TimeOnly), int> GetAvailabilities()
{
var result = new Dictionary<(TimeOnly, TimeOnly), int>();
var distinctOrderedTimes = availables.Values
.SelectMany(interval => new[] { interval.Item1, interval.Item2 })
.Distinct()
.Order()
.ToList();
var intervals = availables.Values.ToList();
for (int i = 0; i < distinctOrderedTimes.Count - 1; i++)
{
var start = distinctOrderedTimes[i];
var end = distinctOrderedTimes[i + 1];
var count = 0;
foreach (var (intervalStart, intervalEnd) in intervals)
{
if (intervalStart <= start && intervalEnd >= end)
count++;
}
if (count > 0)
result[(start, end)] = count;
}
return result;
}
Dictionary<(TimeOnly, TimeOnly), int> GetAvailabilities()
{
var result = new Dictionary<(TimeOnly, TimeOnly), int>();
var distinctOrderedTimes = availables.Values
.SelectMany(interval => new[] { interval.Item1, interval.Item2 })
.Distinct()
.Order()
.ToList();
var intervals = availables.Values.ToList();
for (int i = 0; i < distinctOrderedTimes.Count - 1; i++)
{
var start = distinctOrderedTimes[i];
var end = distinctOrderedTimes[i + 1];
var count = 0;
foreach (var (intervalStart, intervalEnd) in intervals)
{
if (intervalStart <= start && intervalEnd >= end)
count++;
}
if (count > 0)
result[(start, end)] = count;
}
return result;
}
5 replies
CC#
Created by Thalnos on 4/10/2025 in #help
✅ Help with an Algorithm on time intervals
I was able to solve it. I just seperated the problem into two steps, first building all the intervals, and then checking if there is an entry within an interval. It's maybe not the best optimal solution but it does the job 😊
5 replies
CC#
Created by Thalnos on 4/10/2025 in #help
✅ Help with an Algorithm on time intervals
can you ellaborate pls?
5 replies
CC#
Created by Mormon Son on 4/8/2025 in #help
WPF Datagrid scrolling
I guess when you don't find a way you could go back to the good old pagination instead of virtual scrolling
2 replies
CC#
Created by AlisterKB on 4/7/2025 in #help
Hangfire implementation in Repository pattern
yes that's what I was referring to 🙂
8 replies
CC#
Created by AlisterKB on 4/7/2025 in #help
Hangfire implementation in Repository pattern
two*
8 replies
CC#
Created by AlisterKB on 4/7/2025 in #help
Hangfire implementation in Repository pattern
and on a side note, when you gotta include the words And or Or in a method name, then you are violating SRP. You should seperate those to responsiblities into two seperate methods
8 replies
CC#
Created by AlisterKB on 4/7/2025 in #help
Hangfire implementation in Repository pattern
Aggregates (or I believe more commonly people call them entities)
just for clarification, Aggregates does not mean the same thing as entities. Aggregates consist of entities but not every entity is an aggregate or even is part of an aggregate. Say you have an Order entity that consists of items and is made by a customer:
public class Order{
public List<OrderItem> Items { get; set; }
public Customer Customer { get; set; }
}
public class Order{
public List<OrderItem> Items { get; set; }
public Customer Customer { get; set; }
}
Order, OrderItem and Customer are all entities but they're not aggregates. There is only one Aggregate here which is Order and OrderItem. An aggregate defines boundaries for a set of entities in what way you should interact with said entities. Here it means that OrderItem should only be accessed using over the Order entity because thats the Root of the Aggregate. Customer is not part of that aggregate
8 replies
CC#
Created by AlisterKB on 4/7/2025 in #help
Hangfire implementation in Repository pattern
if my understanding of Clean Architecture that you seemingly try to implement and DDD is correct then your App.Domain should not hold such IJobRepository interface but only Domain Models. then your Infrastructure uses domain model object as input for Create, Update and Delete operations instead of values, and it returns domain model/-s on Get methods. This is how you pass values through your layers, they are contained in your model that Infrastructure returns to Application on a Get, or respectively that Application passes to Infrastructure on a Create, Update, Delete. So thats where you get the string from and how you set it. If you need the hanfire.AspNetCore thing in Application to create the model and pass it a string that you need, so that you can call Create() of your Repostirory then yes I think that's where it belongs. And doing a quick glance on what hangfire is, a way to perform background processes, that should generally be part of the Application Layer, the Infrastructure Layer would persist those jobs in your Postgres DB and nothing more
8 replies
CC#
Created by Adrian on 4/7/2025 in #help
State of caching in EFCore 2025
well if memorycaching is what you need, there is also distributed caching and hybrid caching https://learn.microsoft.com/en-us/aspnet/core/performance/caching/overview?view=aspnetcore-9.0
9 replies
CC#
Created by Adrian on 4/7/2025 in #help
State of caching in EFCore 2025
IMemoryCache is the right way to do it
9 replies
CC#
Created by Edup on 3/20/2025 in #help
Repository Pattern and Clean Architecture
gc overhead is not somethign I care about ^^
46 replies
CC#
Created by Edup on 3/20/2025 in #help
Repository Pattern and Clean Architecture
it will be garbage collected when the program leaves the scope you were in
46 replies
CC#
Created by Edup on 3/20/2025 in #help
Repository Pattern and Clean Architecture
well I'm doing a projection anyway then to some DTO or ViewModel or whatever, so even if it would be tracking the materialized entity it would be garbagecollected when the obj is out of scope anyway. So you gotta then map back to a domain model on your update, which seems fine
46 replies
CC#
Created by Edup on 3/20/2025 in #help
Repository Pattern and Clean Architecture
but when I pick specific properties in the Select then EF will translate it to select prop1, prop2, prop3 opposed to select * will it not?
46 replies
CC#
Created by Edup on 3/20/2025 in #help
Repository Pattern and Clean Architecture
but you don't have to overfetch, you can just select or update what you want
46 replies
CC#
Created by Edup on 3/20/2025 in #help
Repository Pattern and Clean Architecture
wouldn't that kind of violate the core idea behind an ORM, that each table maps to a class in your code, and each class in your code maps to a table? In case of inheritance it makes sense if you use Table Per Hierarchy approach then multiple inherited types would be in the same table, but besides that I think thats not a good idea, messes with the simplicity of an ORM. There seems to be a way to do this https://learn.microsoft.com/en-us/ef/core/modeling/table-splitting#table-splitting But then I would rather seperate into different DTOs, ViewModels or whatever the context than into different Domain Models and select only what's needed for the mapping tho 🤔
46 replies
CC#
Created by Faker on 3/21/2025 in #help
✅ DateOnly.TryParse Vs DateOnly.TryParseExact use cases
as for the use cases. When you have control over the format of the string, then use TryParseExact to enforce a consistent style. When the format may vary, use TryParse
8 replies