var countries = _blogRepository.GetAll().Include(c=> c.BlogPorts);
Problem: .Include(c=> c.BlogPorts) returning deleted (SoftDelete IsDeleted = 1) BlogPorts data also.
I use zero core 4.2
8 Answer(s)
-
0
hi,
In Core version you need to manually handle soft delete filter on child entities. So what you have to do is filtering BlogPorts in where condition.
-
0
Hi, I don't quite understand. Can you give me an example?
-
0
<cite>alper: </cite> hi,
In Core version you need to manually handle soft delete filter on child entities. So what you have to filter BlogPorts in a new where condition.
Hi, alper
I don't quite understand. Can you give me an example?
thanks.
-
0
var countries = _blogRepository.GetAll().Include(c=> c.BlogPorts.Where(p=> !p.IsDeleted));
-
0
<cite>alper: </cite> var countries = _blogRepository.GetAll().Include(c=> c.BlogPorts.Where(p=> !p.IsDeleted));
Hi, alper I have an exception.
Mvc.ExceptionHandling.AbpExceptionFilter - The property expression 'e => {from BlogPortss in [e].BlogPorts where Not([p].IsDeleted) select [p]}' is not valid. The expression should represent a property access: 't => t.MyProperty'. For more information on including related data, see <a class="postlink" href="http://go.microsoft.com/fwlink/?LinkID=746393">http://go.microsoft.com/fwlink/?LinkID=746393</a>. System.InvalidOperationException: The property expression 'e => {from BlogPorts s in [e].BlogPorts where Not([p].IsDeleted) select [p]}' is not valid. The expression should represent a property access: 't => t.MyProperty'. For more information on including related data, see <a class="postlink" href="http://go.microsoft.com/fwlink/?LinkID=746393">http://go.microsoft.com/fwlink/?LinkID=746393</a>. 在 Microsoft.EntityFrameworkCore.Query.ResultOperators.Internal.IncludeExpressionNode.CreateResultOperator(ClauseGenerationContext clauseGenerationContext) 在 Remotion.Linq.Parsing.Structure.IntermediateModel.ResultOperatorExpressionNodeBase.ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) 在 Remotion.Linq.Parsing.Structure.IntermediateModel.MethodCallExpressionNodeBase.Apply(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) 在 Remotion.Linq.Parsing.Structure.QueryParser.ApplyAllNodes(IExpressionNode node, ClauseGenerationContext clauseGenerationContext) 在 Remotion.Linq.Parsing.Structure.QueryParser.ApplyAllNodes(IExpressionNode node, ClauseGenerationContext clauseGenerationContext) 在 Remotion.Linq.Parsing.Structure.QueryParser.GetParsedQuery(Expression expressionTreeRoot) 在 Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, INodeTypeProvider nodeTypeProvider, IDatabase database, ILogger logger, Type contextType) 在 Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass19_0
1.<CompileQuery>b__0() 在 Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func
1 compiler) 在 Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func1 compiler) 在 Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQuery[TResult](Expression query) 在 Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) 在 Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) 在 Remotion.Linq.QueryableBase
1.GetEnumerator() 在 System.Collections.Generic.List1..ctor(IEnumerable
1 collection) 在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) -
0
Hi @Jaylan,
For now, you can join _blogRepository.GetAll() and _blogPortsRepository.GetAll() using Linq query syntax. With EF Core 2.0, this problem will be solved I think.
Thanks.
-
0
<cite>ismcagdas: </cite> Hi @Jaylan,
For now, you can join _blogRepository.GetAll() and _blogPortsRepository.GetAll() using Linq query syntax. With EF Core 2.0, this problem will be solved I think.
Thanks.
Thanks.
-
0
thanks for your feedback