Back to Devexpress

ModuleBase.CustomizeLogics(CustomLogics) Method

expressappframework-devexpress-dot-expressapp-dot-modulebase-dot-customizelogics-x28-devexpress-dot-expressapp-dot-dc-dot-customlogics-x29.md

latest4.5 KB
Original Source

ModuleBase.CustomizeLogics(CustomLogics) Method

Allows you to override domain logic classes registered for Application Model interfaces.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public virtual void CustomizeLogics(
    CustomLogics customLogics
)
vb
Public Overridable Sub CustomizeLogics(
    customLogics As CustomLogics
)

Parameters

NameTypeDescription
customLogicsCustomLogics

A CustomLogics object exposing methods to manage domain logic classes registered for Application Model interfaces.

|

Remarks

This method allows you to replace the default domain logic implementations used for the Application Model interfaces with custom ones. For this purpose, a CustomLogics object exposed by the customLogics parameter supplies the CustomLogics.RegisterLogic and CustomLogics.UnregisterLogic methods. The following code snippet illustrates their use. The IModelDetailView interface’s ModelDetailViewDomainLogic is replaced by a custom MyLogic domain logic class. The custom logic class changes the default value of the IModelView.AllowEdit property for all the Detail Views to false.

csharp
using DevExpress.ExpressApp.DC;
using DevExpress.ExpressApp.DC.Xpo;
using DevExpress.ExpressApp.Model;
using DevExpress.ExpressApp.Model.DomainLogics;
//...
public sealed partial class MyModule : ModuleBase {
    //...
    public override void CustomizeLogics(CustomLogics customLogics) {
        base.CustomizeLogics(customLogics);
        customLogics.UnregisterLogic(typeof(IModelDetailView), typeof(ModelDetailViewDomainLogic));
        customLogics.RegisterLogic(typeof(IModelDetailView), typeof(MyLogic));        
    }
}
[DomainLogic(typeof(IModelDetailView))]
public static class MyLogic {
    public static bool Get_AllowEdit(IModelDetailView modelView) {
        return false;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomizeLogics(CustomLogics) 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-implement-a-custom-attribute-to-customize-the-application-model/CS/CustomAttributeSolution/CustomAttributeSolution.Module/Module.cs#L45

csharp
public override void CustomizeLogics(CustomLogics customLogics) {
    base.CustomizeLogics(customLogics);
    customLogics.RegisterLogic(typeof(IRemovedFromViewModel), typeof(RemovedFromViewInfoLogic));

See Also

How the XAF Application Model Works

ModuleBase Class

ModuleBase Members

DevExpress.ExpressApp Namespace