Apr 8, 2014 at 4:02 PM
Edited Apr 8, 2014 at 4:15 PM
The current ctors within
are as follows:
public Repository(IDataContextAsync context, IUnitOfWorkAsync unitOfWork)
This means it is entirely possible to create a
parameter value that corresponds to different
instance to the
parameter value. An
, for example, would therefore not get committed when calling the external
This is very easy to do by mistake with many of the IoC frameworks by misconfiguring the scope of a registration (e.g.
in Autofac, but not picking on autofac in particular) and puts the onus on complex integration testing to ensure no such mistakes have crept in when building a website or other application.
Questions to ask:
- Is there a use-case where this makes sense: would you ever want the
unitOfWork being injected to refer to unrelated
- How can we prevent entirely/partly the "two-context"s scenario if the answer to the previous question is no and/or yes?
Should we somehow ensure that the two items being injected through the constructor refer to the same
, as this is in the Ef6 library)?