I have an enumeration with a range of values (only three are shown here):
public enum LookupType
{
Alignment,
Language,
ReEmbedBehavior
}
Then I have a method that receives data based on a varchar field called LookupType ... I want to restrict callers to this method only with lookupty types that are in the database ... so at the end of my WHERE, I want The enumeration name was a string, not an integer value.
Then callers will do something like GetLookupsByLookupType (LookupType.Language), and my method will make a call "where lookuptype =" Language "
public List<Lookup> GetLookupsByLookupType(UnicornMedia.Core.DomainModel.Enumerations.LookupType lookupType)
{
var lookups = new List<Lookup>();
string SQL = String.Format(@"Select id, name, value, lookuptype
from lookups
where lookuptype = '{0}'", lookupType.ToString());
...<snip>...
}
, - , , , , , , ... , ,