Search
Setup for Free
C
C#
•
3y ago
antimatter8189
❔ How would you write this service better?
The service
:
message.txt
7.85KB
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,147
Members
View on Discord
Similar Threads
Was this page helpful?
Yes
No
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
P
phaseshift
•
3/11/23, 8:20 PM
for starters I wouldnt return null to something expecting a list
A
antimatter8189
OP
•
3/11/23, 8:22 PM
can you point me to the method where
?
A
antimatter8189
OP
•
3/11/23, 8:23 PM
where am i returning null
?
P
phaseshift
•
3/11/23, 8:24 PM
GetUserLessons
A
antimatter8189
OP
•
3/11/23, 8:25 PM
oh yeah thats a mistake for sure
, thx
.
see anything else
?
P
phaseshift
•
3/11/23, 8:25 PM
Why do you have a repository
and
cache a list of lessons
?
A
antimatter8189
OP
•
3/11/23, 8:26 PM
Yeah thats what i was wondering about
, whats the best practice for this
?
P
phaseshift
•
3/11/23, 8:26 PM
don
't have two things for the same state
A
antimatter8189
OP
•
3/11/23, 8:26 PM
I mean if i load all user related lessons i can just place them in a private field and work on them no
?
A
antimatter8189
OP
•
3/11/23, 8:26 PM
what do you mean
? repo only performs db operations
A
antimatter8189
OP
•
3/11/23, 8:26 PM
it doesnt save an in app state
P
phaseshift
•
3/11/23, 8:27 PM
db is for saving state
. wdym
A
antimatter8189
OP
•
3/11/23, 8:27 PM
Yeah but if if i dont want to make a db call each time smth happens on the ui
A
antimatter8189
OP
•
3/11/23, 8:27 PM
I can work on the fields and only save to db when needed no
?
.
A
antimatter8189
OP
•
3/11/23, 8:27 PM
or its the wrong way
A
antimatter8189
OP
•
3/11/23, 8:29 PM
Like for example a user went into a lesson and didnt start it
, why would i load it from the db
? no changes happened
A
antimatter8189
OP
•
3/11/23, 8:29 PM
Or if he gave no answers
A
antimatter8189
OP
•
3/11/23, 8:29 PM
so why read a non changed entity from the db
?
P
phaseshift
•
3/11/23, 8:38 PM
SetActiveLesson
- that
's just setting some kind of ui state
, but yet its making repo calls as well
P
phaseshift
•
3/11/23, 8:39 PM
It
's not clear what is transient
/ui data and what is permanent
/repo data
P
pox
•
3/12/23, 1:48 AM
db reads are not
that
expensive
, normally you want to avoid using a cache
A
Accord
•
3/13/23, 2:10 AM
Was this issue resolved
? If so
, run
/close
/close
otherwise I will mark this as stale and this post will be archived until there is new activity
.
Similar Threads
✅ How would you search this?
C
C# / help
3y ago
How would i write this in sfml
C
C# / help
3y ago
Help me understand how you would approach this problem.
C
C# / help
2y ago
How would you design a solution to this problem?
C
C# / help
4y ago