Пример #1
0
 public static EventFlyweightFactory getInstance()
 {
     if (instance == null)
     {
         Console.WriteLine("Create new singletone factory");
         instance = new EventFlyweightFactory();
     }
     return(instance);
 }
Пример #2
0
        public Event(int id1)
        {
            DataTable dt = (DBConnection.getDT($"Select * from \"Event\" " +
                                               $"WHERE \"ID\"={id1}"));

            asDT = dt;
            if (dt.Rows.Count != 0)
            {
                this.id    = dt.Rows[0].Field <int>(0);
                this.name  = dt.Rows[0].Field <String>(1);
                this.place = dt.Rows[0].Field <String>(2);
                this.date  = dt.Rows[0].Field <DateTime>(3);
                this.type  = dt.Rows[0].Field <String>(4);
                inDB       = true;

                string type1 = dt.Rows[0].Field <String>(4);
                EventFlyweightFactory factory = EventFlyweightFactory.getInstance();
                this.shared_state = factory.GetFlyweight(type1);
            }
        }
Пример #3
0
        public Event(string shared_field)
        {
            EventFlyweightFactory factory = EventFlyweightFactory.getInstance();

            this.shared_state = factory.GetFlyweight(shared_field);
        }