خرید بک لینک

Vote count: 0

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 { retu _id; }
        set
        {
            _id = value;
            NotifyOfPropertyChange("ID");
        }
    }
    public string FirstName
    {
        get { retu _firstName; }
        set
        {
            _firstName = value;
            NotifyOfPropertyChange("FirstName");
        }
    }
    public string LastName
    {
        get { retu _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   Caot implicitly convert type 'System.Collections.ObjectModel.ObservableCollection<TEST.User>' to 'System.Collections.Generic.List<TEST.Model.User>'   D:my_backupWPFTESTTESTModelPersoelBusinessObject.cs 15  24  TEST

how can i convert it to according to my class formate.please help.

asked 27 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 30 تير 1395 ساعت: 20:05

صفحه بندی