Back to Devexpress

XafApplication.ServiceProvider Property

expressappframework-devexpress-dot-expressapp-dot-xafapplication-02acb8ff.md

latest5.2 KB
Original Source

XafApplication.ServiceProvider Property

Provides access to IServiceProvider.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
[Browsable(false)]
public IServiceProvider ServiceProvider { get; set; }
vb
<Browsable(False)>
Public Property ServiceProvider As IServiceProvider

Property Value

TypeDescription
IServiceProvider

An object that implements the IServiceProvider interface.

|

Remarks

Use this property to obtain an instance of IServiceProvider. For more information, see the following topic: Dependency Injection (DI).

Note

To use this property in an XAF Windows Forms application, make sure that your application contains an integrated application builder.

You may find the following examples helpful:

The following code snippets (auto-collected from DevExpress Examples) contain references to the ServiceProvider 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.

xaf-print-a-report-without-displaying-a-preview/CS/EFCore/InstantReportEF/InstantReportEF.Win/Controllers/WinInstantPrintReportController.cs#L12

csharp
protected override void PrintReport(IReportDataV2 reportData) {
    var reportStorage = ReportDataProvider.GetReportStorage(Application.ServiceProvider);
    XtraReport report = reportStorage.LoadReport(reportData);

xaf-how-to-highlight-invalid-properties-when-a-view-is-activated/CS/EFCore/ValidateHighlightEF/ValidateHighlightEF.Module/Controllers/ImmediateValidationController.cs#L55

csharp
if (resultsHighlightController != null) {
    IRuleSet ruleSet = Validator.GetService(Application.ServiceProvider);
    RuleSetValidationResult result = ruleSet.ValidateAllTargets(ObjectSpace, targets, DefaultContexts.Save);

See Also

XafApplication Class

XafApplication Members

DevExpress.ExpressApp Namespace