Guest User

Untitled

a guest
Nov 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. public static class GlobalDB
  2. {
  3.     EntityTables DatabaseInstance; //imaginary singleton
  4. }
  5.  
  6. public class EntityTables
  7. {
  8.     //imagine this is a singleton
  9.  
  10.     public IQueryable<User> UserTable
  11.     {
  12.         get
  13.         {
  14.             DB.instance.GetAllUsers();
  15.         }
  16.     }
  17.  
  18. }
  19.  
  20. public class User
  21. {
  22.     public int userID {get; set;}
  23.     List<UserBook> UserBooks
  24.     {
  25.         get
  26.         {
  27.             DB.instance.GetUserBooksByUserID(userID);
  28.         }  
  29.     }
  30. }
  31.  
  32. public class anotherClassSomewhere
  33. {
  34.     User currentUser =
  35.     GlobalDB.DatabaseInstance.UserTable.Where(u => u.userID == 4).SingleOrDefault();
  36. }
Add Comment
Please, Sign In to add comment