Example #1
0
        public async Task <int> InvokeAsync(InvocationContext context)
        {
            var bindingContext = context.BindingContext;

            if (CommandArguments != null)
            {
                new ModelBinder(CommandArguments.GetType())
                .UpdateInstance(CommandArguments, bindingContext);

                CommandArguments.BindingCompleted();
            }

            if (CommandArguments is ISourcePathProvider pathProvider)
            {
                Configuration.ReadFromFile(pathProvider.Source);
            }

            foreach (var argumentsExtension in CommandArguments.Extensions)
            {
                new ModelBinder(argumentsExtension.GetType())
                .UpdateInstance(argumentsExtension, bindingContext);

                argumentsExtension.BindingCompleted();
            }

            return(await Command.CreateExport().Value.Execute(CommandArguments));
        }