Geeks With Blogs

The Life and Times of a Dev Yes, we're really that weird

We're using Nettiers to generate our DAL and have the need to create a WCF layer for it.  So we set up the WCF layer in a codesmith template and immediately ran into a problem, we had thousands of methods in the service contract, and the service took over a minute to initialize.  Yuck.

We could have separated out the service contracts into a bunch of different contracts, but that would have been nasty--we would have had over 100 some odd different services to put in the config file.

So the next option was to make a method that allowed us to pass in the provider, method name, and parameters to the method and then call that method on the SQLClient provider using reflection.

I was able to get that wired up and then got the following message in the trace of the server call (note that I removed class names):

There was an error while trying to serialize parameter "blah". The InnerException message was 'Type 'TList`1[[Entity, dll, Version=, Culture=neutral, PublicKeyToken=null]]' with data contract name 'ArrayOfEntity:' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.

After some searching, I found an article about adding known types.  I'll probably opt for the static version.  We'll see how it goes.

Posted on Thursday, July 12, 2007 11:18 AM | Back to top

Comments on this post: Known Types

# re: Known Types
Requesting Gravatar...
Did you ever figure this out? I am in the same boat with respect to having a ton of specialized Request/Response messages. I did come up with a solution by creating Message Base classes and adding the specialized messages with the KnownTypes attribute. The drawback is that casting has to occur on both ends of the wire.

Let me know how it worked out for you.
Left by seth arakelian on Aug 10, 2009 11:02 AM

# re: Known Types
Requesting Gravatar...
We ended up bailing on Nettiers, so the problem largely went away. We also ended up adding known types in the serializer initialization.

Honestly, this has been so long ago (over 2 years) that I don't even remember the full solution!
Left by Robert on Aug 11, 2009 12:52 PM

Your comment:
 (will show your gravatar)

Copyright © Robert May | Powered by: