Exemplo n.º 1
0
        /// <summary>
        /// Generate new relations for each expert of the session.
        /// </summary>
        /// <param name="sessionOfExperts">Session of experts.</param>
        /// <param name="nodesOfSession">Nodes of the session.</param>
        public virtual void CreateRelations(SessionOfExperts sessionOfExperts, IReadOnlyCollection <Node> nodesOfSession)
        {
            if (sessionOfExperts == null)
            {
                throw new ArgumentNullException(nameof(sessionOfExperts));
            }
            if (nodesOfSession == null)
            {
                throw new ArgumentNullException(nameof(nodesOfSession));
            }

            var experts =
                _expertRepository.GetExpertsBySession(
                    new GetExpertsBySessionSpecification(sessionOfExperts, ExpertFetch.Relations));
            var nodes = nodesOfSession.Where(n => n.Notion != sessionOfExperts.BaseNotion).ToArray();

            if (experts != null)
            {
                foreach (var expert in experts)
                {
                    expert.GenerateRelations(nodes);
                    _expertRepository.AddOrUpdate(expert);
                }
            }
        }