@@ -164,10 +164,6 @@ bool IsInEfGraphType(SyntaxNode node, SemanticModel semanticModel)
164164 bool AccessesNavigationProperties ( LambdaExpressionSyntax lambda , SemanticModel semanticModel )
165165 {
166166 var body = lambda . Body ;
167- if ( body == null )
168- {
169- return false ;
170- }
171167
172168 // Find all member access expressions in the lambda
173169 var memberAccesses = body . DescendantNodesAndSelf ( )
@@ -209,19 +205,16 @@ bool IsContextSourceAccess(MemberAccessExpressionSyntax memberAccess, out Member
209205 MemberAccessExpressionSyntax ? sourceAccess = null ;
210206
211207 // Walk up the chain to find context.Source
212- while ( current != null )
208+ while ( true )
213209 {
214- if ( current . Expression is MemberAccessExpressionSyntax innerAccess &&
215- innerAccess . Name . Identifier . Text == "Source" &&
216- innerAccess . Expression is IdentifierNameSyntax identifier &&
210+ if ( current . Expression is MemberAccessExpressionSyntax { Name . Identifier . Text : "Source" , Expression : IdentifierNameSyntax identifier } &&
217211 ( identifier . Identifier . Text == "context" || identifier . Identifier . Text == "ctx" ) )
218212 {
219213 sourceAccess = current ;
220214 break ;
221215 }
222216
223- if ( current . Expression is IdentifierNameSyntax id &&
224- id . Identifier . Text == "Source" )
217+ if ( current . Expression is IdentifierNameSyntax { Identifier . Text : "Source" } )
225218 {
226219 // This might be a simplified lambda like: Source => Source.Property
227220 sourceAccess = current ;
@@ -282,7 +275,7 @@ bool IsSafeProperty(IPropertySymbol propertySymbol)
282275 return false ;
283276 }
284277
285- bool IsPrimaryKeyProperty ( IPropertySymbol propertySymbol )
278+ static bool IsPrimaryKeyProperty ( IPropertySymbol propertySymbol )
286279 {
287280 var name = propertySymbol . Name ;
288281
@@ -314,7 +307,7 @@ bool IsPrimaryKeyProperty(IPropertySymbol propertySymbol)
314307 return false ;
315308 }
316309
317- bool IsForeignKeyProperty ( IPropertySymbol propertySymbol )
310+ static bool IsForeignKeyProperty ( IPropertySymbol propertySymbol )
318311 {
319312 var name = propertySymbol . Name ;
320313 var type = propertySymbol . Type ;
@@ -334,7 +327,7 @@ bool IsForeignKeyProperty(IPropertySymbol propertySymbol)
334327 // Check if the type is a scalar type suitable for FK (int, long, Guid, etc.)
335328 // Unwrap nullable
336329 var underlyingType = type ;
337- if ( type is INamedTypeSymbol namedType && namedType . OriginalDefinition . SpecialType == SpecialType . System_Nullable_T )
330+ if ( type is INamedTypeSymbol { OriginalDefinition . SpecialType : SpecialType . System_Nullable_T } namedType )
338331 {
339332 underlyingType = namedType . TypeArguments [ 0 ] ;
340333 }
0 commit comments