corelibraries-devexpress-dot-dataaccess-dot-objectbinding-dot-objectdatasource-e3da53e5.md
Specifies an object that enables an ObjectDataSource to access constructor parameters.
Namespace : DevExpress.DataAccess.ObjectBinding
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
[DefaultValue(null)]
public ObjectConstructorInfo Constructor { get; set; }
<DefaultValue(Nothing)>
Public Property Constructor As ObjectConstructorInfo
| Type | Default | Description |
|---|---|---|
| ObjectConstructorInfo | null |
An ObjectConstructorInfo value.
|
If it is required that on calling the ObjectDataSource.Fill method, an ObjectDataSource should create an instance of the type specified by its ObjectDataSource.DataSource property, use the Constructor property to specify the required constructor parameters. To assign a constructor without parameters, use the static ObjectConstructorInfo.Default object.
Set this property to null for the ObjectDataSource to never try to create an object instance (if you need to manually create and assign it, or when binding to a static member).
The following code snippets (auto-collected from DevExpress Examples) contain references to the Constructor property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
data-access-library-create-data-sources-at-runtime/CS/ObjectDataSourceSnippets/Code.cs#L22
var parameter = new DevExpress.DataAccess.ObjectBinding.Parameter("p1", typeof(int), 3);
objds.Constructor = new DevExpress.DataAccess.ObjectBinding.ObjectConstructorInfo(parameter);
}
reporting-web-forms-report-designer-add-data-sources/CS/WebApplication1/Default.aspx.cs#L88
objds.DataSource = typeof(ItemList);
objds.Constructor = new DevExpress.DataAccess.ObjectBinding.ObjectConstructorInfo();
objds.EndInit();
reporting-winforms-parameter-dynamic-list/CS/Form1.cs#L23
objectDataSource.DataMember = "GetEmployeeList";
objectDataSource.Constructor = new ObjectConstructorInfo();
objectDataSource.Fill();
objds.Constructor = new DevExpress.DataAccess.ObjectBinding.ObjectConstructorInfo(p);
return objds;
data-access-library-create-data-sources-at-runtime/VB/ObjectDataSourceSnippets/Code.vb#L19
Dim parameter = New DevExpress.DataAccess.ObjectBinding.Parameter("p1", GetType(Integer), 3)
objds.Constructor = New DevExpress.DataAccess.ObjectBinding.ObjectConstructorInfo(parameter)
End Sub
reporting-web-forms-report-designer-add-data-sources/VB/WebApplication1/Default.aspx.vb#L79
objds.DataSource = GetType(ItemList)
objds.Constructor = New DevExpress.DataAccess.ObjectBinding.ObjectConstructorInfo()
objds.EndInit()
reporting-winforms-parameter-dynamic-list/VB/Form1.vb#L22
objectDataSource.DataMember = "GetEmployeeList"
objectDataSource.Constructor = New ObjectConstructorInfo()
objectDataSource.Fill()
objds.Constructor = New DevExpress.DataAccess.ObjectBinding.ObjectConstructorInfo(p)
Return objds
See Also