Skip to main content
.NET Framework 4.6.2+

XafApplication.LinkNewObjectToParentImmediately Property

Specifies whether or not a link between a master and child object is created immediately when the NewObjectViewController.NewObjectAction is executed in a nested List View with a non-aggregated collection.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[Browsable(false)]
[DefaultValue(true)]
public bool LinkNewObjectToParentImmediately { get; set; }

Property Value

Type Default Description
Boolean true

true if the link between a master and child object is created when the child object is committed; false if the link is created when the parent is committed.

Remarks

Since v20.2, the default LinkNewObjectToParentImmediately property value is false because the Solution Wizard generates new projects with the FrameworkSettings.DefaultSettingsCompatibilityMode property set to Latest.

The table below shows how the New Action behavior changes in a nested List View with a non-aggregated collection depending on the LinkNewObjectToParentImmediately value.

Value Description
true The new object linked to the master object is created and the master object is committed when the New Action is executed. The reference to the master object is available in the new child object immediately after creation.
false The master object is not committed and the link is not created when the New Action is executed. The reference to the master object is not added to the new child object immediately. The link is created later when the child object is committed. To persist the link, a user should also save the master object. Otherwise, the unlinked child object is saved.

To change the behavior for an entire application, set the LinkNewObjectToParentImmediately property in your application project‘s XafApplication (WinApplication, WebApplication, or BlazorApplication) descendent class constructor.

namespace MySolution.Win {
    public partial class MySolutionWindowsFormsApplication : WinApplication {
        public MySolutionWindowsFormsApplication() {
            // ...
            LinkNewObjectToParentImmediately = true;
        }
        // ...
    }
}

To change the behavior for a specific View, set the NewObjectViewController.LinkNewObjectToParentImmediately property in a Controller that targets the View. The behavior of aggregated collections is not changed.

Note

In Many-to-Many collections, the New Action is hidden when NewObjectViewController.LinkNewObjectToParentImmediately is set to true.

Tip

This property is hidden in the Application Designer. You can use it in code only.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LinkNewObjectToParentImmediately 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.

See Also