Back to Devexpress

XafApplication.CreateObjectSpace<T>() Method

expressappframework-devexpress-dot-expressapp-dot-xafapplication-dot-createobjectspace-1.md

latest4.9 KB
Original Source

XafApplication.CreateObjectSpace<T>() Method

Creates an Object Space of the specified type.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public IObjectSpace CreateObjectSpace<T>()
vb
Public Function CreateObjectSpace(Of T) As IObjectSpace

Type Parameters

NameDescription
T

Object type.

|

Returns

TypeDescription
IObjectSpace

An IObjectSpace object.

|

Remarks

For more information about creating an Object Space of the specified type, refer to the following topic: CreateObjectSpace(Type).

The following code demonstrates how to implement a PopupWindowShowAction to create a new Note object:

csharp
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using YourSolutionName.Module.BusinessObjects;

namespace YourSolutionName.Blazor.Server.Controllers;
public class ShowNotesController : WindowController {
    public ShowNotesController() {
        PopupWindowShowAction showNotesAction = new PopupWindowShowAction(this, "ShowNotes", PredefinedCategory.Edit);
        showNotesAction.CustomizePopupWindowParams += ShowNotesAction_CustomizePopupWindowParams;
    }
    private void ShowNotesAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) {
        IObjectSpace objectSpace = Application.CreateObjectSpace<Note>();
        var note = objectSpace.CreateObject<Note>();
        e.View = Application.CreateDetailView(objectSpace, note);
    }
}

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

XAF_how-to-show-filter-dialog-before-listview/CS/EFCore/DialogBeforeListViewEF/DialogBeforeListViewEF.Module/Controllers/ShowFilterDialogController.cs#L33

csharp
protected void ShowFilterDialog() {
    NonPersistentObjectSpace nonPersistentObjectSpace = (NonPersistentObjectSpace)Application.CreateObjectSpace<ViewFilterContainer>();
    IObjectSpace persistentObjectSpace = Application.CreateObjectSpace<ViewFilterObject>();

xaf-how-to-display-a-list-of-non-persistent-objects/CS/EFCore/NonPersistentListViewEF/NonPersistentListViewEF.Module/Controllers/ShowDuplicateBooksController.cs#L14

csharp
var duplicatesDictionary = GetDuplicatesDictionary();
var nonPersistentObjectSpace = Application.CreateObjectSpace<DuplicatesList>();
var duplicatesList = CreateDuplicatesList(duplicatesDictionary, nonPersistentObjectSpace);

XAF_logon-form-manage-users-register-a-new-user-restore-a-password/CS/Security.Extensions/Module.cs#L45

csharp
restorePasswordLogonAction.CustomizePopupWindowParams += (s, e) => {
    var objectSpace = Application.CreateObjectSpace<SetNewPasswordParameters>();
    var newPasswordParameters = objectSpace.CreateObject<SetNewPasswordParameters>();

See Also

XafApplication Class

XafApplication Members

DevExpress.ExpressApp Namespace