Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
The Business Object Mapper just writes the partial class definition for the business objects, which defines the strong-typed field properties similar to a TypedDataSet. Once the business object is added to the project, it becomes just another class in the project (but a class that inherits all of the functionality of the BusinessLayer class). So, to answer your questions:
1) In a WinForms project, the business objects are not automatically instantiated by the framework (the only time this happens in the WebForms is if the business object's defined in the ApplicationBasePage are null, then we intantiate a business object and place it in the variable).
If you drop a business object on a form, you'll notice that the Windows Forms Designer adds the variable definition and the call to the constructor in the InitializeComponent() method. So, the framework does not instantiate the business objects, even if you drop them on the form. Your two options for instantiating a new business object are: a) drop one on a form, and the form will instantiate it in the InitializeComponent() call. b) create one new in code with "MyBusinessObject myBo = new MyBusinessObject()"
2) No, the business objects do not automatically fill themselves. There are methods in place to filter the already collected DataTable (such as the ChildAutoFilterOption), but you must create and call "Fill" methods to populate a business object. The ParentFormLoading event on a business object is provided for you to add a call to a "Fill" method in the proper sequence to bind the bound controls immediately after a fill.
3) If you ever want to access a business object, all of the field properties are public, and all you would need to do is obtain a reference to the business object and talk to it directly. A business object (even one that is dropped directly on a form) can be accessed as if it was just another class without any implications.
Hopefully this explains it a little better. Let me know if you need more clarification.
|