Vibrant discussion about CSLA .NET and using the framework to build great business applications.
Hi, firts of all sorry for my not so good english, i'm using Csla 3.0.5, my Dataportal is WcfProxy, when i reatreave an object with SqlGuid field and that field is Null from the database i get this exception:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://ws.lhotka.net/WcfDataPortal:FetchResult. The InnerException message was 'ValueType 'System.Data.SqlTypes.SqlGuid' cannot be null.'. Please see InnerException for more details.
I googled for a coupled of hours and for my surprise i didnt find nothing about this particular issue, can anybody help me on this?
Thanks
Elio
SqlGuid is not a data type that your BO should use.
Convert it to a System.Guid or a string instead.
Jonny Bekkum, Norway CslaContrib Coordinator
Hi Jonny, Thans for your quick response; i'm afraid that is something that i cannot change because this is a big legacy application and the code of the those BOs librarys is not on my control. But the instersting thing is when the database column is not null everything works fine. Any idea?
regards
Probably because this code (I use LinqPad to run code):
var x = new System.Data.SqlTypes.SqlGuid((string)null);x.Dump();
will throw exception
g
.ctor
Constructor
100666501
131072
C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
ef393d65-870f-4a49-bd31-c168e9aa90c0
1
CommonLanguageRuntimeLibrary
mscorlib.dll
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
mscorlib
file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
MyComputer
Level2
False
v4.0.30319
True
0
PrivateScope, Public, HideBySig, SpecialName, RTSpecialName
Standard, HasThis
Thanks very much Jonny, i switched to WebService DataPortal which accept SqlGui nulls value from db.
I tested WCF with System.Guid and works fine, but we cannot move our code to use guid, so the service will do the work in the meadel time