I have the following code, to store a web service name value pair response into DB. I am saving it in xml column of DB. Kindly highlight the issues with this approach. Please note that the name value pair (i.e response.details) array is dynamic and i cannot directly map it to individual db columns.
XElement ex = new XElement("ServiceResponse","");
for (int i = 0; i < response.details.Length; i++)
{
string Name = Regex.Replace(response.details[i].name.Trim(),@"[^A-Za-z0-9.]+","");
ex.Add(new XElement("Details",new XElement(Name, response.details[i].value)));
}
using (DBDataContext con = new DBDataContext())
{
con.Requests.InsertOnSubmit(new Nettium.FraudManagementBase.DataContext.Request
{
response = ex
}
);
con.SubmitChanges();
}
Thanks