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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:10:20+00:00 2026-06-08T19:10:20+00:00

The architecture for my application is structured as follows: UI (client-side) User Interface (XAML)

  • 0

The architecture for my application is structured as follows:

UI (client-side)

User Interface (XAML)

VM (client-side)

The layer for all view models. This layer works with the DTOs from the service layer.

Service (server-side)

Communication interface for the client. The client consumes DTOs from this service layer.
This layer does the transformation from DTOs to EF-Entities (and back). I do the transformation with the automapper.

Domain (server-side)

The whole businesslogic seperated in several domains. This layer works with the entities from the entity framework.

Data Acccess (server-side):

The data access layer works with the EF. This layer ist designed with the repository / unitofwork pattern.

My problem: The creation of a new record works well. But if I want to update a record, the EF doesn’t know about the update. It always wants to create a new record. I assume, that the problem is, that the EF works with the references for the whole change-tracking mechanism. The automapper will always create a new record. Is this correct?

Are there any alternatives?

Thanks in advance.

Kind regards, pro

Edit:
Summarization of my problem:

EF does not update in my n-layered architecture, it always wants to create a new record.

I hope that will help.

  • 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-08T19:10:22+00:00Added an answer on June 8, 2026 at 7:10 pm

    You need to make a decision in your business layer based on characteristics of the entity. If your entity has an ID, then it must be already existing, and therefore you should use

    context.YourEntities.Attach(entity);
    context.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
    

    but if it hasn’t, then it’s new, and you can use

    context.YourEntities.AddObject(entity);
    

    then after both paths,

    context.SaveChanges();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application architecture looks like this. GWT in the UI layer -> Calls GWT
In Patterns of Enterprise Application Architecture, Martin Fowler writes: This book is thus about
I'm rewriting an LOB application whose architecture is like this: Silverlight && Windows Mobile
I have following architecture in my application. Client (GWT) <--calls--> Servlet <--calls--> Service <--calls-->
Having read all the StackOverflow entries regarding Model-View-ViewModel architecture along with most of the
Following this tutorial i'm developing a web application using symfony authentication/authorization architecture. After designing
we have a classical 3-tier-architecture application. Now we face a little problem and we
In the book of application architecture design, which I'am reading, I've found the following
I’m working on an application which has been designed using n-tire application architecture .The
The architecture of the application is straight forward. There is a web application which

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.