MasterDetailRelationBehavior class
namespace: Serenity.Services assembly: Serenity.Net.Services
Behavior class that handles MasterDetailRelationAttribute.
public class MasterDetailRelationBehavior : BaseSaveDeleteBehaviorAsync, IDeleteBehaviorSync,
IFieldBehavior, IImplicitBehavior, IListBehaviorAsync, IListBehaviorSync,
IRetrieveBehaviorAsync, IRetrieveBehaviorSync, ISaveBehaviorSync
| parameter | description |
|---|---|
| handlerFactory | Default handler factory |
Public Members
| name | description |
|---|---|
| MasterDetailRelationBehavior(…) | Behavior class that handles MasterDetailRelationAttribute. |
| Target { get; set; } | |
| ActivateFor(…) | |
| virtual OnAfterSave(…) | |
| override OnAfterSaveAsync(…) | |
| virtual OnBeforeDelete(…) | |
| override OnBeforeDeleteAsync(…) | |
| virtual OnReturn(…) | (2 methods) |
| virtual OnReturnAsync(…) | (2 methods) |
Exceptions
| exception | condition |
|---|---|
| ArgumentNullException | handlerFactory is null. |
Remarks
Initializes a new instance of the class.
Saving or deleting a master invokes the nested save/delete handler once per detail row (an N+1 pattern). This is intentional, so the full handler pipeline (behaviors, audit, concurrency version checks, unique constraints, cascades and cache invalidation) applies to every detail row. Batching these into a single statement would bypass that pipeline and change the semantics, so it is not done. Callers with very large detail sets should be aware of the resulting number of round trips.
See Also
- class BaseSaveDeleteBehaviorAsync
- interface IDeleteBehaviorSync
- interface IFieldBehavior
- interface IImplicitBehavior
- interface IListBehaviorAsync
- interface IListBehaviorSync
- interface IRetrieveBehaviorAsync
- interface IRetrieveBehaviorSync
- interface ISaveBehaviorSync
- Source: MasterDetailRelationBehavior.cs