DharmaTurtle
DharmaTurtle

Reputation: 8397

Calling an overloaded C# method that takes an Action<A> or a Action<A,B> from F#

Here are the signatures of the two overloads.

public static IServiceCollection AddDbContextPool<TContext>(
    this IServiceCollection serviceCollection,
    Action<DbContextOptionsBuilder> optionsAction,
    int poolSize = 128) where TContext : DbContext { ...

public static IServiceCollection AddDbContextPool<TContext>(
    this IServiceCollection serviceCollection,
    Action<IServiceProvider, DbContextOptionsBuilder> optionsAction,
    int poolSize = 128)
    where TContext : DbContext { ...

Here is the 2nd overload being called in C# enter image description here

But when I try to call the 2nd overload from F#, I get this error:

enter image description here

How can I fix this? Thanks!

Upvotes: 0

Views: 97

Answers (1)

AMieres
AMieres

Reputation: 5004

Try passing:

fun (sp: IServiceProvider) (optionsBuilder: ...) -> ...

Upvotes: 1

Related Questions