This is a migrated thread and some comments may be shown as answers.

Silverlight ObjectDataSource

2 Answers 79 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yonggu Kang
Top achievements
Rank 1
Iron
Yonggu Kang asked on 05 Dec 2011, 04:19 PM
Hi, all

I'm new to Telerik reporting with silverlight and l'm using CSLA business object.
My business objects have no public constructor, instead have factory method .
and every query method allow only 1 criteria object,in which includes 1 to dozens fileds to create
linq entity syntax. However,looking into your manual, Telerik reporting's objectDataSource
should have public constructor and a public method for 'DataMember' which has same
number of params. I have already built hundreds of object and can't change into public constructor
and parameter signature as well. I have read many threads related, and not sure there might be
something I didn't catch up.

Though it looks like unacceptable, what I'd like to know is kinds of follwing code snippet
 is available in server side.

// create biz object with factory methods
MyBizObjType myObj = MyBizObjType.NewMyBizObjType();
// create criteria object from parms
var criteria = new MyBizCriteria(parms1,parms2.......);
// call search method
myObj.FetchData(criteria);

// create reporting datasource
Telerik.Reporting.ObjectDataSource objectDataSource1 = new Telerik.Reporting.ObjectDataSource();

 // objectDataSource1.DataMember = "GetCars";
 // objectDataSource1.DataSource = typeof(Cars);

// set datasource such as data binding in winform's day.
objectDataSource1.DataSource = myObj;

You must have been asked hundreads of similar question,and may have a good alternative.
Pls let me know better way if above is unacceptable.
At this time, I think I have no other way to make each new entity object wrapping business
 object who engages in reporting. But the real pain is that the number of object reaches several hundreads.

Thank you in advance.
Kang




2 Answers, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 06 Dec 2011, 06:03 PM
Hello Yong-Gu Kang,

The objectDataSource is quite flexible and I see no reason it won't serve you in this case. The public constructor and DataMember are alternatives (not that they go together). 
The DataSource points to the class that will deliver the data. If no DataMember is specified the objectDataSource will look for the public constructor.
The DataMember can be a public method or a property (then you don't need the constructor) so what you can do is assign the DataMember to a method/property that returns the created business object.

class MyBizClass
{
   public static MyBussinesObject CreateBizObject()
   {
      //do factory work
      //...
   }
}
//...where you init the report
{
   objectDataSource1.DataSource = typeof(...   
   objectDataSource1.DataMember = "CreateBizObject";
}

All the best,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Yonggu Kang
Top achievements
Rank 1
Iron
answered on 07 Dec 2011, 07:44 AM
Hi, Elian,

Your reply make me  comfortable , and I have to dig Reporting deeper.
Thank you for your kind reply and good work.

Kang


Tags
General Discussions
Asked by
Yonggu Kang
Top achievements
Rank 1
Iron
Answers by
Elian
Telerik team
Yonggu Kang
Top achievements
Rank 1
Iron
Share this question
or