Skip to content

Commit

Permalink
Add database-related methods to implement on LumenModuleBase
Browse files Browse the repository at this point in the history
This is concieved in a way you don't need to install Efcore as a dependency if you're not using database
Tbd if we change that later
  • Loading branch information
Elanis committed Dec 26, 2024
1 parent cc8683b commit a6b864b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Lumen.Modules.Sdk/LumenModuleBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,28 @@ protected LumenModuleBase(LumenModuleRunsOnFlag runsOn, ILogger<LumenModuleBase>
this.logger = logger;
}

// Generic methods
public bool IsAPIModule() {

Check warning on line 14 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Rename method 'IsAPIModule' to match pascal case naming rules, consider using 'IsApiModule'. (https://rules.sonarsource.com/csharp/RSPEC-100)

Check warning on line 14 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Rename method 'IsAPIModule' to match pascal case naming rules, consider using 'IsApiModule'. (https://rules.sonarsource.com/csharp/RSPEC-100)

Check warning on line 14 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Rename method 'IsAPIModule' to match pascal case naming rules, consider using 'IsApiModule'. (https://rules.sonarsource.com/csharp/RSPEC-100)

Check warning on line 14 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Rename method 'IsAPIModule' to match pascal case naming rules, consider using 'IsApiModule'. (https://rules.sonarsource.com/csharp/RSPEC-100)
return runsOn.HasFlag(LumenModuleRunsOnFlag.API);
}

public bool IsUIModule() {
return runsOn.HasFlag(LumenModuleRunsOnFlag.UI);
}

public bool IsWorkerModule() {
return runsOn.HasFlag(LumenModuleRunsOnFlag.Worker);
}

// Standard event loop methods
public abstract Task InitAsync(LumenModuleRunsOnFlag currentEnv);
public abstract Task ShutdownAsync();
public abstract Task RunAsync(LumenModuleRunsOnFlag currentEnv);

// Scheduled events
public abstract bool ShouldRunNow(LumenModuleRunsOnFlag currentEnv);

// Database-related methods
public abstract bool IsUsingDatabase(LumenModuleRunsOnFlag currentEnv);
public abstract Type GetModuleDatabaseContext();

Check warning on line 34 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContext' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)

Check warning on line 34 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContext' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)

Check warning on line 34 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContext' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)

Check warning on line 34 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContext' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)
public abstract string GetModuleDatabaseContextSchemaName();

Check warning on line 35 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContextSchemaName' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)

Check warning on line 35 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContextSchemaName' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)

Check warning on line 35 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContextSchemaName' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)

Check warning on line 35 in Lumen.Modules.Sdk/LumenModuleBase.cs

View workflow job for this annotation

GitHub Actions / build

Consider making method 'GetModuleDatabaseContextSchemaName' a property. (https://rules.sonarsource.com/csharp/RSPEC-4049)
}
}

0 comments on commit a6b864b

Please sign in to comment.