Base solution for your next web application
Open Closed

Is it possible to extend ABP? #1563


User avatar
0
sayram created

SoftDelete pattern is good. In normal query sofdeleted record doesnt fetch. What about the Published and UnPublished records?

I need something like this.

public enum ContentState
    {
        Published = 1,
        UnPublished = 0
    }

In normal query unpublished records has not to be fetched also. Do i have to modify core or can i extend the ABP?


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do that by defining a custom filter. Please check this documentation <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Data-Filters#DocDefineCustomFilters">http://www.aspnetboilerplate.com/Pages/ ... tomFilters</a>

  • User Avatar
    0
    sayram created

    Last step is registering the filter in PreInitialize method of module (i did it in Core Module). And i set it true to fetch only Published = true entries.

    First parameter is same unique name we defined before. Second parameter indicates whether this filter is enabled or disabled by default. After declaring such a parametric filter, we can use it by supplying it's value on runtime .

    Configuration.UnitOfWork.RegisterFilter("PublishedFilter", true);

    That true parameter means: only published entries will be fetch, right?