C
C#12mo ago
kate!

Class Naming Conventions

I'm currently renaming all the classes in my Discord Bot project but I'm stumped to decide what the suffix should be for a class that the wrapper for a collection in a database. Context wouldn't make sense, since I am not using Entity Framework. Currently I have; - Services for classes that just do things (like handling guild logging events) - Modules for the interaction modules that are used by Discord.NET (handling slash commands) - Models Whatever is the type for the collection - Controller ASP.NET controllers, duh.
6 Replies
Angius
Angius12mo ago
If — for whatever godforsaken reason — you're not using EF, you are hereby permitted to use repositories
kate!
kate!OP12mo ago
i'm only not using EF because I prefer having as much control over my data and schemas in my database (and when I started this project, I had no idea how to use it with MongoDB)
Angius
Angius12mo ago
Ah oof ouch Mongo Sure, just use the Mongo driver here
kate!
kate!OP12mo ago
Yeah I am I'm not that insane lol
Gramore
Gramore12mo ago
Repository floats around but that's usually associated with the pattern of the same name or just like MongoService 🤷‍♂️
There are only 2 hard problems in computer science 1. Naming things 2. Cache Invalidation 3. Off by one errors
Tbh i have used Context even if just using dapper or w/e b/c context == database in my mind 😛
kate!
kate!OP12mo ago
Repository sounds good and there are no words used in the suffix that other classes use, so I'll probaby use that But it's only one collection per-class (hence why I wouldn't do Context)

Did you find this page helpful?