Guest User

Untitled

a guest
Jun 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public static class MyExtensions
  2. {
  3. // Write custom extension methods here. They will be available to all queries.
  4.  
  5. // get list of additional databases used. Pass "this" (of type UserQuery)
  6. internal static List<string> GetAdditionalDatabaseNames(this UserQuery uq)
  7. {
  8.  
  9. var props = uq.GetType().GetProperties();
  10. var result = new List<string>();
  11. foreach (var db in props.Where(
  12. w => w.PropertyType.Name == "TypedDataContext").Distinct())
  13. {
  14. result.Add(db.Name);
  15. }
  16. return result;
  17. }
  18. }
  19.  
  20. void Main()
  21. {
  22. this.Connection.Database.Dump();
  23. this.GetAdditionalDatabaseNames().Dump();
  24. }
Add Comment
Please, Sign In to add comment