Skip to content

Commit 34e8335

Browse files
committed
some more fixes
1 parent 2845edc commit 34e8335

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

nuget/Sqlite_net.SourceGenerator/SQLiteFastColumnSetterGenerator.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static bool HasBaseClass (ClassDeclarationSyntax classDecl)
133133
// Include property if not ignored
134134
if (!ignore) {
135135
var columnName = GetColumnName (member);
136-
properties.Add (new PropertyInfo (member.Name, member.Type.ToDisplayString (), columnName, member.Type.TypeKind == TypeKind.Enum));
136+
properties.Add (new PropertyInfo (member.Name, member.Type.ToDisplayString (), columnName, IsEnum(member)));
137137
}
138138
}
139139
}
@@ -167,6 +167,22 @@ static bool HasBaseClass (ClassDeclarationSyntax classDecl)
167167
properties);
168168
}
169169

170+
private static bool IsEnum (IPropertySymbol member)
171+
{
172+
173+
var type = member.Type;
174+
if (type is INamedTypeSymbol named &&
175+
named.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T) {
176+
type = named.TypeArguments[0];
177+
}
178+
179+
if (type.TypeKind == TypeKind.Enum) {
180+
return true;
181+
}
182+
183+
return false;
184+
}
185+
170186
private static bool HasSQLiteAttribute (INamedTypeSymbol? classSymbol)
171187
{
172188
if (classSymbol != null && cachedHasSqliteAttribute.TryGetValue(classSymbol, out var result)) {

0 commit comments

Comments
 (0)