Skip to content

Commit f619bc6

Browse files
committed
Make SqlInitializer public and initialize it only once
1 parent ba2c485 commit f619bc6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nuget/Sqlite_net.SourceGenerator/SQLiteFastColumnSetterGenerator.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,16 @@ static void Execute(
191191
sb.AppendLine();
192192
sb.AppendLine($"namespace {rootNamespace}");
193193
sb.AppendLine("{");
194-
sb.AppendLine(" internal static class SQLiteInitializer");
194+
sb.AppendLine(" public static class SQLiteInitializer");
195195
sb.AppendLine(" {");
196-
sb.AppendLine(" public static void Init()");
196+
sb.AppendLine(" private static bool initialized");
197+
sb.AppendLine(" public static void Init()");
197198
sb.AppendLine(" {");
199+
sb.AppendLine (" if (initialized)");
200+
sb.AppendLine (" return;");
201+
sb.AppendLine (" initialized = true;");
198202

199-
foreach (var classInfo in classes)
203+
foreach (var classInfo in classes)
200204
{
201205
foreach (var property in classInfo.Properties)
202206
{

0 commit comments

Comments
 (0)