Solved

MVC 4

Posted on 2014-09-06
5
148 Views
Last Modified: 2014-09-07
is that ok to reuse same viewmodel to different Views?but the function of viewmodel is the same with different views
0
Comment
Question by:jabz ayuap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 40307457
Please check the forum below: stackoverflow.com/questions/5767097/is-it-feasible-to-reuse-wpf-viewmodels-in-mvc
0
 

Author Comment

by:jabz ayuap
ID: 40307465
It means that this viewmodel gives a specific argument or data manipulation to supply the value to view, im just wondering if I use the same function but different class theres no conflict will happen, Im just wondering if theres any conflict may happen if I use the same viewmodel if the client use the transaction
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 40307477
There will not be any conflicts, but it will be good if you don't use the same.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40307735
Yes, you can use the same view model between views. A view model is just a class, and a view model's intent is to represent the data elements that you want to display on the screen. If two views have the same data elements, then it certainly could make sense to share the same view model.

Now, you have to be careful regarding changes to the view model class. Since you might be sharing this class, changes for one view could cause changes to the view model class. This may or may not have an impact on your second view. For example, if you rename a property on the view model, then the 2nd view needs to refer to this new name if it is using that property. If you add in a new property, but the 2nd view doesn't use this property--or remove a property that the 2nd view isn't using--then there should be no issue:  you're not using the property anyway.
0
 

Author Comment

by:jabz ayuap
ID: 40308491
Thank you very much am just wondering and worried because im creating  different view using the same viewmodel thats why I ask you guys thank you very.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Blending HTML output from R Studio into a ASP.Net/C# project 4 53
CSS question 16 63
Fastest way to get file count in MS Server 2012 3 38
Shared Service Environment 2 55
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question