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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:52:29+00:00 2026-05-26T23:52:29+00:00

I have a MVC3 Project and I have run into a problem. I have

  • 0

I have a MVC3 Project and I have run into a problem. I have a Create controller which takes as a parameter one of my POCO objects. I add this object to the database like this:

  entity = dbSet.Add(entity);

After this method returns, I would like to use the lazy loading features of the object. Unfortunately the object is not a Proxy object generated by the EntityFramework…Is there a way to somehow solve this?

Thank You,
AFrieze

  • 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-26T23:52:29+00:00Added an answer on May 26, 2026 at 11:52 pm

    The entity must be already proxied when you pass it to Add method. Add method will not return another instance of the class and you cannot change the type of the existing instance to the proxy type.

    Your options are:

    • Not using entity as input in controller – use some view model and populate new entity created by dbSet.Create – this will create empty proxied detached entity.
    • Instead of adding the entity received in controller create a new one by dbSet.Create and copy data from received one to created one
    • Don’t use default model binder. Create custom model binder (that is the code responsible for extracting data from HTTP request and populating parameters passed to controller) which will use dbSet.Create instead of default entity constructor.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am utilising Liquibase (www.liquibase.org) into our MVC3 SQL Server 2008 project to manage
I have the following in my project (MVC3) N2CMS 2.2.1 (from nuget). I am
Eclipse STS is reporting I have problem with my spring project. It's a fresh
I have an MVC3 project I created using the Code First paradigm and it
I have an MVC3 with nHibernate project, and I would like to make use
I have an asp.net mvc3 project, it has some reports in aspx web pages.
I have an ASP.NET MVC3 project that uses a tab strip on certain pages.
I currently have two unrelated MVC3 projects hosted online. One works fine, the other
I'm developing MVC3 project and have this situation. only at runtime. I'm using the
I have been publishing my MVC3 project to IIS including All Project Files, this

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.