neSHa
neSHa
CC#
Created by neSHa on 6/30/2024 in #help
Dictionary translation
Thats what i need to extract from this
8 replies
CC#
Created by neSHa on 6/30/2024 in #help
Dictionary translation
Original word, pronaunce, translation
8 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
thats it for next month, im not doing something like this agian
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
so i guess i did it
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
i know i need to manipulate expression
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
if you are intrested in solution: public class ExpressionManipulator { public Expression<Func<T, bool>> ConvertToTExpression(Expression<Func<TDto, bool>> sourceExpression) { var parameter = Expression.Parameter(typeof(T), sourceExpression.Parameters[0].Name); var body = new TExpressionVisitor(parameter).Visit(sourceExpression.Body); var TExpression= Expression.Lambda<Func<T, bool>>(body, parameter); return TExpression; } private class TExpressionVisitor : ExpressionVisitor { private readonly ParameterExpression _parameterExpression; public TExpressionVisitor(ParameterExpression parameterExpression) { _parameterExpression = parameterExpression; } protected override Expression VisitParameter(ParameterExpression node) { return _parameterExpression; } protected override Expression VisitMember(MemberExpression node) { if (node.Member.DeclaringType == typeof(TDto)) { var memberName = node.Member.Name; var targetMember = typeof(T).GetProperty(memberName); if (targetMember != null) { return Expression.MakeMemberAccess(_parameterExpression, targetMember); } } return base.VisitMember(node); } } }
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
the more i look around the more i found out
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
Thanks, i guss thats the best way to learn something
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
but need the expressions to
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
i mapped that way back
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
who knows, i guess it will be never forgoten bettle
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
thats just one of parameters
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
If i can manipulate expression to go from T to Tdto
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
I think i need to know how to manipulate expressions
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
and in repository i just .Where(the_expression) // here it's a collection of TDto .ToListAsync();\
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
hanlder prepare the expresion bla bla
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
lets look that this way
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
Wdym by that
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
i cant just change rep to get Expression<Func<TDto,bool>>
67 replies
CC#
Created by neSHa on 7/17/2023 in #help
✅ AutoMapper and Expression
and mt rep need Expression<Func<T,bool>>
67 replies