CslaDataProvider FactoryParameter Page Argument

CslaDataProvider FactoryParameter Page Argument

Old forum URL: forums.lhotka.net/forums/t/5555.aspx


vschuhma posted on Wednesday, October 08, 2008

Hi all,

I am using Wpf Pages passing a BusinessBase object as a parameter. At the same time I would like to apply the CslaDataProvider for convenience doing most of the work in XAML declaratively.  Especially the support of Commands / Buttons is very nice and elegant. Unfortunately these two aims seem to be contradicting.

The issue is connecting the DataProvider to an (freshly created) existing business object. I could get by with a dummy factory method of the business object passing the object and returning it without doing anything. It is not very neat and sort of violates the design principles of lifetime support etc.

I would like to use the Wpf navigation features having a business object as an identifier for a page. I also want to achieve some bookkeeping on open business objects and most recently used business objects which seems to be easier if the respective object is passed as a parameter to the Pages of the application. Italso  helps to have the business object available in the code of the page as a member variable.

The bookkeeping is an UI issue and I would like to keep it out of the business objects themselves. They just implement an interface to make sure every object can supply the basic bookkeeping information like Id and short description. The bookeeping could be done by hooking up Page events to the application level.

e.g I have a CustomerEdit Page which obviously gets passed the Customer Object. I create the object when the EditPage is called and pass it to bookkeeping. Then I pass it as a parameter to the Page and give the page to the navigation service. Now it is in the Navigation History and in my personal record keeping system.

So this is the scenario and it is to my mind more a question of design. Passing objects vs. passing keys and have the objects created by the CslaDataProvider. What is the best choice? Does anybody have some experience or solution to share?

Thx a lot

Best regards

Volker 

 

 

 

RockfordLhotka replied on Wednesday, October 08, 2008

In version 3.6 the CslaDataProvider has an ObjectInstance property that allows you to manually set the object used by the control (no factory is invoked). When this property is set, the data binding infrastructure is notified that the Data property has changed, so the UI binds properly to the new value.

vschuhma replied on Thursday, October 09, 2008

Thanks Rocky,

that sounds great so I will have a look at 3.6 and stick to the principle of passing the business object to the pages.

Best Regards

Volker

Copyright (c) Marimer LLC