示例#1
0
        /// <summary>
        /// This creates the NonDiBizSetup and adds one GenericBizRunner DTO
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="publicConfig"></param>
        /// <returns></returns>
        public static NonDiBizSetup SetupDtoMapping <TDto>(IGenericBizRunnerConfig publicConfig = null)
        {
            var nonDiConf = new NonDiBizSetup(publicConfig);

            SetupDtoMapping(typeof(TDto), nonDiConf);
            return(nonDiConf);
        }
示例#2
0
        //---------------------------------------------------
        //private

        private static void SetupDtoMapping(Type dtoType, NonDiBizSetup nonDiConf)
        {
            var bizIn = dtoType.GetInterface(nameof(IGenericActionToBizDto)) != null;

            if (!bizIn && dtoType.GetInterface(nameof(IGenericActionFromBizDto)) == null)
            {
                throw new InvalidOperationException($"The class {dtoType.Name} doesn't inherit from one of the Biz Runner Dto classes.");
            }

            SetupDtoMappings.SetupGenericActionMappingForDto(dtoType, bizIn ? nonDiConf._bizInProfile : nonDiConf._bizOutProfile, bizIn);
        }