Print Page | Close Window

IIdGenerator implementation exception

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2414
Printed Date: 20-Jul-2026 at 2:41pm


Topic: IIdGenerator implementation exception
Posted By: tj62
Subject: IIdGenerator implementation exception
Date Posted: 03-Jan-2011 at 9:52am
I am trying to implement the IIdGenerator using the  NumericIdGenerator sample I found here:
  http://www.ideablade.com/forum/forum_posts.asp?TID=1436&PID=9523#9523 - http://www.ideablade.com/forum/forum_posts.asp?TID=1436&PID=9523#9523
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 - 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?



Replies:
Posted By: tj62
Date 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 - 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.


Posted By: sbelini
Date 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.


Posted By: tj62
Date 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.


Posted By: tj62
Date 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.


Posted By: sbelini
Date 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



Print Page | Close Window