Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Persistence/PersistenceTests/PersistenceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -39,6 +40,11 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0"/>
</ItemGroup>

<ItemGroup Condition="'$(targetframework)' == 'net10.0'">
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0-rc.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0"/>
</ItemGroup>

<ItemGroup>
<Content Include="$(SolutionDir)xunit.runner.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
Expand Down
32 changes: 31 additions & 1 deletion src/Wolverine/ExtensionLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ namespace Wolverine;
internal static class ExtensionLoader
{
private static Assembly[]? _extensions;
private static bool hasWarned = false;

internal static bool IsModule(Assembly assembly)
{
try
{
if (assembly.HasAttribute<WolverineModuleAttribute>()) return true;
}
catch (Exception)
{
if (!hasWarned)
{
Console.WriteLine("To disable automatic Wolverine extension finding, and stop these messages, see:");
Console.WriteLine("https://wolverinefx.net/guide/extensions.html#disabling-assembly-scanning");
}
}

return false;
}

internal static Assembly[] FindExtensionAssemblies()
{
Expand All @@ -17,8 +36,19 @@ internal static Assembly[] FindExtensionAssemblies()
return _extensions;
}

Action<string> logFailure = msg =>
{
if (!hasWarned)
{
Console.WriteLine("To disable automatic Wolverine extension finding, and stop these messages, see:");
Console.WriteLine("https://wolverinefx.net/guide/extensions.html#disabling-assembly-scanning");
}

Console.WriteLine(msg);
};

_extensions = AssemblyFinder
.FindAssemblies(msg => Console.WriteLine(msg), a => a.HasAttribute<WolverineModuleAttribute>(), false)
.FindAssemblies(logFailure, a => a.HasAttribute<WolverineModuleAttribute>(), false)
.Concat(AppDomain.CurrentDomain.GetAssemblies())
.Distinct()
.Where(a => a.HasAttribute<WolverineModuleAttribute>())
Expand Down
Loading