New Posts New Posts RSS Feed: IIdGenerator implementation exception
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

IIdGenerator implementation exception

 Post Reply Post Reply
Author
tj62 View Drop Down
Groupie
Groupie
Avatar

Joined: 21-May-2009
Location: Iceland
Posts: 81
Post Options Post Options   Quote tj62 Quote  Post ReplyReply Direct Link To This Post Topic: IIdGenerator implementation exception
    Posted: 03-Jan-2011 at 9:52am
I am trying to implement the IIdGenerator using the  NumericIdGenerator sample I found here:
When I run my Silverlight app. after that I get this exception as a result of calling InvokeServerMethodAsync() that has nothing to do with generating IDs (but is called short after the connect/login process):
Repository persistence operation failed; The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://ideablade.com/EntityModel:InvokeServerMethodResult. The InnerException message was
'Element 'http://ideablade.com/EntityModel:NextIdGenerator' contains data of the 'http://schemas.datacontract.org/2004/07/ServerModelC2Net:C2NetIdGenerator' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to 'C2NetIdGenerator' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.
 
The only changes of importance I did to NumericIdGenerator was that I changed the namespace and it's name to C2NetIdGenerator and let IsApplicable() allways return true.
 
Any Idea what is the solution to this?
Back to Top
tj62 View Drop Down
Groupie
Groupie
Avatar

Joined: 21-May-2009
Location: Iceland
Posts: 81
Post Options Post Options   Quote tj62 Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 10:03am
Well after getting this reply:
  http://www.ideablade.com/forum/forum_posts.asp?TID=1436&PID=9524#9524
I upgraded to this new version of NumericIdGenerator, but still the same exception.
 
So that did not help.
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 12:55pm
Hi tj62,
 
What are you passing to/returning from the invoked method?
 
Can you upload a simple test case (agains NorthwindIB) reproducing the issue?
 
Silvio.
Back to Top
tj62 View Drop Down
Groupie
Groupie
Avatar

Joined: 21-May-2009
Location: Iceland
Posts: 81
Post Options Post Options   Quote tj62 Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jan-2011 at 1:34am
It returns  EntityCacheState
Here are the last lines of the server method:

List<EntUser> listEntUser = new List<EntUser>();

listEntUser.Add(user);

return eMgr.CacheStateManager.GetCacheState(listEntUser);

Where EntUser is an entity. There is a special reason for this method (no using LINQ from the client) that is to much to explain here.

Generating an example could be quite tricki so let us se first if this gives you any indication what the problem is.
Back to Top
tj62 View Drop Down
Groupie
Groupie
Avatar

Joined: 21-May-2009
Location: Iceland
Posts: 81
Post Options Post Options   Quote tj62 Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jan-2011 at 4:04am

Ahh I found out what the problem was. I forgot to add the NumericIdGenerator as a linked class in the SilverLight project (DomainModelSL). After I did that the problem disappeard.

However I have som problems using IIdGenerator as  "my old databas" has combined primary keys that have to apply to some strict rules becuase of old software systems that share the same database. I wish the GUID existed when they programmed that ancient stuff :-( 
I will start a new thread on that issue.
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jan-2011 at 10:21am
Hi tj62,
 
I'm glad you found the problem. (That would be fairly simple to spot in a sample)
 
sbelini
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down