Help - Search - Members - Calendar
Full Version: Changes in business objects engine
Fast Reports forum > Fast Reports Products > FastReport .NET
AlexTZ
Hello everybody,

The new build (1.1.20) comes with completely new engline that handles business objects (BO). The new engine was designed to overcome the following restrictions of old engine:

- when registering a business object, you have to indicate maximum nesting level. It was needed because not all BOs have tree-like structure, some of them use parent-child relations, which may lead to infinite loop. This is no longer needed with the new engine: you may have as many nested objects as you want - just go "Data|Choose Report Data..." dialog and expand elements that you want to use;

- old BO engine was not able to correctly represent nested IEnumerable elements if they were contained in another (non-IEnumerable type) properties. For example, consider the following class structure:

CODE
public class Master
{
  public DetailInfo Info { get; set; }
}

public class DetailInfo
{
  public List<Detail> Detail { get; set; }
}

public class Detail
{
  public int SomeProperty { get; set; }
}


in the old version, this was converted to the following data tree:

CODE
Master
|
+- Info
|
+- Detail


(i.e. the Detail datasource belongs to Master which is confusing)

The new version handles this more natural:

CODE
Master
|
+- Info
   |
   +- Detail


Unfortunately, this is a breaking change. Here is a list of issues that should be corrected:

1) The
report.RegisterData(IEnumerable, string, BOConverterFlags, int)
method is kept for compatibility only. Instead of it, use
report.RegisterData(IEnumerable, string)
-or-
report.RegisterData(IEnumerable, string, int)
The latter method creates n-level initial datasource structure and may be used if you create a report in code. In other cases, use the first method.

2) New BO engine can handle public properties only. Fields cannot be handled anymore. If you have a code like
CODE
public MyClass
{
  public string MyField;
}

you need to convert the field to a property:
CODE
public MyClass
{
  private string _myField;

  public string MyField
  {
    get { return _myField; }
    set { _myField = value; }
  }
}



3) New BO engine handles nested IEnumerable properties differently, as stated above. Due to this new behavior, you have to change your reports (that use nested business objects) accordingly:
- open the report in FR designer;
- go "Data|Choose Report Data..." window and uncheck the root element (in the sample above - the "Master"). Close the dialog;
- save the report;
- open the report again;
- go "Data|Choose Report Data..." window and check datasources you need;

The steps above are needed to delete old (bad) data objects that is stored in the report file, and create new ones. Now attach new data objects to report items:
- assign appropriate datasources to each databand in your report (double-click the databand and select datasource). If you use the "Matrix" object, check its "DataSource" property as well;
- you may also need to change Text objects. In the sample class above, to access the Detail.SomeProperty, you have to use its full path: "Master.Info.Detail.SomeProperty". In earlier version, the path was: "Master.Detail.SomeProperty" - you have to correct this.
louise09
Thanks for telling us about it. It's very useful information.

Regards,
Louise
Pret travaux
sweeppickerr
I have applied these codes but these are giving some errors in my system. Can u help?

Thanks
reenfoo
ublic class Master
{
public DetailInfo Info { get; set; }
}

public class DetailInfo
{
public List<Detail> Detail { get; set; }
}

public class Detail
{
public int SomeProperty { get; set; }

Unfortunately, this coding set is not working in mine.

peace out~
cbr00t
I was use [Browsable()] attribute on DataSource Properties. There are some properties that Report must not see.
(e.g: Some properties has a value as DELEGATE... If report check these properties, it throws an exception when I execute 'RegisterData').

So, Will I cannot say that, only see properties that have [Browsable(true)] attribute??
Paddy
Thanks for sharing this detailed information regarding new engline, codes shared by you really worked for me, i am glad to use this codes for my engline. But as you said after replacing codes we come across those following errors mentioned by you ,your explanation really helped us in overcoming those obstacles.Will try to experiment with this piece of code and if found any strange behavior will share it here for the discussion.Great post thanks once again.
mayle
Thanks for posting this code for us, it will definitely come in handy, I'm going to try it out.

May

-----------------
hairmax lasercomb reviewrogaine side effects.
lebode
QUOTE(mayle @ Nov 1 2011, 10:14 AM) *
Thanks for posting this code for us, it will definitely come in handy, I'm going to try it out.

May
Regrow hair with hairmax lasercomb review rogaine side effects.




No doubt, have you tried this out yet? I couldn't get it to work. I must be missing something as I am getting some error messages.

Ragards, B
lebode
QUOTE(cbr00t @ Jun 23 2011, 08:32 AM) *
I was use [Browsable()] attribute on DataSource Properties. There are some properties that Report must not see.
(e.g: Some properties has a value as DELEGATE... If report check these properties, it throws an exception when I execute 'RegisterData').
Regrow hair with biotin side effects rogaine foam rogaine for women reviews
So, Will I cannot say that, only see properties that have [Browsable(true)] attribute??


I was wondering the same....... Anyone have an answer?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.