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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:45:14+00:00 2026-05-18T20:45:14+00:00

Morshed Anwar’s article Implementing Repository Pattern with Entity Framework starts off with this at

  • 0

Morshed Anwar’s article “Implementing Repository Pattern with Entity Framework”
starts off with this at the top of his repository:

public class Repository<E, C> : IRepository<E, C>, IDisposable
    where E : EntityObject
    where C : ObjectContext
{ ... }

Say you want to use ASP.NET POCO Entity Generator, you could change EntityObject to class. However, in order to get all the properties of the EntityObject, you would need to use reflection to determine that the class does in fact have all the properties and methods of an EntityObject.

Is there a better constraint other than class we could substitute for EntityObject using ASP.NET POCO Entity Generator to expose the EntityObject properties and methods normally available using where E : EntityObject?

  • 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-18T20:45:15+00:00Added an answer on May 18, 2026 at 8:45 pm

    First of all, that Generic Repository implementation is ugly (CodeProject, in general, has been a disappointing source for good examples in my opinion). There’s no two ways around it.

    When using POCO Objects, there’s really no reason to need to reflect. Take advantage of the EntityContext.CreateObjectSet<T> method and let Entity Framework worry about the details.

    If you want to take a look at a much cleaner Generic Repository implementation, check out:

    Elegant Code >> Entity Framework POCO (EF4): Generic Repository and Unit of Work

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

Sidebar

Related Questions

The same way DOS morphed into Windows? We seem to have ended up supporting

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.