Skip to content

Instantly share code, notes, and snippets.

@codelinq
Created March 8, 2011 05:33
Show Gist options
  • Select an option

  • Save codelinq/859904 to your computer and use it in GitHub Desktop.

Select an option

Save codelinq/859904 to your computer and use it in GitHub Desktop.
Don't Do This
public class SystemUser
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string IsActive { get; set; }
}
public class SystemUser
{
public Guid Id { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string IsActive { get; set; }
public bool IsValid()
{
return !String.IsNullOrEmpty(this.Name);
}
public void Save()
{
//Persist to database
}
public static SystemUser GetById(Guid id)
{
//Retrieve from database
}
}
public class UserRepository
{
public void Save(SystemUser user)
{
//Persist to database
}
public static SystemUser GetById(Guid id)
{
//Retrieve from database
}
}
public class ValidUserSpecification
{
public bool IsSatisfied(SystemUser user)
{
return !String.IsNullOrEmpty(user.Name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment