Multiple Request Processing

I am writing an order system.

In this program, the user can request power. For this, I have a class with a name Userand a class with a name Food.

In the class Program, I have a field that is a list field containing a product object. In the class Program, I also have a custom object field.

Now I'm a little confused. The fact is that if two users order a request at the same time, do I need to use the list of users in the class, Programor is one field enough? Or I need to use streams.

As I wrote the application, it just processes one request at a time. So what about further queries? What changes do I need to apply to handle user requests?

I do not use any database at the moment (which I am not very familiar with)

class User {
  private string name;
  private string address;
  // ...
}

class Food {
  private string name;
  private int id;
  // ...
}

class Program {
  private User user;
  private List<Food> foods;
  // ...
}
+3
source share
2 answers

, ( ), , , . (, SQLite) XML DataSet DataTable ( XML , DataSet DataSet XML )?

0

. .

class Program {
    private Dictionary<User, List<Food>> userFoodsMap;
    // ...
}

, Food to User

class UserFoodsMap {
    private User user;
    private List<Food> foods;
    // ...
}

class Program {
    private List<UserFoodsMap> userFoodsMap;
    // ...
}
0

Source: https://habr.com/ru/post/1762044/


All Articles