I am new to wpf. I am trying to create crud in wpf using entityframework. This is my model
class User : INotifyPropertyChanged
{
private string _id;
private string _firstName;
private string _lastName;
public User()
{
}
public string ID
{
get { return _id; }
set
{
_id = value;
NotifyOfPropertyChange("ID");
}
}
public string FirstName
{
get { return _firstName; }
set
{
_firstName = value;
NotifyOfPropertyChange("FirstName");
}
}
public string LastName
{
get { return _lastName; }
set
{
_lastName = value;
NotifyOfPropertyChange("LastName");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyOfPropertyChange(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
when i add ado.net data model file it creates class like this
public partial class User
{
public string ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
so when i try to assign list Like this
ObservableCollection<User> lst = new ObservableCollection<User>();
lst = _entity.Users.ToList();
it gives me error
Error 1 Cannot implicitly convert type 'System.Collections.ObjectModel.ObservableCollection<TEST.User>' to 'System.Collections.Generic.List<TEST.Model.User>' D:\my_backup\WPF\TEST\TEST\Model\PersonnelBusinessObject.cs 15 24 TEST
how can i convert it to according to my class formate.please help.