public UserRepository(RobotStoreContext db)
        {
            this.db = db;

            if (userCache == null)
            {
                userCache = new ConcurrentDictionary <string, User>(db.Users.ToDictionary(c => c.UserID));
            }
        }
        // Setup
        public TestUserRepository()
        {
            connection = new SqliteConnection("DataSource=:memory:");
            connection.Open();
            var options = new DbContextOptionsBuilder <RobotStoreContext>()
                          .UseSqlite(connection).Options;

            context = new RobotStoreContext(options);
            context.Database.EnsureCreated();
            repository = new UserRepository(context);
        }
        public UserRepository(RobotStoreContext db)
        {
            this.db = db;

            if (userCache == null)
            {
                userCache = new ConcurrentDictionary <string, User>(
                    db.Users
                    .Where(u => u.IsDelete == false)
                    .Include(u => u.Grade)
                    .Include(u => u.Permissions)
                    .ToDictionary(c => c.UserID)
                    );
            }
        }
 public TankRepository(RobotStoreContext db)
 {
     this.db = db;
 }
Exemple #5
0
 public RobotsController(RobotStoreContext context)
 {
     _context = context;
 }