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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:12:16+00:00 2026-05-22T18:12:16+00:00

I’m developing an application using WPF. The pattern that I’m using for it is

  • 0

I’m developing an application using WPF. The pattern that I’m using for it is obviously MVVM. Also I’m using Entity Framework ORM and LINQ-to-Entities to query the EF objects.

My understanding of MVVM is that the View should have no code-behind and only knowledge it should have of the ViewModel is that the ViewModel contains certain properties with which the View is bound and also it contains commands to handle events of the view. Whereas the Model contains only code to get data from DB.

In my model classes I have just written functions which directly query EF objects using Linq-to-entities. The processing that I need to perform on the data before assigning it to properties in VM is either present in the VM or in classes present in the VM project. Just to mention here, that I have 3 projects – View, ViewModel and Model.

My question here is that, can I keep those functions (which involve processing on data from DB) in the VM project or should it be in the Model project? If in ViewModel project, should it be in the concerned VM or in separate classes present in the VM project?

  • 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-22T18:12:16+00:00Added an answer on May 22, 2026 at 6:12 pm

    One of the commonly used practice is to delegate the business logic to the service layer and perform business logic using Repository Pattern. As mentioned in other answers, the ViewModel should decorate the model with view specific properties and commands which handle UI interactions. By its own defination the Model should have all the logic for manipulating the data.

    If you are following Service Oriented Architecture, then the ViewModel can be injected with a service. The service is responsible for perfoming the business functions. These business functions are mostly done on the persisted data. And that logic can be abstracted nicely using any of the ORM tools and technologies like EF or NHibernate. You can do a google search for Repository Pattern which can be helpful if you follow this architecture.

    It is not necessary to use the Repository Pattern if you don’t need it. You can still use EF directly from your service layer. Advantage of having the repository is that it acts like a mapper between the persistance layer(database) and the domain layer(model).

    Hope this helps.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am using Paperclip to handle profile photo uploads in my app. They upload
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.