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 5984145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:19:57+00:00 2026-05-22T22:19:57+00:00

Does WCF Data Services support working with Entity Framework Code First (4.1)? It seems

  • 0

Does WCF Data Services support working with Entity Framework Code First (4.1)? It seems like it’s having a hard time understanding what to do with DbSet or DbContext. I suppose this shouldn’t be too surprising since EFCF was released after Data Services.

internal class Context:DbContext {
    public Context(String nameOrConnectionString) : base(nameOrConnectionString) { }

    public DbSet<AlertQueue> Alerts { get; set; }
}

public class EntitySet:Abstract.EntitySet {
    public EntitySet(String nameOrConnectionString) {
        var context = new Context(nameOrConnectionString);

        this.AlertQueueRepository = new Concrete.AlertQueueRepository(new Repository<AlertQueue>(context, context.Alerts));
    }
}

public class AlertQueueRepository:EntityRepository<AlertQueue> {
    public AlertQueueRepository(IEntityRepository<AlertQueue> entityRepository):base(entityRepository) { }

    public IQueryable<AlertQueue> Pending {
        get {
            return (from alert in this.All
                    where alert.ReviewMoment == null
                    select alert);
        }
    }
}

EntityRepository and IEntityRepository provide generic methods for All and other CRUD functions. This is the WCF Data Service that isn’t working:

public class WcfDataService1:DataService<Domain.Concrete.AlertQueueRepository> {
    public static void InitializeService(DataServiceConfiguration config) {
        config.SetEntitySetAccessRule("All", EntitySetRights.AllRead);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    }
}
  • 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-22T22:19:58+00:00Added an answer on May 22, 2026 at 10:19 pm

    You need to install Microsoft WCF Data Services 2011 CTP2.

    Here is a good step by step article from the ADO.NET Team Blog: Using WCF Data Services with Entity Framework 4.1 and Code First

    You will need to change the reference for “System.Data.Services” and “System.Data.Services.Client”
    to “Microsoft.Data.Services” and “Microsoft.Data.Services.Client” after installing the CTP and then you will have a new V3 protocol version (DataServiceProtocolVersion.V3)

    Add a constructor like below to pass in a connection string or database name

    public class HospitalContext : DbContext
    {
        public HospitalContext(string dbname) : base(dbname)
        {
        }
    
        public DbSet<Patient> Patients { get; set; }
        public DbSet<LabResult> LabResults { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicates: What is REST?[closed] Does the WCF REST WebChannelFactory client support REST services
I have a WCF Data Service that exposes an Entity Framework database context and
Does anyone have any experience with how well web services build with Microsoft's WCF
I'm currently working on a wcf service that does some lookups in a database
just a couple of questions? Is WCF Data Services tightly integrated with EF Can
I'm currently experimenting with using WCF Data Services as a way to open up
I am creating an OData service with WCF Data Services using an EDMX. How
I am working with Azure Table storage using the .NET API (TableServiceContext, WCF Data
Architecturally speaking how could you consolidate data coming from multiple OData / WCF services
How does the life cycle looks like for the following : WCF Webservice(http) If

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.