@@ -28,10 +28,10 @@ public static class Utils
28
28
/// </summary>
29
29
/// <typeparam name="T">The type of the term.</typeparam>
30
30
/// <returns>The qualified name.</returns>
31
- public static string GetTermQualifiedName < T > ( )
31
+ public static string ? GetTermQualifiedName < T > ( )
32
32
{
33
33
object [ ] attributes = typeof ( T ) . GetCustomAttributes ( typeof ( TermAttribute ) , false ) ;
34
- if ( attributes == null && attributes . Length == 0 )
34
+ if ( attributes == null || attributes . Length == 0 )
35
35
{
36
36
return null ;
37
37
}
@@ -45,7 +45,7 @@ public static string GetTermQualifiedName<T>()
45
45
/// </summary>
46
46
/// <param name="input">The input string.</param>
47
47
/// <returns>The changed string.</returns>
48
- public static string UpperFirstChar ( string input )
48
+ public static string ? UpperFirstChar ( string ? input )
49
49
{
50
50
if ( input == null )
51
51
{
@@ -129,7 +129,7 @@ internal static string ToFirstCharacterLowerCase(this string input)
129
129
/// </summary>
130
130
/// <param name="path">The <see cref="ODataPath"/>.</param>
131
131
/// <param name="navigationPropertyName">Optional: The navigation property name.</param>
132
- internal static string NavigationPropertyPath ( this ODataPath path , string navigationPropertyName = null )
132
+ internal static string NavigationPropertyPath ( this ODataPath path , string ? navigationPropertyName = null )
133
133
{
134
134
string value = string . Join ( "/" ,
135
135
path . Segments . OfType < ODataNavigationPropertySegment > ( ) . Select ( e => e . Identifier ) ) ;
@@ -176,7 +176,7 @@ private static Dictionary<string, string> GetCustomXMLAttributesValueMapping(IEd
176
176
{
177
177
Dictionary < string , string > attributesValueMap = new ( ) ;
178
178
179
- if ( ( ! customXMLAttributesMapping ? . Any ( ) ?? true ) ||
179
+ if ( customXMLAttributesMapping is not { Count : > 0 } ||
180
180
model == null ||
181
181
element == null )
182
182
{
@@ -187,10 +187,10 @@ private static Dictionary<string, string> GetCustomXMLAttributesValueMapping(IEd
187
187
{
188
188
string attributeName = item . Key . Split ( ':' ) . Last ( ) ; // example, 'ags:IsHidden' --> 'IsHidden'
189
189
string extensionName = item . Value ;
190
- EdmStringConstant customXMLAttribute = model . DirectValueAnnotationsManager . GetDirectValueAnnotations ( element ) ?
190
+ var customXMLAttribute = model . DirectValueAnnotationsManager . GetDirectValueAnnotations ( element ) ?
191
191
. Where ( x => x . Name . Equals ( attributeName , StringComparison . OrdinalIgnoreCase ) ) ?
192
192
. FirstOrDefault ( ) ? . Value as EdmStringConstant ;
193
- string attributeValue = customXMLAttribute ? . Value ;
193
+ var attributeValue = customXMLAttribute ? . Value ;
194
194
195
195
if ( ! string . IsNullOrEmpty ( attributeValue ) )
196
196
{
@@ -212,10 +212,10 @@ private static Dictionary<string, string> GetCustomXMLAttributesValueMapping(IEd
212
212
internal static bool IsBaseTypeReferencedAsTypeInModel (
213
213
this IEdmModel model ,
214
214
IEdmStructuredType baseType ,
215
- IEnumerable < IEdmStructuredType > structuredTypes = null ,
216
- IEnumerable < IEdmAction > actions = null )
215
+ IEnumerable < IEdmStructuredType > ? structuredTypes = null ,
216
+ IEnumerable < IEdmAction > ? actions = null )
217
217
{
218
- string baseTypeName = baseType ? . FullTypeName ( ) ;
218
+ string baseTypeName = baseType . FullTypeName ( ) ;
219
219
bool isBaseTypeEntity = Constants . EntityName . Equals ( baseTypeName ? . Split ( '.' ) . Last ( ) , StringComparison . OrdinalIgnoreCase ) ;
220
220
221
221
if ( ! string . IsNullOrEmpty ( baseTypeName ) && ! isBaseTypeEntity )
@@ -253,7 +253,7 @@ internal static bool IsBaseTypeReferencedAsTypeInModel(
253
253
/// </summary>
254
254
/// <param name="segment">The target <see cref="ODataSegment"/>.</param>
255
255
/// <returns>The entity type of the target <paramref name="segment"/>.</returns>
256
- internal static IEdmEntityType EntityTypeFromPathSegment ( this ODataSegment segment )
256
+ internal static IEdmEntityType ? EntityTypeFromPathSegment ( this ODataSegment segment )
257
257
{
258
258
CheckArgumentNull ( segment , nameof ( segment ) ) ;
259
259
@@ -279,12 +279,12 @@ internal static IEdmEntityType EntityTypeFromPathSegment(this ODataSegment segme
279
279
/// </summary>
280
280
/// <param name="segment">The target <see cref="ODataOperationSegment"/>.</param>
281
281
/// <returns>The entity type of the target <paramref name="segment"/>.</returns>
282
- private static IEdmEntityType EntityTypeFromOperationSegment ( this ODataSegment segment )
282
+ private static IEdmEntityType ? EntityTypeFromOperationSegment ( this ODataSegment segment )
283
283
{
284
284
CheckArgumentNull ( segment , nameof ( segment ) ) ;
285
285
286
286
if ( segment is ODataOperationSegment operationSegment &&
287
- operationSegment . Operation . Parameters . FirstOrDefault ( ) is IEdmOperationParameter bindingParameter )
287
+ operationSegment . Operation ? . Parameters . FirstOrDefault ( ) is IEdmOperationParameter bindingParameter )
288
288
{
289
289
IEdmTypeReference bindingType = bindingParameter . Type ;
290
290
@@ -339,10 +339,10 @@ internal static bool TryAddPath(this IDictionary<string, IOpenApiPathItem> pathI
339
339
}
340
340
341
341
ODataSegment lastSecondSegment = path . Segments . ElementAt ( path . Count - secondLastSegmentIndex ) ;
342
- IEdmEntityType boundEntityType = lastSecondSegment ? . EntityTypeFromPathSegment ( ) ;
342
+ var boundEntityType = lastSecondSegment ? . EntityTypeFromPathSegment ( ) ;
343
343
344
- IEdmEntityType operationEntityType = lastSegment . EntityTypeFromOperationSegment ( ) ;
345
- IEnumerable < IEdmStructuredType > derivedTypes = ( operationEntityType != null )
344
+ var operationEntityType = lastSegment . EntityTypeFromOperationSegment ( ) ;
345
+ var derivedTypes = ( operationEntityType != null )
346
346
? context . Model . FindAllDerivedTypes ( operationEntityType )
347
347
: null ;
348
348
0 commit comments