Skip to content

Commit 5852a06

Browse files
committed
ignore obsoelete and and don't use static or private properties
1 parent 4b95286 commit 5852a06

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nuget/Sqlite_net.SourceGenerator/SQLiteFastColumnSetterGenerator.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Concurrent;
33
using Microsoft.CodeAnalysis;
44
using Microsoft.CodeAnalysis.CSharp;
@@ -7,8 +7,6 @@
77
using System.Collections.Generic;
88
using System.Collections.Immutable;
99
using System.Linq;
10-
using System.Reflection;
11-
using System.Reflection.Metadata.Ecma335;
1210
using System.Text;
1311
using Microsoft.CodeAnalysis.Diagnostics;
1412

@@ -126,7 +124,7 @@ static bool HasBaseClass (ClassDeclarationSyntax classDecl)
126124
var currentType = classSymbol;
127125
while (currentType != null) {
128126
foreach (var member in currentType.GetMembers ().OfType<IPropertySymbol> ()) {
129-
if (!member.IsReadOnly) {
127+
if (!member.IsReadOnly && !member.IsStatic && !member.IsIndexer && (member.DeclaredAccessibility != Accessibility.Private && member.DeclaredAccessibility != Accessibility.Protected) ) {
130128
var ignore = member.GetAttributes ()
131129
.Any (attr => IsIgnoreAttribute (attr.AttributeClass));
132130

@@ -344,13 +342,16 @@ static void Execute(
344342
sb.AppendLine("// <auto-generated />");
345343
sb.AppendLine("using System;");
346344
sb.AppendLine("using SQLite;");
347-
sb.AppendLine();
345+
sb.AppendLine("#pragma warning disable CS0618 // Disable obsolete Warnings");
346+
sb.AppendLine();
348347
sb.AppendLine($"namespace {rootNamespace}");
349348
sb.AppendLine("{");
350-
sb.AppendLine(" [SQLite.Preserve(AllMembers = true)]");
349+
sb.AppendLine(" /// <summary> SQLite Initializer Class </summary>");
350+
sb.AppendLine(" [SQLite.Preserve(AllMembers = true)]");
351351
sb.AppendLine(" public static class SQLiteInitializer");
352352
sb.AppendLine(" {");
353353
sb.AppendLine(" private static bool initialized;");
354+
sb.AppendLine(" /// <summary> Init SQLite Fast Column Setters </summary>");
354355
sb.AppendLine("#if NET5_0_OR_GREATER");
355356
sb.AppendLine(" [System.Runtime.CompilerServices.ModuleInitializer]");
356357
sb.AppendLine("#endif");

0 commit comments

Comments
 (0)