@@ -28,10 +28,10 @@ public static class Utils
2828 /// </summary>
2929 /// <typeparam name="T">The type of the term.</typeparam>
3030 /// <returns>The qualified name.</returns>
31- public static string GetTermQualifiedName < T > ( )
31+ public static string ? GetTermQualifiedName < T > ( )
3232 {
3333 object [ ] attributes = typeof ( T ) . GetCustomAttributes ( typeof ( TermAttribute ) , false ) ;
34- if ( attributes == null && attributes . Length == 0 )
34+ if ( attributes == null || attributes . Length == 0 )
3535 {
3636 return null ;
3737 }
@@ -45,7 +45,7 @@ public static string GetTermQualifiedName<T>()
4545 /// </summary>
4646 /// <param name="input">The input string.</param>
4747 /// <returns>The changed string.</returns>
48- public static string UpperFirstChar ( string input )
48+ public static string ? UpperFirstChar ( string ? input )
4949 {
5050 if ( input == null )
5151 {
@@ -129,7 +129,7 @@ internal static string ToFirstCharacterLowerCase(this string input)
129129 /// </summary>
130130 /// <param name="path">The <see cref="ODataPath"/>.</param>
131131 /// <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 )
133133 {
134134 string value = string . Join ( "/" ,
135135 path . Segments . OfType < ODataNavigationPropertySegment > ( ) . Select ( e => e . Identifier ) ) ;
@@ -176,7 +176,7 @@ private static Dictionary<string, string> GetCustomXMLAttributesValueMapping(IEd
176176 {
177177 Dictionary < string , string > attributesValueMap = new ( ) ;
178178
179- if ( ( ! customXMLAttributesMapping ? . Any ( ) ?? true ) ||
179+ if ( customXMLAttributesMapping is not { Count : > 0 } ||
180180 model == null ||
181181 element == null )
182182 {
@@ -187,10 +187,10 @@ private static Dictionary<string, string> GetCustomXMLAttributesValueMapping(IEd
187187 {
188188 string attributeName = item . Key . Split ( ':' ) . Last ( ) ; // example, 'ags:IsHidden' --> 'IsHidden'
189189 string extensionName = item . Value ;
190- EdmStringConstant customXMLAttribute = model . DirectValueAnnotationsManager . GetDirectValueAnnotations ( element ) ?
190+ var customXMLAttribute = model . DirectValueAnnotationsManager . GetDirectValueAnnotations ( element ) ?
191191 . Where ( x => x . Name . Equals ( attributeName , StringComparison . OrdinalIgnoreCase ) ) ?
192192 . FirstOrDefault ( ) ? . Value as EdmStringConstant ;
193- string attributeValue = customXMLAttribute ? . Value ;
193+ var attributeValue = customXMLAttribute ? . Value ;
194194
195195 if ( ! string . IsNullOrEmpty ( attributeValue ) )
196196 {
@@ -212,10 +212,10 @@ private static Dictionary<string, string> GetCustomXMLAttributesValueMapping(IEd
212212 internal static bool IsBaseTypeReferencedAsTypeInModel (
213213 this IEdmModel model ,
214214 IEdmStructuredType baseType ,
215- IEnumerable < IEdmStructuredType > structuredTypes = null ,
216- IEnumerable < IEdmAction > actions = null )
215+ IEnumerable < IEdmStructuredType > ? structuredTypes = null ,
216+ IEnumerable < IEdmAction > ? actions = null )
217217 {
218- string baseTypeName = baseType ? . FullTypeName ( ) ;
218+ string baseTypeName = baseType . FullTypeName ( ) ;
219219 bool isBaseTypeEntity = Constants . EntityName . Equals ( baseTypeName ? . Split ( '.' ) . Last ( ) , StringComparison . OrdinalIgnoreCase ) ;
220220
221221 if ( ! string . IsNullOrEmpty ( baseTypeName ) && ! isBaseTypeEntity )
@@ -253,7 +253,7 @@ internal static bool IsBaseTypeReferencedAsTypeInModel(
253253 /// </summary>
254254 /// <param name="segment">The target <see cref="ODataSegment"/>.</param>
255255 /// <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 )
257257 {
258258 CheckArgumentNull ( segment , nameof ( segment ) ) ;
259259
@@ -279,12 +279,12 @@ internal static IEdmEntityType EntityTypeFromPathSegment(this ODataSegment segme
279279 /// </summary>
280280 /// <param name="segment">The target <see cref="ODataOperationSegment"/>.</param>
281281 /// <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 )
283283 {
284284 CheckArgumentNull ( segment , nameof ( segment ) ) ;
285285
286286 if ( segment is ODataOperationSegment operationSegment &&
287- operationSegment . Operation . Parameters . FirstOrDefault ( ) is IEdmOperationParameter bindingParameter )
287+ operationSegment . Operation ? . Parameters . FirstOrDefault ( ) is IEdmOperationParameter bindingParameter )
288288 {
289289 IEdmTypeReference bindingType = bindingParameter . Type ;
290290
@@ -339,10 +339,10 @@ internal static bool TryAddPath(this IDictionary<string, IOpenApiPathItem> pathI
339339 }
340340
341341 ODataSegment lastSecondSegment = path . Segments . ElementAt ( path . Count - secondLastSegmentIndex ) ;
342- IEdmEntityType boundEntityType = lastSecondSegment ? . EntityTypeFromPathSegment ( ) ;
342+ var boundEntityType = lastSecondSegment ? . EntityTypeFromPathSegment ( ) ;
343343
344- IEdmEntityType operationEntityType = lastSegment . EntityTypeFromOperationSegment ( ) ;
345- IEnumerable < IEdmStructuredType > derivedTypes = ( operationEntityType != null )
344+ var operationEntityType = lastSegment . EntityTypeFromOperationSegment ( ) ;
345+ var derivedTypes = ( operationEntityType != null )
346346 ? context . Model . FindAllDerivedTypes ( operationEntityType )
347347 : null ;
348348
0 commit comments