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

No parameterless constructor defined for this object

1 Answer 152 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ahmet
Top achievements
Rank 1
Ahmet asked on 27 Jun 2016, 09:47 AM

Hi,

 

ObjectDataSource business.Component not connection 

 

Error !

No parameterless constructor defined for this object

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 27 Jun 2016, 03:20 PM
Hello Ahmet,

In general, the purpose of the ObjectDataSource component is to provide data to the report in a declarative manner. The ObjectDataSource.DataSource should be the assembly qualified name or Type of the data access layer (class), where the reporting engine will use System.Reflection to create the instance of the class (by using its default constructor) and to execute its method specified by the ObjectDataSource.DataMember.

Having the above into account, the data access layer must have a default parameterless constructor in order to be instantiated.


In case it is a data model created via Entity Framework, please consider switching to the EntityDataSource component.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Greg Spaulding
Top achievements
Rank 1
commented on 13 Jan 2022, 10:18 PM

Dependancy Injection like with Autofac kinda throws a monkey wrench into this.
Neli
Telerik team
commented on 18 Jan 2022, 01:49 PM

Hi Greg,

The Reporting engine uses System.Reflection to invoke the data retrieving functionality described in the ObjectDataSource. The latter accepts parameters: Using Parameters with the ObjectDataSource Component and in some cases, it may be possible to use dependency injection. For example, if the injected values are primitive and can be passed as Report Parameter values. Note that if the DataMember is not provided, the DataSource constructor will be used and the parameters will be passed to this constructor.

Tags
General Discussions
Asked by
Ahmet
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or