I've found a bug in the entity injection and for the life of me I
can't fix it.
here's the scenario.
i want to resolve the repository and then invoke either findone or get
depending on certain criteria
so I created a test to make sure I can resolve the repository
correctly
Type type = typeof(IRepository<>).MakeGenericType(typeof(AnEntity));
object repository = IoC.Resolve(type);
object entity = type.GetMethod("Get").Invoke(repository, new object[]
{id});
and this works.
So now I implement this in RhinoIglooFacility.InjectEntities
Type repositoryType =
typeof(IRepository<>).MakeGenericType(property.PropertyType);
object repository = kernel.Resolve(repositoryType);
entity = repositoryType
.GetMethod("Get")
.Invoke(repository, new object[] { id });
but this throws an ArgumentException "type has 1 generic parameter,
but 0 where supplied" at kernel.Resolve
the problem starts here:
Castle.MicroKernel.Handlers.DefaultGenericHandler.Resolve(CreationContext)
this doesn't make sense to me. Why would the original test pass, but
code within the facility fail?
however if I use this code in RhinoIglooFacility, it works.
object entity =
UnitOfWork.GetCurrentSessionFor(property.PropertyType).Get(property.PropertyType,
id);
however don't want to pull straight from session and the repositories
could be decorated and that functionality is required.
my final goal is to create 3 strategies for entity retrieval.
1. Repository.Get (originally used AR moderator.Get)
2. Repository.FindOne with IFetchingStrategy<>
3. Repository.FindOne with EagerLoad (original functionality)
any ideas where to go from here?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---