xml Document not called propertychanged

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello there I am new to xml and this is my first project working on xml files so needs bit help of yours
<br/>
Data Layer<br/>
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_InputDataXML", DbType="Xml", UpdateCheck=UpdateCheck.Never)]<br/>
public System.Xml.Linq.XDocument InputDataXML<br/>
{<br/>
get<br/>
{<br/>
return this._InputDataXML;<br/>
}<br/>
set<br/>
{<br/>
if ((this._InputDataXML != value))<br/>
{<br/>
this.OnInputDataXMLChanging(value);<br/>
this.SendPropertyChanging();<br/>
this._InputDataXML = value;<br/>
this.SendPropertyChanged("InputDataXML");<br/>
this.OnInputDataXMLChanged();<br/>
}<br/>
}<br/>
}
MV<br/>
private XDocument _xmlDoc;<br/>
private StudyConfig _studyConfigData;<br/>
private XElement _parent;<br/>
private XElement _xElement;<br/>
void SetStudyConfigData ()<br/>
{<br/>
try<br/>
{<br/>
_studyConfigData = (from sc in _studyDataContext.StudyConfigs<br/>
where sc.SiteId == SiteId && sc.StudyId
== StudyId<br/>
select sc).Single<StudyConfig>();<br/>
}<br/>
catch (Exception ex)<br/>
{<br/>
}<br/>
finally<br/>
{<br/>
if (_studyConfigData == null)<br/>
{<br/>
_studyConfigData = new StudyConfig();<br/>
_xmlDoc = new XDocument();<br/>
_parent = new XElement("Parent");<br/>
_xmlDoc.Add(_parent);<br/>
_dataExists = false;<br/>
_studyConfigData.InputDataXML = _xmlDoc;<br/>
}<br/>
else<br/>
{<br/>
_xmlDoc = _studyConfigData.InputDataXML;<br/>
_dataExists = true;<br/>
_studyConfigData.InputDataXML = null;<br/>
// _studyDataContext.ExecuteCommand("UPDATE StudyConfig SET inputDataXML = NULL WHERE Id =" + _studyConfigData.Id);
}<br/>
}<br/>

<br/>
}
public void AddElement(XElement Element)<br/>
{<br/>
SetStudyConfigData();<br/>
_xmlDoc.Element("Parent").Add(Element);<br/>
_studyConfigData.InputDataXML = _xmlDoc;<br/>
// _parent.Add(Element);<br/>
<br/>
// _xmlDoc.Add(Element);<br/>
}
At this point _xmlDoc =’ <Parent><br/>
<sample_Recieved number_of_itme="Int" date="DateTime" /><br/>
</Parent>’<br/>
And Element = ‘<sample_Recieved_Second number_of_itme="Int" date="DateTime" />’<br/>
So at the end of the function _xmlDoc =<br/>
’ <Parent><br/>
<sample_Recieved number_of_itme="Int" date="DateTime" /><br/>
<sample_Recieved_Second number_of_itme="Int" date="DateTime" /><br/>
</Parent>’<br/>
Its all looks good
public void Save()<br/>
{<br/>
try<br/>
{<br/>

<br/>
if (!_dataExists)<br/>
{<br/>
_studyDataContext.StudyConfigs.InsertOnSubmit(_studyConfigData);<br/>
}<br/>

<br/>
_studyDataContext.SubmitChanges();<br/>
}<br/>
catch (Exception ex)<br/>
{<br/>
MessageBox.Show(ex.Message);<br/>
}<br/>
}
When I call save(); the change is not effecting the database <br/>
Any help would be appreciated <br/>


View the full article
 
Back
Top