Take the 2-minute tour ×

Background: When I generate the code for my mapping project, only one map will run, regardless of which file type I send in to the command.

I would like to modify the project code generation so that when the maps are generated the applicationConsole.cs allows multiple files and file types, and chooses the appropriate map based upon the parameters I send in.

so far, my project contains 4 maps, each one is different and has a parameter indicating whether or not to run the map. Once the code is generated, the applicationConsole.cs does not differentiate when running the maps. the first map listed in the applicationConsole.cs is run and the others are not. if the first map matches the given parameters, the output is correct, but if the next file coming in does not match, the console closes rather than moving on to the next map.

I am trying to avoid direct manipulation of the applicationConsole.cs, due to having to generate the code frequently.

the question: Does anyone know how to modify the output of Mapforce Project code generation to add a switch for map type based on file type?

share|improve this question

2 Answers 2

In altova mapforce Application Install Directory,there is one SPL Directory. this is generate auto generate code as per your selected Language.

Take the backup of that Directory and modify SPL Directory code as per your requirement. You need to learn SPL (Spy Programming Language) .


If you need anything else then please inform me here. I have Good command on Customize the SPL.

Thank you

share|improve this answer

Take a look at refactoring under Java and C#

Really when you look at the stub code generated and you need to combine a couple maps the first refactoring task is to rename the namespace, Altova uses it's namespace as a default, so a mapa namespace would be helpful mapb namespace etc.

I'll provide the C# examples http://msdn.microsoft.com/en-us/library/vstudio/6kxxabwd.aspx

Then you have the console app so you want to copy the applicationConsole.cs and rename it your project name or class name and then extract the method


Finally you would want to extract the interface so as to return the exception Constructor http://msdn.microsoft.com/en-us/library/vstudio/fb3dyx26.aspx and: http://msdn.microsoft.com/en-us/library/tz6bzkbf.aspx

What you would have is a project with your start-up being the original applicationConsole.cs that you copied and renamed in a project or solution folder. When you update the map you should be able to over-write the code in that folder with what Mapforce generated.

This file was generated by MapForce 2013r2sp2. YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION. Refer to the MapForce Documentation for further details

This is what you will see in that file, use the technique outlined above and the tool is very easy to use. If you are a desktop programmer the refactoring might be new but it saves allot of time and effort down the road and makes the product complete.

share|improve this answer

Your Answer


