Casting SimpleRecord setting all values to null

56 megtekintés
Ugrás az első olvasatlan üzenetre

Scott Chappel

olvasatlan,
2012. aug. 28. 18:10:352012. 08. 28.
– simpl...@googlegroups.com
I seem to be having an issue that I just cant track down.  When I am using db.table.All().ToList<T>() all the POCOs in the list have their values set to null.  I have tried enumerating the db.table.All() and casting the SimpleRecord to the correct POCO, but it is still having its values set to null.  I have had a look at the dictionary of values in the SimpleRecord and they match to the POCO.

Any thoughts?

Mark Rendle

olvasatlan,
2012. aug. 28. 19:07:282012. 08. 28.
– simpl...@googlegroups.com
Is this just happening in your medium-trust production env, or in dev too?

Scott Chappel

olvasatlan,
2012. aug. 29. 1:35:232012. 08. 29.
– simpl...@googlegroups.com
I have updated my local dev back to full trust and the problem is still occurring.  There are no exceptions being generated/logged either.

Scott Chappel

olvasatlan,
2012. aug. 29. 1:42:142012. 08. 29.
– simpl...@googlegroups.com
Actually...Let me correct that (I had set the wrong level of trust in the config file).  On my local dev box with the trust level = Full, everything works as expected.  On trust level = Medium the SimpleRecord will not convert to the correct type (all properties a null).

Scott Chappel

olvasatlan,
2012. aug. 29. 5:53:382012. 08. 29.
– simpl...@googlegroups.com
I have stripped out some of the exception handling in the dynamic methods (CreateTrySimpleAssign) and I am getting the following exception:
Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Collections.Generic.IDictionary`2<System.String,System.Object>)' to access type 'System.RuntimeType' failed

at lambda_method(Closure , IDictionary`2 )
at Simple.Data.ConcreteTypeCreator.Create(IDictionary`2 source) in D:\\Projects\\3rd Party\\Simple.Data\\Simple.Data\\ConcreteTypeCreator.cs:line 35
at Simple.Data.ConcreteTypeCreator.TryCreate(IDictionary`2 source, Object& result) in D:\\Projects\\3rd Party\\Simple.Data\\Simple.Data\\ConcreteTypeCreator.cs:line 42

I assume that this is a security related exception, but I am not sure.

Mark Rendle

olvasatlan,
2012. aug. 29. 5:55:462012. 08. 29.
– simpl...@googlegroups.com
Good detective work, thank you. I'm just getting something running in MT to do some testing, will get this resolved ASAP.

Mark

Mark Rendle

olvasatlan,
2012. aug. 29. 6:35:322012. 08. 29.
– simpl...@googlegroups.com
Right, with a bit of legwork and the help of an excellent Stack Overflow answer (http://stackoverflow.com/questions/3194678/expressiontdelegate-compile-in-medium-trust-environment) I believe I have killed the bug.

I've pushed the fixed code to GitHub, would you be able to build from that and test with your project? I'd really appreciate it. Unlimited free licenses and everything ;)

Cheers,
Mark

Scott Chappel

olvasatlan,
2012. aug. 29. 7:20:502012. 08. 29.
– simpl...@googlegroups.com
lol :)...I will let you know.


Date: Wed, 29 Aug 2012 11:35:32 +0100
Subject: Re: Casting SimpleRecord setting all values to null
From: ma...@markrendle.net
To: simpl...@googlegroups.com

Scott Chappel

olvasatlan,
2012. aug. 29. 7:33:482012. 08. 29.
– simpl...@googlegroups.com
And the winner is :)

Thanks Mark, greatly appreciated.


From: scha...@hotmail.com
To: simpl...@googlegroups.com
Subject: RE: Casting SimpleRecord setting all values to null
Date: Wed, 29 Aug 2012 21:20:50 +1000

Mark Rendle

olvasatlan,
2012. aug. 29. 8:27:272012. 08. 29.
– simpl...@googlegroups.com
No problem, thanks for your help.

M
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet