public Startup(IConfiguration configuration) //Constructing singleton instance. { Configuration = configuration; Tuple <List <Comment>, List <User>, List <Article> > tmp = InitOnStartup(); DataSingleton.GetInstance(tmp.Item1, tmp.Item2, tmp.Item3); }
public static DataSingleton GetInstance(List <Comment> comments, List <User> users, List <Article> articles) { if (_instance == null) { lock (syncRoot) { _instance = new DataSingleton(comments, users, articles); } } return(_instance); }
public List <string> ToStringCustom(Recursion limit) { var data = DataSingleton.GetInstance(); List <string> tmp = new List <string>(); tmp.Add("Comment " + data.Users.Find(x => x.Id == UserId).ToString() + " " + Id + " " + ComText); if ((Comments.Count == 0) || (limit == 0)) { return(tmp); } else { foreach (Comment item in Comments) { tmp = tmp.Concat(item.ToStringCustom(limit--)).ToList(); } return(tmp); } }