hello , iam using CSLA 4 with silverlight . ihave datagrid where it deals with
BusinessListBase (rootparent List) where it contains BusinessBase(child of rootparent) and the BusinessBase Contains
Child Element BusinessListBase(child list) and the last level is BusinessBase from (child list) when i add new
iam using ViewModel
when i save on edit everything is working fine
void SaveMethod()
{
Model.ApplyEdit();
BeginSave();
}
with the last code i can save when ever i want with no problems
but my issue is that i when i add new Object to the root and try to save i get the following error :
Object Still being edit and cant be saved .
i thought when i add new object to datagrid it doesnt call ApplyEdit
so i did the following code :
void SaveMethod()
{
Model.ApplyEdit();
foreach(var item in Model)
{if(item.IsNew)
item.ApplyEdit();
}
BeginSave();
}
when i did the last code the error change to EditLevelMisMatch
Note : as i said before ihave four levels here (BusinessListBase=>BusinessBase( BusinessListBase =>BusinessBase) all the levels Marked As Child only the First level Not marked
my grid contain subgrid on each row where i can add rows with no erros
so the error comes only when i add to the root
please any help
Every datagrid control is a little different, so that could be the issue.
But also it is the case that a child object comes into being with the same edit level as its parent. So when you add a child to a parent that has an elevated edit level, that child will also have that elevated edit level, and you need to be aware of that. I suspect that's what is happening here, and since you never call ApplyEdit on that new child, its edit level is never brought down to 0.
hello rocky, well i had did foreach for looking for the new objects
and call item.ApplyEdit() but when doing that i get EditLevelMismatch
so i cant call BeginSave() it will raise EditLevelMismatch
here's my classe structure
class ParentList:BusinessListBase<ChildParent>
{
}
class ChildParent:BusinessBase<ChildParent>
{
public ChildList
{
get
{
return ReadProperty(someproperty);
}
}
public ChildParent()
{
MarkAsChild();
}
}
class ChildList:BusinessListBase<ChildLastLevel>
{
public ChildList()
{MarkAsChild();
}
}
class ChildLastLevel:BusinessBase<ChildLastLevel>
{
public ChildLastLevel()
{
MarkAsChild();
}
}
this is how the structure for me works
when i add ChildLastLevel to the parent object i can save and applyedit with no problems
but when i add ChildParent to the ParentList i get the error ( Object is still being edited cant be saved )
and when i apply the edit on the new object it gives me ( Edit Level MisMatch )
really thank you for your Response
Copyright (c) Marimer LLC