Skip to content

Commit f26c371

Browse files
author
Robert Anderson
committed
Fully qualifying Task return type on methods, removing using clause for System.Threading.Tasks, fixing up some random extra spaces in files.
1 parent c36d41f commit f26c371

File tree

49 files changed

+298
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+298
-316
lines changed

Templates/CSharp/Base/CollectionRequest.Base.template.tt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void AppendMethodHeaderToPostAsyncMethod(string propertyType, string sani
5858
stringBuilder.Append(" /// </summary>");
5959
stringBuilder.Append(Environment.NewLine);
6060
stringBuilder.AppendFormat(" /// <param name=\"{0}\">The {1} to add.</param>", sanitizedPropertyName, propertyType);
61-
61+
6262
if (includeSendParameters)
6363
{
6464
stringBuilder.Append(Environment.NewLine);
@@ -72,93 +72,93 @@ public string GetPostAsyncMethod(OdcmProperty odcmProperty, string requestBody =
7272
{
7373
var sanitizedPropertyName = odcmProperty.Projection.Type.Name.GetSanitizedPropertyName(odcmProperty.Name);
7474
var propertyType = this.GetPropertyTypeName(odcmProperty);
75-
75+
7676
var templateWriterHost = (CustomT4Host)Host;
7777
var templateWriter = (CodeWriterCSharp)templateWriterHost.CodeWriter;
7878

7979
var stringBuilder = new StringBuilder();
80-
80+
8181
stringBuilder.Append(Environment.NewLine);
8282
this.AppendMethodHeaderToPostAsyncMethod(propertyType, sanitizedPropertyName, stringBuilder, false);
8383
stringBuilder.Append(Environment.NewLine);
8484
stringBuilder.AppendFormat(" /// <returns>The created {0}.</returns>", propertyType);
8585
stringBuilder.Append(Environment.NewLine);
86-
stringBuilder.AppendFormat(" public Task<{0}> AddAsync({0} {1})", propertyType, sanitizedPropertyName);
86+
stringBuilder.AppendFormat(" public System.Threading.Tasks.Task<{0}> AddAsync({0} {1})", propertyType, sanitizedPropertyName);
8787
stringBuilder.Append(Environment.NewLine);
8888
stringBuilder.Append(" {");
8989
stringBuilder.Append(Environment.NewLine);
9090
stringBuilder.AppendFormat(" return this.AddAsync({0}, CancellationToken.None);", sanitizedPropertyName);
9191
stringBuilder.Append(Environment.NewLine);
9292
stringBuilder.Append(" }");
93-
93+
9494
stringBuilder.Append(Environment.NewLine);
9595
stringBuilder.Append(Environment.NewLine);
96-
96+
9797
this.AppendMethodHeaderToPostAsyncMethod(propertyType, sanitizedPropertyName, stringBuilder, true);
9898
stringBuilder.Append(Environment.NewLine);
9999
stringBuilder.AppendFormat(" /// <returns>The created {0}.</returns>", propertyType);
100100
stringBuilder.Append(Environment.NewLine);
101-
stringBuilder.AppendFormat(" public Task<{0}> AddAsync({0} {1}, CancellationToken cancellationToken)", propertyType, sanitizedPropertyName);
101+
stringBuilder.AppendFormat(" public System.Threading.Tasks.Task<{0}> AddAsync({0} {1}, CancellationToken cancellationToken)", propertyType, sanitizedPropertyName);
102102
stringBuilder.Append(Environment.NewLine);
103103
stringBuilder.Append(" {");
104104
stringBuilder.Append(Environment.NewLine);
105105
stringBuilder.AppendFormat(" this.ContentType = \"{0}\";", templateWriter.jsonContentType);
106106
stringBuilder.Append(Environment.NewLine);
107107
stringBuilder.Append(" this.Method = \"POST\";");
108-
108+
109109
var entity = odcmProperty.Projection.Type.AsOdcmClass();
110110

111111
if (entity != null && entity.IsAbstract)
112112
{
113113
stringBuilder.Append(Environment.NewLine);
114114
stringBuilder.AppendFormat(" {0}.ODataType = string.Concat(\"#\", StringHelper.ConvertTypeToLowerCamelCase({0}.GetType().FullName));", sanitizedPropertyName);
115115
}
116-
116+
117117
stringBuilder.Append(Environment.NewLine);
118118
stringBuilder.AppendFormat(" return this.SendAsync<{0}>({1}, cancellationToken);", propertyType, sanitizedPropertyName);
119119
stringBuilder.Append(Environment.NewLine);
120120
stringBuilder.Append(" }");
121121
stringBuilder.Append(Environment.NewLine);
122-
122+
123123
return stringBuilder.ToString();
124124
}
125-
125+
126126
return string.Empty;
127127
}
128128

129129
public string GetPostAsyncMethodForReferencesRequest(OdcmProperty odcmProperty)
130130
{
131131
var sanitizedPropertyName = odcmProperty.Projection.Type.Name.GetSanitizedPropertyName(odcmProperty.Name);
132132
var propertyType = this.GetPropertyTypeName(odcmProperty);
133-
133+
134134
var templateWriterHost = (CustomT4Host)Host;
135135
var templateWriter = (CodeWriterCSharp)templateWriterHost.CodeWriter;
136-
136+
137137
var serviceNavigationProperty = odcmProperty.GetServiceCollectionNavigationPropertyForPropertyType();
138138

139139
var stringBuilder = new StringBuilder();
140-
140+
141141
stringBuilder.Append(Environment.NewLine);
142142
this.AppendMethodHeaderToPostAsyncMethod(propertyType, sanitizedPropertyName, stringBuilder, false);
143143
stringBuilder.Append(Environment.NewLine);
144144
stringBuilder.AppendFormat(" /// <returns>The task to await.</returns>", propertyType);
145145
stringBuilder.Append(Environment.NewLine);
146-
stringBuilder.AppendFormat(" public Task AddAsync({0} {1})", propertyType, sanitizedPropertyName);
146+
stringBuilder.AppendFormat(" public System.Threading.Tasks.Task AddAsync({0} {1})", propertyType, sanitizedPropertyName);
147147
stringBuilder.Append(Environment.NewLine);
148148
stringBuilder.Append(" {");
149149
stringBuilder.Append(Environment.NewLine);
150150
stringBuilder.AppendFormat(" return this.AddAsync({0}, CancellationToken.None);", sanitizedPropertyName);
151151
stringBuilder.Append(Environment.NewLine);
152152
stringBuilder.Append(" }");
153-
153+
154154
stringBuilder.Append(Environment.NewLine);
155155
stringBuilder.Append(Environment.NewLine);
156-
156+
157157
this.AppendMethodHeaderToPostAsyncMethod(propertyType, sanitizedPropertyName, stringBuilder, true);
158158
stringBuilder.Append(Environment.NewLine);
159159
stringBuilder.AppendFormat(" /// <returns>The task to await.</returns>", propertyType);
160160
stringBuilder.Append(Environment.NewLine);
161-
stringBuilder.AppendFormat(" public Task AddAsync({0} {1}, CancellationToken cancellationToken)", propertyType, sanitizedPropertyName);
161+
stringBuilder.AppendFormat(" public System.Threading.Tasks.Task AddAsync({0} {1}, CancellationToken cancellationToken)", propertyType, sanitizedPropertyName);
162162
stringBuilder.Append(Environment.NewLine);
163163
stringBuilder.Append(" {");
164164
stringBuilder.Append(Environment.NewLine);
@@ -182,7 +182,7 @@ public string GetPostAsyncMethodForReferencesRequest(OdcmProperty odcmProperty)
182182
stringBuilder.Append(Environment.NewLine);
183183
stringBuilder.Append(" }");
184184
stringBuilder.Append(Environment.NewLine);
185-
185+
186186
return stringBuilder.ToString();
187187
}
188188

Templates/CSharp/Base/CollectionRequestBuilder.Base.template.tt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public string GetCollectionReferencesRequestBuilder(OdcmProperty odcmProperty)
8282
{
8383
var stringBuilder = new StringBuilder();
8484
var entityReferencesRequestBuilder = this.GetPropertyCollectionReferencesRequestBuilderName(odcmProperty);
85-
85+
8686
stringBuilder.Append(Environment.NewLine);
8787
stringBuilder.Append(" /// <summary>");
8888
stringBuilder.Append(Environment.NewLine);
@@ -108,7 +108,7 @@ public string GetCollectionReferencesRequestBuilder(OdcmProperty odcmProperty)
108108

109109
return stringBuilder.ToString();
110110
}
111-
111+
112112
return string.Empty;
113113
}
114114

@@ -122,7 +122,7 @@ public string GetCollectionIndexRequestBuilder(OdcmProperty odcmProperty)
122122
var stringBuilder = new StringBuilder();
123123
var propTypeName = string.Concat(this.GetEntityNameString(odcmProperty.Class), this.GetPropertyTypeName(odcmProperty));
124124
var entityRequestBuilder = this.GetPropertyTypeRequestBuilderName(odcmProperty);
125-
125+
126126
stringBuilder.Append("/// <summary>");
127127
stringBuilder.Append(Environment.NewLine);
128128
stringBuilder.AppendFormat(" /// Gets an <see cref=\"I{0}\"/> for the specified {1}.", entityRequestBuilder, propTypeName);
@@ -140,12 +140,12 @@ public string GetCollectionIndexRequestBuilder(OdcmProperty odcmProperty)
140140
get
141141
{
142142
");
143-
143+
144144
stringBuilder.AppendFormat(" return new {0}(this.AppendSegmentToRequestUrl(id), this.Client);", entityRequestBuilder);
145145
stringBuilder.Append(@"
146146
}
147147
}");
148-
148+
149149
return stringBuilder.ToString();
150150
}
151151

@@ -156,7 +156,7 @@ public string GetCollectionWithReferencesIndexRequestBuilder(OdcmProperty odcmPr
156156

157157
var propTypeName = string.Concat(this.GetEntityNameString(odcmProperty.Class), this.GetPropertyTypeName(odcmProperty));
158158
var entityRequestBuilder = this.GetPropertyTypeWithReferenceRequestBuilderName(odcmProperty);
159-
159+
160160
stringBuilder.Append("/// <summary>");
161161
stringBuilder.Append(Environment.NewLine);
162162
stringBuilder.AppendFormat(" /// Gets an <see cref=\"I{0}\"/> for the specified {1}.", entityRequestBuilder, propTypeName);
@@ -179,7 +179,7 @@ public string GetCollectionWithReferencesIndexRequestBuilder(OdcmProperty odcmPr
179179
}
180180
}
181181
");
182-
182+
183183
return stringBuilder.ToString();
184184
}
185185

0 commit comments

Comments
 (0)