Exemple #1
0
        /// <summary>
        /// Gets the entity map.
        /// </summary>
        /// <param name="entityMapFullName">Full name of the entity map.</param>
        /// <returns></returns>
        public EntityMap GetEntityMap(string entityMapFullName)
        {
            EntityMap ent;

            if (!EntityConfigs.TryGetValue(entityMapFullName, out ent))
            {
                throw new MappingException(string.Format("{0} was not found. Probably not mapped", entityMapFullName));
            }

            return(ent);
        }
        public override ITdiTab GetTabToOpen(Type subjectType, int subjectId)
        {
            var constructorInfos = typeof(CommonJournalNode <TEntity>)
                                   .GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance);
            var node = constructorInfos.First().Invoke(new object[] {}) as CommonJournalNode;

            if (node == null)
            {
                return(null);
            }

            node.Id = subjectId;
            EntityConfigs.TryGetValue(subjectType, out var config);
            var foundDocumentConfig =
                (config ?? throw new InvalidOperationException($"Не найдена конфигурация для {subjectType.Name}"))
                .EntityDocumentConfigurations.FirstOrDefault(x => x.IsIdentified(node));

            return((foundDocumentConfig?.GetOpenEntityDlgFunction()
                    ?? throw new InvalidOperationException(
                        $"Не найдена конфигурация для открытия диалога в {nameof(foundDocumentConfig)}"))
                   .Invoke(node));
        }