Is this a bug? : I get " The type ... is not a complex type or an entity type" in my WCF data servic

Posted by veertien on Stack Overflow See other posts from Stack Overflow or by veertien
Published on 2010-06-07T10:43:10Z Indexed on 2010/06/07 10:52 UTC
Read the original article Hit count: 554

When invoking a query on the data service I get this error message inside the XML feed:

  <m:error>
    <m:code></m:code>
    <m:message xml:lang="nl-NL">Internal Server Error. The type 'MyType' is not a complex type or an entity type.</m:message>
  </m:error>

When I use the example described here in the article "How to: Create a Data Service Using the Reflection Provider (WCF Data Services)" http://msdn.microsoft.com/en-us/library/dd728281(v=VS.100).aspx it works as expected.

I have created the service in a .NET 4.0 web project. My data context class returns a query object that is derived from the LINQExtender (http://linqextender.codeplex.com/). When I execute the query object in a unit test, it works as expected.

My entity type is defined as:

[DataServiceKey("Id")]
public class Accommodation
{
    [UniqueIdentifier]
    [OriginalFieldName("EntityId")]
    public string Id { get; set; }

    [OriginalFieldName("AccoName")]
    public string Name { get; set; }
}

(the UniqueIdentifier and OriginalFieldName attributes are used by LINQExtender)

Does anybody know if this is a bug in WCF data services or am I doing something wrong?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wcf-data-services