Is there such thing as standard naming convention for a class that interact with database ( CRUD things or check duplication ). Right now i just named it as Helper, for example a named "Subscriptions" A class that interact with that table will be named "SubscriptionHelper"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LoopinWineBackOffice.Helper
{
public class SubscriberHelper
{
public static bool IsEmailAlreadyInUsed(string email)
{
using (var dc = new LoopinWiineContainer())
{
return dc.Subscribers.Any(item => item.Email==email.Trim());
}
}
}
}
My sample code is something like this.
For the traditional naming convention: Database names must only consist of the letters a to z (both lower and upper case allowed), the numbers 0 to 9 , and the underscore ( _ ) or dash ( - ) symbols. This also means that any non-ASCII database names are not allowed. Database names must always start with a letter.
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
Though these vary somewhat between SQL “flavors”, SQL columns and table names should begin with a letter, not end in an underscore, and should contain only alphanumeric characters. Column and table names should not contain spaces.
A typical naming convention for constraints mentions the type of constraint, the name of the table, and the names of columns involved. It is important to name constraints so that when the constraint is violated, you know which constraint has been violated and which table is involved.
In my experience [and no offense intended] when classes start getting names like 'Helper' and 'Manager' it's because the purpose of that class hasn't been well defined (and I have been guilty of this in the past myself).
In this case, I would speculate that you haven't really thought about your data access pattern, and you've just got a bunch of ad-hoc SQL in the 'SubscriptionHelper' class.
Now, if you were implementing a standard data access pattern, for example a Repository pattern, your class would be called SubscriptionRepository, and its intent would be alot clearer.
So, in answer to the question - No, I don't think there is a standard 'naming' convention for your scenario. What there are though, are several standard design patterns which you could potentially apply to your system, and through doing so, you would likely end up with a naming convention which is both informative, and meaningful.
Here's a starting point for some well known design patterns for you: http://martinfowler.com/eaaCatalog/, but without knowing more about the project, it would be hard to direct you much further than that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With