Skip to content

Instantly share code, notes, and snippets.

@dvhthomas
Created October 12, 2009 23:26
Show Gist options
  • Save dvhthomas/208839 to your computer and use it in GitHub Desktop.
Save dvhthomas/208839 to your computer and use it in GitHub Desktop.
public Preference GetDefaultValuePreference(int domain, string name)
{
if (domain < 0) throw new ArgumentOutOfRangeException(Resources.InvalidDomainMustBeZeroOrGreater);
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name");
var preference = _unitOfWork.CurrentSession.Get<Preference>(new Preference { DomainId = domain, ElementId = name });
return preference ?? new Preference { DefaultValue = string.Empty, DomainId = domain, ElementId = name };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment