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

  • Home
  • SEARCH
  • 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 8115863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:36:12+00:00 2026-06-06T03:36:12+00:00

My team is using Entity Framework 4.3.0 – Code Only with POCO classes as

  • 0

My team is using Entity Framework 4.3.0 – Code Only with POCO classes as our ORM. Right now we use DBSets of Classes to access our ‘tables’

Public Property Customers As DbSet(Of Customers)

But often we are doing soft deletes based on a IsDeleted column in LINQ, and filtering our select statements accordingly:

Dim LiveCustomers =
    From C In EM.Customers
    Where C.DeleteFlag = False

What I would really like to do is, instead of writing every query to include this filter, create some lower level property (possibly at our inherited DbContext level) that provides the filtered set, while maintaining strong type.

I tried this:

Public Property Customers As DbSet(Of Customer)

Public Property Customers_Live As DbSet(Of Customer)
    Get
        Return From C In Customers
                Where C.DeleteFlag = False
    End Get
    Set(value As DbSet(Of Customer))
        Customers = value
    End Set
End Property

However that yielded me this error:

Multiple object sets per type are not supported. The object sets ‘Customers’ and ‘Customers_Live’ can both contain instances of type ‘__.Customer’.

A quick check on google yielded this promising result (How to: Query Objects with Multiple Entity Sets per Type) But after updating my Connection String, I’m still getting the same error.

  <add name="EntityManager"
       providerName="System.Data.SqlClient"
       connectionString="
          Data Source=xxxxxx;
          Initial Catalog=xxxxxx;
          User Id=xxxxxx;
          Password=xxxxxx;
          MultipleActiveResultSets=True"/>

So my question is, how could I effectively create a LINQ view that allows me to apply filtering, without impacting the upstream usage too drastically?

  • 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-06-06T03:36:13+00:00Added an answer on June 6, 2026 at 3:36 am

    Change your property like this:

    Public Property Customers As DbSet(Of Customer)
    
    Public Property Customers_Live As IQueryable(Of Customer)
        Get
            Return From C In Customers
                    Where C.DeleteFlag = False
        End Get
    End Property
    

    This is slightly different, as you won’t have things like Add() or Remove(), but for a view you typically wouldn’t expect to have that kind of functionality. If you want to add a new one, or remove one you should use the normal Customers property.

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

Sidebar

Related Questions

Our team is using the Entity Framework 4.1 ORM. We're not using it in
We've been using Team City as our build deployment server. We'd like to now
I've been trying to implement POCO over WCF (using Entity Framework 4.0) - just
Recently our WPF/Entity Framework 4.0 application has become unstable after we began using backgroundworkers
When using the CTP 5 of Entity Framework code-first library (as announced here )
My team is considering using an up to date version of Entity Framework with
I have developed a project using MVC3 and Code first Entity Framework 4.0 as
I am trying to convince my team to use an ORM layer like entity
I have created a very simple Entity Framework 4.0 model using VS2010 Professional. Ignore
I have an idea to streamline deployments of prototypes within our team using VMs.

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.