I have a WPF application which uses code behind and 3 tier architecture using ADO.NET.We cant use Entity Framework as need paid license for using it with AS400 Database.I am trying to use MVVM now for newer projects .But most tutorials in the internet are with Entity Framework,its kind of confusing to understand following different tutorials/videos in internet . My doubt is- We use a table in Database for getting key,value pairs and bind it in code behind to drop down based on search criteria .I wanted to start using dropdown Binding for this using MVVM.So for that i created a Models class,this contains all fields similar to my table
public class ApplParModel
{
public string AppName { get; set; }
public string ParName { get; set; }
public string ParValue { get; set; }
public string ParDescription { get; set; }
public string ParNum { get; set; }
public DateTime ParDate { get; set; }
public DateTime UpdateDate { get; set; }
public DateTime UpdateTime { get; set; }
}
I have few doubts about the model:
1) I will only always use 2 fields key and value for drop down always public string ParValue { get; set; } public string ParDescription { get; set; }
the rest of the fields are never used ,should i still add rest of the table fields in Models class
2) My database has column names like this APAPPLNAME APTYPE
APVALUE
APVALDESC
APVALNUM
APVALDATE
APUPDATEDT APUPDATETM
should i create getters and setters with the column names? public string APAPPLNAME{ get; set; } instead of public string AppName { get; set; }
my plan was in select query to have "select APPLNAME as AppName" etc
3) We have lots of sub projects with different views but certain dropdowns or key/value pairs like franchise,branch,department,country are used throughout ,is it good to have one model for all projects or separate model for each view.I understand DRY principle should be used ,but i think there will be INotifyPropertyChanged events which may be different for different views and we can also customize some stuff in getters and setters for each view