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 have a new MVC3 project with one Controller called PublicController.cs which contains 4
I have a MVC3 ASP.NET Project in which I am using jQuery and KendoUI
I have a Create View page in my MVC3 project to create instances of
I am writing a MVC3 project. Right now I have a table which has
I am writing a MVC3 project. Right now I have a table which has
I have just turned my mvc3 project into a mvc4 project. I made a
MVC3 project. I have several classes: Account, Address, Phone etc. which I set up
I have MVC3 project & Valums file uploader . The code is following <script
I have a MVC3 project for running on the iPad in the web-app mode.
In an ASP.NET MVC3 project I have a structure like this: Core.csproj -> 3rdparty1.dll

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.