for point 2 you can use an extension method,
public Table<Message> Messages { get { return GetTable<Message>(); } }
from msg in db.Messages.ForAge(age)
.Where(msg0 => ...)
private static IQueryable<Message> ForAge(this IQueryable<Message> messages, AgeTypeEnum ageType)
{
switch(ageType)
{
case AgeTypeEnum.Invalid: return messages;
case AgeTypeEnum.LastWeek: return messages.Where(q => q.msg.CreatedDate >= DateTime.Now.AddDays(-7));
case AgeTypeEnum.LastMonth: return messages.Where(q => q.msg.CreatedDate >= DateTime.Now.AddMonths(-1) &&
q.msg.CreatedDate < DateTime.Now.AddDays(-7));
}
}
guess you can also use an interface here for classes with a CreatedDate field/prop