public SessionDto(SessionBase s)
            : this()
        {
            SessionBaseId = s.Id;
            Abstract      = s.Abstract;
            Duration      = s.Duration;
            SessionType   = s.GetType().Name;
            Speaker1Id    = s.Speaker1Id;
            Speaker1      = new SpeakerDto(s.Speaker1);
            Speaker2Id    = s.Speaker2Id;

            if (s.Speaker2 != null)
            {
                Speaker2 = new SpeakerDto(s.Speaker2);
            }

            Title = s.Title;

            if (s.Ratings == null)
            {
                s.Ratings = new List <Rating>();
            }

            RatingIds = s.Ratings.Select(r => r.Id);
            TrackIds  = s.Tracks.Select(t => t.Id);

            if (s.Schedule != null)
            {
                StartTime = s.Schedule.StartTime.GetValueOrDefault();
                Room      = s.Schedule.Room;
            }
        }
Exemple #2
0
        public static Presenter GetOrCreate(SessionBase session)
        {
            Presenter presenter;

            if (presenterMap.TryGetValue(session, out presenter))
            {
                return(presenter);
            }

            var thisPresenterType = presenterType.MakeGenericType(session.GetType());

            presenter = (Presenter)Activator.CreateInstance(thisPresenterType, session);
            presenterMap.Add(session, presenter);
            session.Disposed += (p, e) => presenterMap.Remove((SessionBase)p);
            return(presenter);
        }