Passing SqlParameter thru WCF contracts getting error...

Topics: Data Access Application Block, Enterprise Library Core
Sep 16, 2010 at 12:18 AM

I'm trying to pass SqlParameter type parameters, got this error:

"'Type 'System.Data.SqlTypes.SqlInt32' with data contract name 'int:http://www.w3.org/2001/XMLSchema' is not expected. Add any types not known statically to the list of known types...", so I added,

[

KnownType(typeof(SqlParameter))], [KnownType(typeof(SqlInt32))], but same error, is SqlParameter serializable? any suggestions?

BY

Sep 16, 2010 at 1:56 AM

SqlParameter is not serializable.  A workaround would be to create your own class which holds values you need to create a SqlParameter in the server-side.  You may want to post this in WCF forums as this is not really specific to entlib. 

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 16, 2010 at 5:00 AM

thx for the info, I'm wondering if .NET 4 has anything? I'm on 3.5, if the DataSet can be serialized, SqlParam can not, it's a bit shocking. Anybody?

Sep 16, 2010 at 5:49 AM

It's also not serializable in .NET 4. 

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com