示例#1
0
 /// <summary>
 /// This returns a where filter that returns all the valid entities that have been single soft deleted
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <typeparam name="TInterface"></typeparam>
 /// <param name="config"></param>
 /// <returns></returns>
 public static Expression <Func <TEntity, bool> > FilterToGetValueSingleSoftDeletedEntities <TEntity, TInterface>(
     this SingleSoftDeleteConfiguration <TInterface> config)
     where TInterface : class
     where TEntity : TInterface
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     return(FilterToGetSoftDeletedEntities <TEntity, TInterface, bool>(config.GetSoftDeleteValue, config.OtherFilters, true));
 }
示例#2
0
        /// <summary>
        /// Ctor for SoftDeleteService
        /// </summary>
        /// <param name="config"></param>
        public SingleSoftDeleteServiceAsync(SingleSoftDeleteConfiguration <TInterface> config)
        {
            _config  = config ?? throw new ArgumentNullException(nameof(config));
            _context = config.Context ?? throw new ArgumentNullException(nameof(config), "You must provide the DbContext");

            if (_config.GetSoftDeleteValue == null)
            {
                throw new InvalidOperationException($"You must set the {nameof(_config.GetSoftDeleteValue)} with a query to get the soft delete bool");
            }
            if (_config.SetSoftDeleteValue == null)
            {
                throw new InvalidOperationException($"You must set the {nameof(_config.SetSoftDeleteValue)} with a function to set the value of the soft delete bool");
            }
        }