I read my records from database and restore in binding list. now I want to add new entitys to my bindinglist but It dosent work. when I add a first entity There is no problem. after that for each entity I insert, my previous entitys change to last entity. I ts like that every entitys are point to one entity, and when I add new entity every entities change and update to new value. here is my code.
My_Entity _Entity;
BindingList<My_Entity> List;
//====================================
List = businessLogic.SelectAll();//fill list
//===============================================开发者_开发百科
_Entity = new My_Entity();
_Entity = get_data(); //fill entity here
businessLogic.Entity = _Entity;
if (businessLogic.SendToInsert())
{
List.Add(_Entity);
}
where is the problem ?
thanks every body. The Entity in Get_Data() Method. didnt be new in each time I call it. I new that entity and the problem is solved .
try with below settings
BindingList<My_Entity> List ;
List.AllowNew = true;
List.AllowEdit = true;
List.AllowRemove = true;
精彩评论