public GenericSingletonLoader(DbContext context, SoftDeleteConfiguration <TInterface, byte> config, object principalInstance, PropertyInfo propertyInfo, byte levelToLookFor) { var query = context.Entry(principalInstance).Reference(propertyInfo.Name).Query(); FilteredSingleton = query.Provider.CreateQuery <TEntity>(query.Expression).IgnoreQueryFilters() .Where(config.FilterToGetValueCascadeSoftDeletedEntities <TEntity, TInterface>(levelToLookFor)).SingleOrDefault(); }
/// <summary> /// This returns the cascade soft deleted entities of type TEntity that can be reset, i.e. SoftDeleteLevel == 1 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <returns></returns> public IQueryable <TEntity> GetSoftDeletedEntries <TEntity>() where TEntity : class, TInterface { return(_context.Set <TEntity>().IgnoreQueryFilters().Where(_config.FilterToGetValueCascadeSoftDeletedEntities <TEntity, TInterface>((byte)1))); }