Estou fazendo um ORM e no meu 'where' and encontrei um problema específico ao utilizar um atributo de um objeto na condição
public zDatabase zWhere<TSource>(Expression<Func<TSource, bool>> expression)
{
string header = expression.Parameters[0].Name;
MemberExpression memberExpr = (MemberExpression)expression.Body;
var WhereString = expression.Body.ToString();
Where = PrepairWhere(WhereString, header);
return this;
}
But if I use like
databaseInstance.zWhere<Midia>(x => x.type == "zip")
The parameter is received like
x => (x.type == "zip")
This is the expected result, but when using as an attribute as the example below ...
databaseInstance.zWhere<Products_Price>(x => x.product_id== product_id)
I get the following code
x => (x.produto_id == value(AERendererFastFood.Model.DAO.Products_Products_PriceDAO+<>c__DisplayClass0_0).product_id)
And, indeed, I'd like to get the value of the expression attribute
Aucun commentaire:
Enregistrer un commentaire