Skip to content
Merged
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
37 changes: 36 additions & 1 deletion src/Scrutor/TypeSourceSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,46 @@ public IImplementationTypeSelector FromAssemblyOf<T>()
return InternalFromAssembliesOf(new[] { typeof(T) });
}

/// <summary>
/// Uses the assembly that called Scrutor.
/// </summary>
/// <remarks>
/// <para>
/// Returned <see cref="Assembly"/> might not be the one expected do to (lack of) inlining.
/// To ensure proper assembly is resolved, use:
/// <code>
/// services.Scan(s => s.FromAssemblies(Assembly.GetExecutingAssembly())
/// </code>
/// or
/// <code>
/// var assembly = Assembly.GetCallingAssembly();
/// services.Scan(s => s.FromAssemblies(assembly));
/// </code>
/// </para>
/// </remarks>
[Obsolete("Misleading, as it might not always determine the correct assembly that called Scrutor. Will be removed in a future release")]
public IImplementationTypeSelector FromCallingAssembly()
{
return FromAssemblies(Assembly.GetCallingAssembly());
}


/// <summary>
/// Always uses the Scrutor assembly.
/// </summary>
/// <remarks>
/// <para>
/// To ensure proper assembly is resolved, use:
/// <code>
/// services.Scan(s => s.FromAssemblies(Assembly.GetExecutingAssembly())
/// </code>
/// or
/// <code>
/// var assembly = Assembly.GetCallingAssembly();
/// services.Scan(s => s.FromAssemblies(assembly));
/// </code>
/// </para>
/// </remarks>
[Obsolete("Misleading, as it always uses Scrutor's assembly. Will be removed in a future release")]
public IImplementationTypeSelector FromExecutingAssembly()
{
return FromAssemblies(Assembly.GetExecutingAssembly());
Expand Down