File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
templates/cli/lib/type-generation/languages Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -120,21 +120,21 @@ public class <%= toPascalCase(collection.name) %>
120120 if (attribute.array) {
121121 -%> (map["<% - attribute.key %> "] as IEnumerable<object >)<% - ! attribute.required ? ' ?' : ' ' %> .Select(e => Convert.ToInt32(e)).ToList()<%
122122 } else {
123- -%> map["<% - attribute.key %> "] != null ? Convert.ToInt32(map["<% - attribute.key %> "]) : ( <% - attribute.required ? ' 0 ' : ' null' %> ) <%
123+ -%> map["<% - attribute.key %> "] != null ? Convert.ToInt32(map["<% - attribute.key %> "]) : <% if (attribute.required) { %> throw new ArgumentNullException(" <% - attribute.key %> ", "Required attribute ' <% - attribute.key %> ' was null.") <% } else { %> null <% } %> <%
124124 }
125125 // FLOAT
126- } else if (attribute.type === ' float ' ) {
126+ } else if (attribute.type === ' double ' ) {
127127 if (attribute.array) {
128128 -%> (map["<% - attribute.key %> "] as IEnumerable<object >)<% - ! attribute.required ? ' ?' : ' ' %> .Select(e => Convert.ToDouble(e)).ToList()<%
129129 } else {
130- -%> map["<% - attribute.key %> "] != null ? Convert.ToDouble(map["<% - attribute.key %> "]) : ( <% - attribute.required ? ' 0.0 ' : ' null' %> ) <%
130+ -%> map["<% - attribute.key %> "] != null ? Convert.ToDouble(map["<% - attribute.key %> "]) : <% if (attribute.required) { %> throw new ArgumentNullException(" <% - attribute.key %> ", "Required attribute ' <% - attribute.key %> ' was null.") <% } else { %> null <% } %> <%
131131 }
132132 // BOOLEAN
133133 } else if (attribute.type === ' boolean' ) {
134134 if (attribute.array) {
135135 -%> (map["<% - attribute.key %> "] as IEnumerable<object >)<% - ! attribute.required ? ' ?' : ' ' %> .Select(e => Convert.ToBoolean(e)).ToList()<%
136136 } else {
137- -%> map["<% - attribute.key %> "] != null ? Convert.ToBoolean(map["<% - attribute.key %> "]) : ( <% - attribute.required ? ' false ' : ' null' %> ) <%
137+ -%> map["<% - attribute.key %> "] != null ? Convert.ToBoolean(map["<% - attribute.key %> "]) : <% if (attribute.required) { %> throw new ArgumentNullException(" <% - attribute.key %> ", "Required attribute ' <% - attribute.key %> ' was null.") <% } else { %> null <% } %> <%
138138 }
139139 // STRING , DATETIME , EMAIL
140140 } else if (attribute.type === ' string' || attribute.type === ' datetime' || attribute.type === ' email' ) {
You can’t perform that action at this time.
0 commit comments