I'm working on a ASP.NET Dynamic Data web site with a Linq to SQL Database Context and I have a question. In one of my tables, ARReports, exists a column with raw XML data which I can deserialize into a ReportDetails object, along with other data such as EditedBy, ReleaseDate, and other fields.
ReportDetails has several public properties which I would like to expose on my custom Edit.aspx page.
My goal is: when a user navigates to the Edit.aspx page, I want them to be able to edit the ARReports row and the public properties of ReportDetails, all of which are primative types. Then when they update: serialize the ReportDetails object back into XML and update that field in the table.
Is there anyway I can say, create a Property in the ARReport class (the Linq to SQL class) of type ReportDetails, and have that class scaffold into the Edit.aspx page? Maybe something that looks like this:
public partial class ARReport
{
private ReportDetails _details;
public ReportDetails Details
{
get
{
if (_details == null)
_details = ReportDetails.DeSerialize(this.RawXML);
return _details;
}
set
{
this.RawXML = ReportDetails.Serialize(_details);
}
}
public class ReportDetails
{
public String Owner {get; set;}
public DateTime LastEdit {get; set;}
//...etc...
public static String Serialize(ReportDetails report)
{
// serialization code
}
public static ReportDetails DeSerialize(String rawXML)
{
// deserialization code
}
}
I am hoping there is some combination of Attributes and/or tricks I can apply to the classes and properties to achieve what I am looking for but so far, a rigorous google search has not presented any solutions. I hope this wasn't too confusing. I appreciate any help or insight.