@@ -30,7 +30,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
30
30
private static final String ASP_NET_CORE_VERSION_OPTION = "--aspnet-core-version" ;
31
31
private static final String INTERFACE_ONLY_OPTION = "--interface-only" ;
32
32
private static final String INTERFACE_CONTROLLER_OPTION = "--interface-controller" ;
33
- private final String DEFAULT_ASP_NET_CORE_VERSION = "2.2 " ;
33
+ private final String DEFAULT_ASP_NET_CORE_VERSION = "3.0 " ;
34
34
private String aspNetCoreVersion ;
35
35
36
36
@ SuppressWarnings ("hiding" )
@@ -146,13 +146,30 @@ public void processOpts() {
146
146
supportingFiles .add (new SupportingFile ("Program.mustache" , packageFolder , "Program.cs" ));
147
147
supportingFiles .add (new SupportingFile ("Project.csproj.mustache" , packageFolder , this .packageName + ".csproj" ));
148
148
supportingFiles .add (new SupportingFile ("Dockerfile.mustache" , packageFolder , "Dockerfile" ));
149
- } else {
149
+ supportingFiles .add (new SupportingFile ("Filters" + File .separator + "BasePathFilter.mustache" , packageFolder + File .separator + "Filters" , "BasePathFilter.cs" ));
150
+ supportingFiles .add (new SupportingFile ("Filters" + File .separator + "GeneratePathParamsValidationFilter.mustache" , packageFolder + File .separator + "Filters" , "GeneratePathParamsValidationFilter.cs" ));
151
+ supportingFiles .add (new SupportingFile ("Startup.mustache" , packageFolder , "Startup.cs" ));
152
+ } else if (aspNetCoreVersion .equals ("2.1" )) {
150
153
apiTemplateFiles .put ("2.1/controller.mustache" , ".cs" );
151
154
addInterfaceControllerTemplate ();
152
155
153
156
supportingFiles .add (new SupportingFile ("2.1/Program.mustache" , packageFolder , "Program.cs" ));
154
157
supportingFiles .add (new SupportingFile ("2.1/Project.csproj.mustache" , packageFolder , this .packageName + ".csproj" ));
155
158
supportingFiles .add (new SupportingFile ("2.1/Dockerfile.mustache" , packageFolder , "Dockerfile" ));
159
+ supportingFiles .add (new SupportingFile ("Filters" + File .separator + "BasePathFilter.mustache" , packageFolder + File .separator + "Filters" , "BasePathFilter.cs" ));
160
+ supportingFiles .add (new SupportingFile ("Filters" + File .separator + "GeneratePathParamsValidationFilter.mustache" , packageFolder + File .separator + "Filters" , "GeneratePathParamsValidationFilter.cs" ));
161
+ supportingFiles .add (new SupportingFile ("Startup.mustache" , packageFolder , "Startup.cs" ));
162
+ } else {
163
+ apiTemplateFiles .put ("3.0/controller.mustache" , ".cs" );
164
+ addInterfaceControllerTemplate ();
165
+
166
+ supportingFiles .add (new SupportingFile ("3.0" + File .separator + "Filters" + File .separator + "BasePathFilter.mustache" , packageFolder + File .separator + "Filters" , "BasePathFilter.cs" ));
167
+ supportingFiles .add (new SupportingFile ("3.0" + File .separator + "Filters" + File .separator + "GeneratePathParamsValidationFilter.mustache" , packageFolder + File .separator + "Filters" , "GeneratePathParamsValidationFilter.cs" ));
168
+
169
+ supportingFiles .add (new SupportingFile ("3.0/Startup.mustache" , packageFolder , "Startup.cs" ));
170
+ supportingFiles .add (new SupportingFile ("3.0/Program.mustache" , packageFolder , "Program.cs" ));
171
+ supportingFiles .add (new SupportingFile ("3.0/Project.csproj.mustache" , packageFolder , this .packageName + ".csproj" ));
172
+ supportingFiles .add (new SupportingFile ("3.0/Dockerfile.mustache" , packageFolder , "Dockerfile" ));
156
173
}
157
174
158
175
if (!additionalProperties .containsKey (CodegenConstants .API_PACKAGE )) {
@@ -173,15 +190,15 @@ public void processOpts() {
173
190
supportingFiles .add (new SupportingFile ("gitignore" , packageFolder , ".gitignore" ));
174
191
supportingFiles .add (new SupportingFile ("appsettings.json" , packageFolder , "appsettings.json" ));
175
192
176
- supportingFiles .add (new SupportingFile ("Startup.mustache" , packageFolder , "Startup.cs" ));
193
+ // supportingFiles.add(new SupportingFile("Startup.mustache", packageFolder, "Startup.cs"));
177
194
178
195
supportingFiles .add (new SupportingFile ("validateModel.mustache" , packageFolder + File .separator + "Attributes" , "ValidateModelStateAttribute.cs" ));
179
196
supportingFiles .add (new SupportingFile ("web.config" , packageFolder , "web.config" ));
180
197
181
198
supportingFiles .add (new SupportingFile ("Properties" + File .separator + "launchSettings.json" , packageFolder + File .separator + "Properties" , "launchSettings.json" ));
182
199
183
- supportingFiles .add (new SupportingFile ("Filters" + File .separator + "BasePathFilter.mustache" , packageFolder + File .separator + "Filters" , "BasePathFilter.cs" ));
184
- supportingFiles .add (new SupportingFile ("Filters" + File .separator + "GeneratePathParamsValidationFilter.mustache" , packageFolder + File .separator + "Filters" , "GeneratePathParamsValidationFilter.cs" ));
200
+ // supportingFiles.add(new SupportingFile("Filters" + File.separator + "BasePathFilter.mustache", packageFolder + File.separator + "Filters", "BasePathFilter.cs"));
201
+ // supportingFiles.add(new SupportingFile("Filters" + File.separator + "GeneratePathParamsValidationFilter.mustache", packageFolder + File.separator + "Filters", "GeneratePathParamsValidationFilter.cs"));
185
202
186
203
supportingFiles .add (new SupportingFile ("wwwroot" + File .separator + "README.md" , packageFolder + File .separator + "wwwroot" , "README.md" ));
187
204
supportingFiles .add (new SupportingFile ("wwwroot" + File .separator + "index.html" , packageFolder + File .separator + "wwwroot" , "index.html" ));
0 commit comments