Closed lwlivy closed 2 years ago
What extension are you using?
The exception means that the extension (whatever it is) expects the method WithoutFastExpressionCompiler
to be present. But it was removed in DryIoc v5.
I want to combine IServiceCollection to inject, but it has not been successful. Now, change to this way, but an error will be reported. When I simply use IServiceCollection, it will not work properly.Did I use it wrong? Error: System.ArgumentException:“At least one object must implement IComparable.”
error location:
public Repository(DbContext dbContext)
{
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
_dbSet = _dbContext.Set
IOC Code:
containerRegistry.RegisterScoped<DbContext, LidsDbContext>();
var services = new[] { typeof(IRepositoryFactory), typeof(IUnitOfWork), typeof(IUnitOfWork
Do you have any good suggestions?
@lwlivy I don't fully understand the question and what the problem or exception do you have. I would suggest you to ask the question on StackOverflow tagging with dryioc and provide the complete failing test, so people can understand the context.
@lwlivy You can see DryIoc 5.0.0 — Method not found: WithoutFastExpressionCompiler(). This issue can close. Good luck.
As far as I can understand, Prism is in action here. So, you can simply override the creation of the container rules. I guess it should be in the App.xaml.cs
class.
protected override Rules CreateContainerRules()
{
return Rules.Default.WithConcreteTypeDynamicRegistrations(reuse: Reuse.Transient)
.With(Made.Of(FactoryMethod.ConstructorWithResolvableArguments))
.WithFuncAndLazyWithoutRegistration()
.WithTrackingDisposableTransients()
//.WithoutFastExpressionCompiler()
.WithFactorySelector(Rules.SelectLastRegisteredFactory());
}
Version: 5.2.2
This error occurs when I use the following code. How can I solve this problem.
new DryIocContainerExtension(new Container(CreateContainerRules()) .WithDependencyInjectionAdapter(services));