dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
1.03k stars 122 forks source link

Problems encountered when updating from version 4.8.8 to 5.4.1 #582

Closed ABatenev closed 1 year ago

ABatenev commented 1 year ago

Hello! I have decided to update the dryioc version in my project from 4.8.8 to 5.4.1, and as a result, the Type[] GetGenericParamsAndArgs(this Type type) method has become unavailable. Here is an example of my code where it is used:

container.Register(

                typeof(IAsyncRepository<>),
                 typeof(AsyncRepository<>),

                reuse: Reuse.Scoped,

                 made: Parameters.Of.Details((request, p) =>
                     p.ParameterType
                      .GetGenericDefinitionOrNull() == typeof(IDeletingStrategy<>)
                && (!p.ParameterType
                      .GetGenericParamsAndArgs()
                      .FirstOrDefault()
                     ?.IsAssignableTo<IUndeletable>() ?? false) // ToDo check logic here

                      ? ServiceDetails.Of(value: null)
                      : null)); // the default injection behavior

How can I replace this method?

dadhi commented 1 year ago

You may use GetGenericArguments() instead.