The DefaultNamespaces line is missing for the generated code

Hi,

I’m using the ‘Add ServiceStack Reference’ plugin (Visual Studio / C#) to generate my requests and I encountered a small issue where a few namespaces were missing from the using statements at the top of the file. This is probably related to the fact that some of these requests return a list of DTO instead of an object containing the list. Since I cannot introduce a breaking change by changing the requests I tried using the “DefaultNamespaces” option that it available to other code generators (e.g.: JavaGenerator) and it mostly work: the namespaces are added to the file however the “DefaultNamespaces” line is removed from the generated code.

Could you alter the CsharpGenerator to include the “DefaultNamespaces” line?

Thanks

@NoWoL could you give some examples of what was missing?

List<T> should be valid given the using System.Collections.Generic which should be included.

I’ve added a new option called AddNamespaces which will do what you want and let you add additional namespaces. This change is available from v4.0.61 that’s now available on MyGet.

@layoric I was not able to reproduce the issue in a smaller only in my real project with hundred of requests. The missing namespaces were the namespace of a few of my DTO.

@mythz Thanks for the quick fix.