IsReadOnly() 공개 메소드

Returns true if the given property name is read-only
public IsReadOnly ( string name ) : bool
name string
리턴 bool
        internal static void ValidateMemberAccessInLinqExpression(MemberAccessExpressionSyntax node, EFCodeFirstClassInfo rootQueryableType, SyntaxNodeAnalysisContext context, Dictionary <string, ContextualLinqParameter> parameterNodes, bool treatAsWarning)
        {
            var identifier = (node.Expression as IdentifierNameSyntax);
            var memberName = node?.Name;

            if (identifier != null && memberName != null)
            {
                var identText = identifier?.Identifier.ValueText ?? string.Empty;
                if (!string.IsNullOrEmpty(identText) && parameterNodes.ContainsKey(identText))
                {
                    //TODO: Properties of explicit interface implementations. Does EF recognize these or not?
                    string propName = memberName.Identifier.ValueText;
                    if (rootQueryableType.IsReadOnly(propName))
                    {
                        var diagnostic = Diagnostic.Create(treatAsWarning ? DiagnosticCodes.EFLINQ005 : DiagnosticCodes.EFLINQ002, node.GetLocation(), memberName.Identifier.ValueText, rootQueryableType.Name);
                        context.ReportDiagnostic(diagnostic);
                    }
                    if (rootQueryableType.IsExplicitlyUnmapped(propName))
                    {
                        var diagnostic = Diagnostic.Create(treatAsWarning ? DiagnosticCodes.EFLINQ014 : DiagnosticCodes.EFLINQ013, node.GetLocation(), memberName.Identifier.ValueText, rootQueryableType.Name);
                        context.ReportDiagnostic(diagnostic);
                    }
                }
            }
        }
        internal static void ValidateMemberAccessInLinqExpression(MemberAccessExpressionSyntax node, EFCodeFirstClassInfo rootQueryableType, SyntaxNodeAnalysisContext context, Dictionary<string, ContextualLinqParameter> parameterNodes, bool treatAsWarning)
        {
            var identifier = (node.Expression as IdentifierNameSyntax);
            var memberName = node?.Name;

            if (identifier != null && memberName != null)
            {
                var identText = identifier?.Identifier.ValueText ?? string.Empty;
                if (!string.IsNullOrEmpty(identText) && parameterNodes.ContainsKey(identText))
                {
                    //TODO: Properties of explicit interface implementations. Does EF recognize these or not?
                    string propName = memberName.Identifier.ValueText;
                    if (rootQueryableType.IsReadOnly(propName))
                    {
                        var diagnostic = Diagnostic.Create(treatAsWarning ? DiagnosticCodes.EFLINQ005 : DiagnosticCodes.EFLINQ002, node.GetLocation(), memberName.Identifier.ValueText, rootQueryableType.Name);
                        context.ReportDiagnostic(diagnostic);
                    }
                    if (rootQueryableType.IsExplicitlyUnmapped(propName))
                    {
                        var diagnostic = Diagnostic.Create(treatAsWarning ? DiagnosticCodes.EFLINQ014 : DiagnosticCodes.EFLINQ013, node.GetLocation(), memberName.Identifier.ValueText, rootQueryableType.Name);
                        context.ReportDiagnostic(diagnostic);
                    }
                }
            }
        }