Cydo
Cydo
Explore posts from servers
CC#
Created by Cydo on 2/16/2025 in #help
✅ Clarification on VSA
Hmm I need to look at more examples then.
16 replies
CC#
Created by Cydo on 2/16/2025 in #help
✅ Clarification on VSA
Still feels like clean architecure though, im just using a features like folder instead of making services and iservices.
16 replies
CC#
Created by Cydo on 2/16/2025 in #help
✅ Clarification on VSA
Okay so in my case, i have a Domain project and the only thing in there are all the different types for my database, and then i have a Application project where I'm trying to use VSA where i have a features directory where i have a specific folder per feature and inside of that folder, i have for example the command and query and dto and handler etc all related to that feature, and then finally I have an Infrastructure project that is for my repositorys/database conext and w.e configurations i may have like data base seeding
16 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
This would be the more performant way to do things now, since I'm only pulling data I need and then this will also allow me to my make mappings easier, since ill just be mapping an object to object 1:1 instead of doing logic like figuring out the TaskCompletionPercentage in my service and then doing a mapping.
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Ok, i left this thread open, and i went off to learn more about EF Core and all these little nuances and I have taken one of the queries in my project which was
public async Task<List<TaskList>> GetAllTaskListsInCategoryAsync(int categoryId)
{
return await _context.TaskLists.Where(t => t.CategoryId == categoryId)
.Include(t => t.TaskListItems)
.Include(t => t.TaskListAssignments)
.ThenInclude(tla => tla.User)
.ToListAsync();
}
public async Task<List<TaskList>> GetAllTaskListsInCategoryAsync(int categoryId)
{
return await _context.TaskLists.Where(t => t.CategoryId == categoryId)
.Include(t => t.TaskListItems)
.Include(t => t.TaskListAssignments)
.ThenInclude(tla => tla.User)
.ToListAsync();
}
and converted it to this
public async Task<List<TaskListOverview>> GetAllTaskListsInCategoryAsync(int categoryId)
{
return await _context.TaskLists
.Where(t => t.CategoryId == categoryId)
.Select(tl => new TaskListOverview
{
Id = tl.Id,
Description = tl.Description,
CreatedAt = tl.CreatedAt,
UpdatedAt = tl.UpdatedAt,
Members = tl.TaskListAssignments
.Select(tla => new Members
{
Id = tla.User.Id,
Name = tla.User.FirstName + " " + tla.User.LastName,
})
.ToList(),
TotalTasksCount = tl.TaskListItems.Count(),
CompletedTasksCount = tl.TaskListItems.Count(q => q.IsCompleted),
TaskCompletionPercentage = tl.TaskListItems.Count() == 0
? 0
: (double)tl.TaskListItems.Count(q => q.IsCompleted) / tl.TaskListItems.Count() * 100
})
.ToListAsync();
}
public async Task<List<TaskListOverview>> GetAllTaskListsInCategoryAsync(int categoryId)
{
return await _context.TaskLists
.Where(t => t.CategoryId == categoryId)
.Select(tl => new TaskListOverview
{
Id = tl.Id,
Description = tl.Description,
CreatedAt = tl.CreatedAt,
UpdatedAt = tl.UpdatedAt,
Members = tl.TaskListAssignments
.Select(tla => new Members
{
Id = tla.User.Id,
Name = tla.User.FirstName + " " + tla.User.LastName,
})
.ToList(),
TotalTasksCount = tl.TaskListItems.Count(),
CompletedTasksCount = tl.TaskListItems.Count(q => q.IsCompleted),
TaskCompletionPercentage = tl.TaskListItems.Count() == 0
? 0
: (double)tl.TaskListItems.Count(q => q.IsCompleted) / tl.TaskListItems.Count() * 100
})
.ToListAsync();
}
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Oh ive found the issues awhile ago, i just didnt know if i should structure my api's any different till the VSA was mentioned lol
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Okay, yeah ik about the types of querying but, im still not at the point where ik when to use which and why etc. I def fall into the preemptive optimization trap, feel like someones gonna come see one of my apps and be like holy this is crap, runs like shit and then move on
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
I had a select before, where i was selecting what i wanted and directly mapping it into a DTO, but then i was doing that in my repository layer, and i decided against it because all my mappings to DTOs are in the service layer.
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
i thought i was finally get somewhere, when i was gonna learn design patterns and CQRS and this mediator thing. xD
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
idk what any of those things are lol.
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
but minimal api lets me get shit going quicker at least
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
not sure which i prefer yet
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
exactly, except first project was MVC this project is minimal api.
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Better to finish something then to leave it incomplete cause of 'Another feature'
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
That questbound app, i got sick of and it was getting too much to manage so i cut out a ton of features g ot it in a working state and deployed it.
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
I need this mindset, im a make it perfect or dont move on idiot xD
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Even if i lose interest i make point to at least finish my app, ever since i got laid off in August ive felt like a shit developer so im busting my ass lol.
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Thanks, i am definitely not a designer and take forever to make things even look pleasable LOL
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
This project is still in the early stages, I built a project management app, https://questbound.xyz/ that was def too ambitious for my first .NET app, so i decided to take it down a peg and do a small generic todo app to really cement everything in that ive learned lol
70 replies
CC#
Created by Cydo on 2/2/2025 in #help
✅ How to get better at writing EF Queries?
Yeah this is me, everything ive learned so far has been clean architecture so I got in this mentality where its the right way, and it def makes building things take so much longer i feel.
70 replies