Skip to content

Loading…

The ToList<T>() method doesn't work in the InMemoryAdapter #149

Closed
marcusoftnet opened this Issue · 7 comments

3 participants

@marcusoftnet

When I try to run the All().ToList method (as in db.MyTable.All().ToList) I get a MethodMissingException, stating;
"No parameterless constructor defined for this object."

Here's the stack trace if you need it.
at Simple.Data.SimpleRecord.TryConvert(ConvertBinder binder, Object& result)
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1T0,TRet
at Simple.Data.CastEnumerable1.CastEnumerator.get_Current()
at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Simple.Data.SimpleQuery.ToListT
at System.Dynamic.UpdateDelegates.UpdateAndExecute1T0,TRet
at AbbeSays.Web.Repositories.FamilyRepository.GetFamilies() in C:\Dev\AbbeSays\AbbeSays.Web\Repositories\FamilyRepository.cs:line 19
at AbbeSays.Web.MainModule.<>c__DisplayClass2.<.ctor>b__0(Object _) in C:\Dev\AbbeSays\AbbeSays.Web\MainModule.cs:line 10
at Nancy.Routing.Route.Invoke(DynamicDictionary parameters)
at Nancy.NancyEngine.ResolveAndInvokeRoute(NancyContext context)
at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, IPipelines pipelines)

@marcusoftnet

Hmmm - no this is something else...

It's actually my object it's complaining on. But it has no constructors, hence a parameterless, default one I presume. (have tried to implement a parameterless one as well - no good).

Have I got this wrong?

@marcusoftnet

Yes - it was my fault. Sorry - I put in a complete dynamic object in a field.

It works great. And now you get another issue resolved. For free :)

@markrendle
@marcusoftnet

But but ... I had NO constructor. And then a parameterless one...

Don't get that - but hey it works. My bad

@joshilewis

This is happening for me too. I added a default ctor to my type but it doesn't make a difference.
Interestingly enough, it works absolutely fine for another type (which has a default ctor).
Marcus, what change did you make to get this to work?
I'm using the Mongo adapter

@marcusoftnet
@marcusoftnet

@joshilewis hmmm - hard to track back after my changes ...

But as I remember from my comment above I think the problem actually was solved by correcting a stupid misstake by me, where I did a FindById() using a SimpleDataRecord instead of the Id property of the object.

So if anything the error message threw me off.

Sorry that I couldn't be of any more mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.