I created a patch with the passing and failing tests.
http://rhino-tools-dev.googlegroups.com/web/injected_entitiyt_test_patch.patch?gsc=dHrw8wsAAACzDevcqZkIzDS-5FrLLqRv

On Nov 6, 12:00 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Hm, can you create a failing test case? That looks REALLY strange.
>
> On Thu, Nov 6, 2008 at 6:45 PM, Jason Meckley <[EMAIL PROTECTED]>wrote:
>
>
>
> > One other oddity. If the repository represents an interface it works,
> > but a concrete class will fail.
>
> > class Customer : ICustomer
> > {
> > }
>
> > AController : BaseController
> > {
> >       //no errors
> >       [InjectEntity]
> >       public ICustomer interface_of_customer {set;}
>
> >       //error mentioned in previous post
> >       [InjectEntity]
> >       public Customer customer {set;}
> > }
>
> > On Nov 6, 11:35 am, Jason Meckley <[EMAIL PROTECTED]> wrote:
> > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to