public static ITable GetTableByName(this System.Data.Linq.DataContext context, string tableName) { if (context == null) { throw new ArgumentNullException("context is empty"); } if (tableName == null) { throw new ArgumentNullException("tableName is empty"); } return((ITable)context.GetType().GetProperty(tableName).GetValue(context, null)); }