1

I have read about connected model and disconnected model in the main ORM of Microsoft EF . And found that the default behavior is the disconnected .

Then i read about the relationship between these two models and the software architecture .

1-tier vs. N-tier
  • 1-tier applications like WPF use connected model.
  • N-tier applications like asp.net use disconnected model.

I'm so confused about the concept of disconnected model in N-tier applications .

I want some examples to illustrate the idea of disconnected model in web applications and why i can't use connected model in the context of Entity framework as an ORM ?

1 Answer 1

1

What exactly would it mean to keep the model connected in a web app? Each call to the URI endpoint creates a new instance of the controller. This means that even if you tried to keep it connected, you couldn't because the model is going to go out of scope after the controller has served up the content and finished running.

Contrast this to a WPF application running on a desktop. On the desktop, the application doesn't stop running after you've navigated to a different view. Since it's still running, the model remains in memory, so you can keep it connected and reap the benefits of staying connected.

2
  • I mean for example if i have a web app in which the user select a product to update it's data , so i will create a context and in the scope of this context i will assign the user inputs for this product then save changes ! where could i need the disconnected model where the dbcontext unaware of the state ob my objects , Could you explain more with examples i'm so confused . Commented Jan 26, 2017 at 12:19
  • For passing/serializing data into the HTML view.
    – RubberDuck
    Commented Jan 26, 2017 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.