In LINQPad, I'm trying to print all tables in a database and row count in each of them:
this.Mapping.GetTables().Select(o => new { TableName = o.TableName, RowCount = ? })
How the row count can be calculated?
In LINQPad, I'm trying to print all tables in a database and row count in each of them:
this.Mapping.GetTables().Select(o => new { TableName = o.TableName, RowCount = ? })
How the row count can be calculated?
Try this:
var list = this.Mapping.GetTables()
.Select(o => new { TableName = o.TableName, Type_ = o.Row.Type, RowCount = 0 }).ToList();
list.ForEach(x=>x.RowCount = this.GetTable(x.Type_).Count);
list.Select(o=> new { TableName = o.TableName, RowCount = 0 });
This is not a LinqPad issue, but rather a Linq issue. But let me give you a nice LinqPad tip. Add .Dump() to your query and see what you get - very cool.
this.Mapping.GetTables().Select(o => new { TableName = o.TableName, RowCount = ? }).Dump()