Back to Devexpress

XPObjectSource.SetEntityType(Type) Method

xpo-devexpress-dot-xpo-dot-xpobjectsource-dot-setentitytype-x28-system-dot-type-x29.md

latest5.0 KB
Original Source

XPObjectSource.SetEntityType(Type) Method

Gets the XPClassInfo object corresponding to the specified type and assigns this object to the XPObjectSource.EntityType property.

Namespace : DevExpress.Xpo

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
public void SetEntityType(
    Type type
)
vb
Public Sub SetEntityType(
    type As Type
)

Parameters

NameTypeDescription
typeType

The persistent class type.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetEntityType(Type) method.

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.

winforms-reporting-create-report-bound-to-xpobjectsource/CS/Form1.cs#L30

csharp
};
dataSource.SetEntityType(typeof(Products));
return dataSource;

asp-net-core-dashboard-register-data-sources/CS/WebDashboardDataSources/Configuration/XpoDataSourceConfigurator.cs#L10

csharp
xpoDataSource.ConnectionStringName = "NWindConnectionString";
xpoDataSource.SetEntityType(typeof(Category));
storage.RegisterDataSource("xpoDataSource", xpoDataSource.SaveToXml());

asp-net-web-forms-dashboard-register-data-sources/CS/WebFormsDashboardDataSources/Pages/XpoDashboard.aspx.cs#L20

csharp
xpoDataSource.ConnectionStringName = "NWindConnectionStringSQLite";
xpoDataSource.SetEntityType(typeof(Category));
dataSourceStorage.RegisterDataSource("xpoDataSource", xpoDataSource.SaveToXml());

asp-net-mvc-dashboard-register-data-sources/CS/MvcDashboardDataSources/Configuration/XpoDataSourceConfigurator.cs#L10

csharp
xpoDataSource.ConnectionStringName = "NWindConnectionStringSQLite";
xpoDataSource.SetEntityType(typeof(Category));
storage.RegisterDataSource("xpoDataSource", xpoDataSource.SaveToXml());

winforms-reporting-create-report-bound-to-xpobjectsource/VB/Form1.vb#L29

vb
Dim dataSource As New XPObjectSource() With {.ConnectionStringName = "nwind"}
dataSource.SetEntityType(GetType(Products))
Return dataSource

asp-net-web-forms-dashboard-register-data-sources/VB/WebFormsDashboardDataSources/Pages/XpoDashboard.aspx.vb#L20

vb
xpoDataSource.ConnectionStringName = "NWindConnectionStringSQLite"
xpoDataSource.SetEntityType(GetType(Category))
dataSourceStorage.RegisterDataSource("xpoDataSource", xpoDataSource.SaveToXml())

asp-net-mvc-dashboard-register-data-sources/VB/MvcDashboardDataSources/Configuration/XpoDataSourceConfigurator.vb#L10

vb
xpoDataSource.ConnectionStringName = "NWindConnectionStringSQLite"
xpoDataSource.SetEntityType(GetType(Category))
storage.RegisterDataSource("xpoDataSource", xpoDataSource.SaveToXml())

See Also

XPObjectSource Class

XPObjectSource Members

DevExpress.Xpo Namespace