title: Can WCF handle GUIDs?
body: <p>I ask because my unit tests which connect to my local dev database have no problem using Guids, but when I use the same methods via my WCF service, it fails with the following exception:</p>
  
  <pre><code>System.Data.EntityCommandExecutionException
  </code></pre>
  
  <p>I've read the WCF converts Guids to strings. My exact scenario is this:</p>
  
  <p>Proxy -> pass object with Guid</p>
  
  <p>Service &lt;- connect to db, insert/retrieve things w/Guid</p>
  
  <p>Service -> pass object with Guid back to proxy</p>
  
  <p>Here is the error when testing the WCF service from the web application:</p>
  
  <pre>
  [FaultException`1: An error occurred while executing the command definition. See the inner exception for details.]
     System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +9456095
     System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +345
     BusinessServices.NGIT.ServiceContracts.IIssueTrackerService.CreateIssue(CreateIssueRequest request) +0
     NGIT.Proxies.c__DisplayClass1.b__0(IIssueTrackerService s) in D:\NextGenIssueTracker\branches\2011Updates\NextGenIssueTracker.Proxies\Proxies\IssueTrackerProxy.cs:25
     NGIT.Proxies.UseServiceFunction.UseService(ChannelFactory`1 channelFactory, Func`2 useService) in D:\NextGenIssueTracker\branches\2011Updates\NextGenIssueTracker.Proxies\Helpers\UseServiceFunction.cs:26
     NGIT.Proxies.IssueTrackerProxy.CreateIssue(CreateIssueRequest request) in D:\NextGenIssueTracker\branches\2011Updates\NextGenIssueTracker.Proxies\Proxies\IssueTrackerProxy.cs:25
     NGIT.Test.ClientProxy.Default.createIssueButtonClick(Object sender, EventArgs e) in D:\NextGenIssueTracker\branches\2011Updates\NGIT.Test.ClientProxy\Default.aspx.cs:36
     System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
     System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
     System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
     System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
     System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
  </pre>
  
  <p>And here is the inner exception from Trace Viewer:</p>
  
  <pre>
  System.Data.EntityCommandExecutionException, System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  An error occurred while executing the command definition. See the inner exception for details.
  
  at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
  at System.Data.Objects.ObjectContext.CreateFunctionObjectResult[TElement](EntityCommand entityCommand, EntitySet entitySet, EdmType edmType, MergeOption mergeOption)
  at System.Data.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, MergeOption mergeOption, ObjectParameter[] parameters)
  at System.Data.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, ObjectParameter[] parameters)
  at NGIT.Data.UserIssueEntities.CreateIssue(String issueTitle, String nextGenUserId, Nullable`1 guid) in D:\NextGenIssueTracker\branches\2011Updates\NextGenIssueTracker.Data\UserIssueObjectGenerator.cs:line 305
  at Liberty.DataAccess.NGIT.SqlUserIssueRepository.AddIssue(User user, Issue issue) in D:\NextGenIssueTracker\branches\2011Updates\DataAccess.NextGenIssueTracker\Repositories\SqlUserIssueRepository.cs:line 51
  at BusinessServices.NGIT.ServiceImplementations.IssueTrackerService.CreateIssue(CreateIssueRequest request) in D:\NextGenIssueTracker\branches\2011Updates\BusinessServices.NextGenIssueTracker\ServiceImplementations\IssueTrackerService.cs:line 59
  at SyncInvokeCreateIssue(Object , Object[] , Object[] )
  at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
  at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)
  at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
  
  
  </pre>