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

Closed
marcusoftnet opened this Issue Feb 14, 2012 · 7 comments

Comments

Projects
None yet
3 participants
@marcusoftnet
Contributor

marcusoftnet commented Feb 14, 2012

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.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Simple.Data.CastEnumerable1.CastEnumerator.get_Current() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Simple.Data.SimpleQuery.ToListT
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
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

This comment has been minimized.

Show comment
Hide comment
@marcusoftnet

marcusoftnet Feb 14, 2012

Contributor

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?

Contributor

marcusoftnet commented Feb 14, 2012

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

This comment has been minimized.

Show comment
Hide comment
@marcusoftnet

marcusoftnet Feb 14, 2012

Contributor

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 :)

Contributor

marcusoftnet commented Feb 14, 2012

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

This comment has been minimized.

Show comment
Hide comment
@markrendle

markrendle Feb 14, 2012

Owner

At a guess, you're casting the results to a type which doesn't have a
default constructor. This is not currently supported, but I am going
to implement something which will do parameter-name matching against
table columns in the near future (when I optimise the static-type
creation, for beta1).

Sent from my iPad (until Win8 gets a mail app)

On 14 Feb 2012, at 20:41, Marcus Hammarberg
reply@reply.github.com
wrote:

When I try to run the All() method (as in db.MyTable.All()) 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.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Simple.Data.CastEnumerable1.CastEnumerator.get_Current() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Simple.Data.SimpleQuery.ToListT
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
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)


Reply to this email directly or view it on GitHub:
#149

Owner

markrendle commented Feb 14, 2012

At a guess, you're casting the results to a type which doesn't have a
default constructor. This is not currently supported, but I am going
to implement something which will do parameter-name matching against
table columns in the near future (when I optimise the static-type
creation, for beta1).

Sent from my iPad (until Win8 gets a mail app)

On 14 Feb 2012, at 20:41, Marcus Hammarberg
reply@reply.github.com
wrote:

When I try to run the All() method (as in db.MyTable.All()) 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.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Simple.Data.CastEnumerable1.CastEnumerator.get_Current() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Simple.Data.SimpleQuery.ToListT
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
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)


Reply to this email directly or view it on GitHub:
#149

@marcusoftnet

This comment has been minimized.

Show comment
Hide comment
@marcusoftnet

marcusoftnet Feb 14, 2012

Contributor

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

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

Contributor

marcusoftnet commented Feb 14, 2012

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

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

@joshilewis

This comment has been minimized.

Show comment
Hide comment
@joshilewis

joshilewis Mar 21, 2012

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

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

This comment has been minimized.

Show comment
Hide comment
@marcusoftnet

marcusoftnet Mar 22, 2012

Contributor

Don't remember right now - will check my code and get back.

/Marcus Hammarberg
www.marcusoft.net
Skickat från Marcus iPhone

21 mar 2012 kl. 19:07 skrev Joshua Lewisreply@reply.github.com:

This is happening for me too. I added a default ctor to my type but it doesn't make a difference.
Marcus, what change did you make to get this to work?


Reply to this email directly or view it on GitHub:
#149 (comment)

Contributor

marcusoftnet commented Mar 22, 2012

Don't remember right now - will check my code and get back.

/Marcus Hammarberg
www.marcusoft.net
Skickat från Marcus iPhone

21 mar 2012 kl. 19:07 skrev Joshua Lewisreply@reply.github.com:

This is happening for me too. I added a default ctor to my type but it doesn't make a difference.
Marcus, what change did you make to get this to work?


Reply to this email directly or view it on GitHub:
#149 (comment)

@marcusoftnet

This comment has been minimized.

Show comment
Hide comment
@marcusoftnet

marcusoftnet Mar 22, 2012

Contributor

@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.

Contributor

marcusoftnet commented Mar 22, 2012

@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