Changing Business-Object DataSource afterwards

Let's take this BO-model for example:

public List<Contracts> Root

class Contract
{
string ContractID {get; set;}
Company Buyer {get; set;}
Company Seller {get; set;}
}

class Company
{
int Number {get; set;}
List<Person> Employees {get; set;}
Country AtCountry {get; set;}
}

class Person
{
string Name {get; set;}
Country AtCountry {get; set;}
}

class Country
{
string Name {get; set;}
}


We register the data by code using "report.RegisterData(Root, "Root", 4)" and build a FRX from scratch. We do use bands that iterate the contracts, complanies, persons etc.
We save this FRX and all is fine!

Sometime LATER we need to expand our BO-model by new simple properties or even whole new classes in lists.
E.g.:
class Country
{
string Name {get; set;}
string ShortName {get; set;} // NEW simple prop
}

class User // NEW class
{
string Name {get; set;}
string Phone {get; set;}
}

class Contract
{
string ContractID {get; set;}
Company Buyer {get; set;}
Company Seller {get; set;}
User MainReferee {get; set;} // NEW complex prop
List<User> Referees {get; set;} // NEW List of class
}


Now what exactly is the right way in code to change the DataSource afterwards so that:
a) all new props/classes are aviable in the designer
[img]style_emoticons/<#EMO_DIR#>/cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> all existing bands do keep their binded datasources (iterations) c) the filesize of the FRX does not "explode" (in detail the dictionary containg the datasources get extremely large)[/img]

Comments

  • edited 6:26AM
                FastReport.Report report = new FastReport.Report();
                report.Load("TemplateRevision0.frx");
                report.RegisterData(Root, "Root", 4);
                // to reflect changes in datasource, use report.design and save it
                report.Design();
                // dont forget to save it (frx file) after modifying the template
    
  • edited 6:26AM
    Thanks, but I do need a programmatically solution in code without the Designer... [img]style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> Something like "report.CleanUp()"[/img]
    ipong wrote: »
                FastReport.Report report = new FastReport.Report();
                report.Load("TemplateRevision0.frx");
                report.RegisterData(Root, "Root", 4);
                // to reflect changes in datasource, use report.design and save it
                report.Design();
                // dont forget to save it (frx file) after modifying the template
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.