Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7159955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:19:03+00:00 2026-05-28T13:19:03+00:00

I have a project containing POCO entities. A database context has been created for

  • 0

I have a project containing POCO entities. A database context has been created for it using Entity Framework 4.2 and code first. This works fine, but the context needs to be exposed as an OData service which does not work.

Browsing to the OData service gives this error:

The property ‘DataSubmissionItems’ on type
‘Lifecycle.ProgramReportSubmission.Model.ProgramReportSubmission’ is
not a valid property. Properties whose types are collection of
primitives or complex types are not supported.

The data service class looks like:

public class ExceptionReportDataService : DataService<ExceptionReportEntitiesContext>
{
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    {
        config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        config.UseVerboseErrors = true;
    }
}

The EF context class looks like:

public class ExceptionReportEntitiesContext : DbContext
{
    public DbSet<ExceptionReport> ExceptionReports { get; set; }

    public ExceptionReportEntitiesContext()
        : base(DynamicConfig.GetAppSettingValue("DB_CONN_STRING_LIFECYCLE"))
    {
    }
}

The POCO entities look like:

namespace WBRT.ProgramData.Lifecycle.ExceptionReportModel
{
    public class ExceptionReport
    {
        public virtual Guid ExceptionReportID { get; set; }
        public virtual Lifecycle.ProgramReportSubmission.Model.ProgramReportSubmission ReportSubmission { get; set; }       
    }
}

namespace Lifecycle.ProgramReportSubmission.Model
{           
    public class ProgramReportSubmission
    {
        public Guid ProgramReportSubmissionId { get; set; }
        public virtual ICollection<DataSubmissionItem> DataSubmissionItems { get; set; }
    }

    public class DataSubmissionItem
    {
        public Guid DataSubmissionItemId { get; set; }
    }
}

What I’ve tried:

  • Setting DataServiceKey on the DataSubmissionItem class
  • Setting ProxyCreationEnabled to false on the ExceptionReportEntitiesContext constructor as well as in the data service
  • Overriding OnModelCreating and removing the IncludeMetadataConvention
  • Overriding OnModelCreating and setting modelBuilder.Entity<ProgramReportSubmission.Model.ProgramReportSubmission>().Ignore(prs => prs.DataSubmissionItems);

Note: I can’t introduce a dependency on the EntityFramework DLL in the POCO entities project as this affects referencing projects that still run .NET 3.5.

Anyone know how to resolve this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:19:04+00:00Added an answer on May 28, 2026 at 1:19 pm

    THe RTM version of WCF DS doesn’t support these kind of properties. But the latest CTP does. http://blogs.msdn.com/b/astoriateam/archive/2011/10/13/announcing-wcf-data-services-oct-2011-ctp-for-net-4-and-silverlight-4.aspx.

    On the other hand, the fact that you get such an error probably means that WCF DS doesn’t recognize the provider as EF, and istead works with it as with a reflection provider. So even the latest CTP won’t really fix that problem.

    WCF DS currently only recognizes EF provider if the T in DataService is ObjectContext or derived type. The typical workaround for EF Code First is to define the service as DataService and then override the CreateDataSource method on it and return the ObjectContext implementation from your DbContext. See this article about how to do that (it’s about EF 4.1, but I think the same will apply to 4.2 as well): http://social.technet.microsoft.com/wiki/contents/articles/5234.aspx. You can skip down to the part about WCF DS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project directory which has an .acignore file containing: out/* The project
I have a project on GitHub that has a directory containing some automatically generated
I have a project containing cocos2d framework, sharekit, asi & json. I've noticed that
I have a project containing C/C++ files. I'd like to build it without using
I have an open source project containing both Python and C code. I'm wondering
I have a project containing files generated from a .g file (antlr 2.7.x). The
Suppose I have a VC++ project containing number of Source (.cpp) files (e.g. 5),
I have a solution in Visual studio containing a winform project(WinProj) and a deployment
I have been writing an assembly to simplify much of my POCO type generation.
I have a project containing an image, css and js folder. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.