-
Notifications
You must be signed in to change notification settings - Fork 802
Serenity Service Handlers (Serenity Framework Repository in old versions) overridable methods and calling sequence
Jin edited this page Sep 13, 2023
·
1 revision
MySaveHandler : SaveRequestHandler
Properties:
protected static IEnumerable<ISaveBehavior> cachedBehaviors;
protected IEnumerable<ISaveBehavior> behaviors;
public SaveRequestHandler();
public IDbConnection Connection { get; }
public bool IsCreate { get; }
public bool IsUpdate { get; }
public TRow Old { get; protected set; }
public TSaveRequest Request { get; protected set; }
public TSaveResponse Response { get; protected set; }
public TRow Row { get; protected set; }
public IDictionary<string, object> StateBag { get; }
public IUnitOfWork UnitOfWork { get; protected set; }
public TSaveResponse Process(IUnitOfWork unitOfWork, TSaveRequest request, SaveRequestType requestType = SaveRequestType.Auto);
Calling sequence of the overiddable methods:
- protected override IEnumerable GetBehaviors()
- protected override void ValidateAndClearIdField()
- protected override void LoadOldEntity() // Loads in base.Old the data before modification (also in PrepareQuery))
- protected override SqlQuery PrepareQuery()
- protected override void ValidateRequest()
- protected override void ValidatePermissions()
- protected override HashSet ValidateEditable()
- protected override void GetEditableFields(HashSet editable) // Gets the only editable fields of the entity
- protected override void ValidateEditableFields(HashSet editable)
- protected override void ValidateRequired(HashSet editableFields)
- protected override void ValidateIsActive()
- protected override void ValidateFieldValues()
- protected override void GetRequiredFields(HashSet required, HashSet editable) // Gets the mandatory fields and the editable fields of the entity
- protected override void SetInternalFields()
- protected override void BeforeSave() // Serenity.Services.ISaveRequest.Entity holds the current data
- protected override void ClearNonTableAssignments()
- protected override void ExecuteSave()
- protected override void InvalidateCacheOnCommit()
- protected override void AfterSave()
- protected override void HandleDisplayOrder(bool afterSave)
- protected override void PerformAuditing()
- protected override void OnReturn() // Last called
MyDeleteHandler : DeleteRequestHandler
Properties:
protected static IEnumerable<IDeleteBehavior> cachedBehaviors;
protected IEnumerable<IDeleteBehavior> behaviors;
protected TDeleteRequest Request;
protected TDeleteResponse Response;
protected TRow Row;
public DeleteRequestHandler();
public IDbConnection Connection { get; }
public IDictionary<string, object> StateBag { get; }
public IUnitOfWork UnitOfWork { get; protected set; }
public TDeleteResponse Process(IUnitOfWork unitOfWork, TDeleteRequest request);
Calling sequence of the overiddable methods:
- protected override IEnumerable GetBehaviors()
- protected override void ValidatePermissions()
- protected override void LoadEntity()
- protected override void PrepareQuery(SqlQuery query)
- protected override void ValidateRequest()
- protected override void OnBeforeDelete()
- protected override void ExecuteDelete()
- protected override void InvalidateCacheOnCommit()
- protected override void OnAfterDelete()
- protected override void DoAudit()
- protected override void OnReturn() // Last called
MyRetrieveHandler : RetrieveRequestHandler
Properties:
protected static IEnumerable<IRetrieveBehavior> cachedBehaviors;
protected IEnumerable<IRetrieveBehavior> behaviors;
protected TRetrieveRequest Request;
protected TRetrieveResponse Response;
protected TRow Row;
public RetrieveRequestHandler();
public IDbConnection Connection { get; }
public SqlQuery Query { get; }
public IDictionary<string, object> StateBag { get; }
public TRetrieveResponse Process(IDbConnection connection, TRetrieveRequest request);
Calling sequence of the overiddable methods:
- protected override IEnumerable GetBehaviors()
- protected override void ValidateRequest()
- protected override void ValidatePermissions()
- protected override SqlQuery CreateQuery()
- protected override void PrepareQuery(SqlQuery query)
- protected override void SelectFields(SqlQuery query)
- protected override bool CanSelectField(Field field) // This method is called for each field
- protected override bool ShouldSelectField(Field field) // This method is called for each field
- protected override void SelectField(SqlQuery query, Field field) // This method is called for each field
- protected override void OnBeforeExecuteQuery()
- protected override void OnAfterExecuteQuery()
- protected override void OnReturn() // Last called
MyListHandler : ListRequestHandler
Properties:
protected static IEnumerable<IListBehavior> cachedBehaviors;
protected IEnumerable<IListBehavior> behaviors;
protected TListRequest Request;
protected TListResponse Response;
protected TRow Row;
public ListRequestHandler();
public IDbConnection Connection { get; }
public SqlQuery Query { get; }
public IDictionary<string, object> StateBag { get; }
public TListResponse Process(IDbConnection connection, TListRequest request);
Calling sequence of the overiddable methods:
- protected override IEnumerable GetBehaviors()
- protected override void ValidateRequest()
- protected override void ValidatePermissions()
- protected override SqlQuery CreateQuery()
- protected override void PrepareQuery(SqlQuery query)
- protected override void SelectFields(SqlQuery query)
- protected override bool AllowSelectField(Field field) // This method is called for each field
- protected override bool ShouldSelectField(Field field) // This method is called for each field
- protected override void SelectField(SqlQuery query, Field field) // This method is called for each field
- protected override void ApplyKeyOrder(SqlQuery query)
- protected override void ApplyContainsText(SqlQuery query, string containsText)
- protected override void ApplySort(SqlQuery query)
- protected override void ApplySortBy(SqlQuery query, SortBy sortBy)
- protected override void ApplyFilters(SqlQuery query)
- protected override void ApplyEqualityFilter(SqlQuery query)
- protected override void ApplyCriteria(SqlQuery query)
- protected override void ApplyIncludeDeletedFilter(SqlQuery query)
- protected override void OnBeforeExecuteQuery()
- protected override MyRow ProcessEntity(MyRow row) // Once per record
- protected override void OnAfterExecuteQuery()
- protected override void OnReturn() // Last called
Copyright © Serenity Platform 2017-present. All rights reserved.
Documentation | Serene Template | Live Demo | Premium Support | Issues | Discussions