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)
-
0
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>
-
0
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?