c# Extend an Expression

Viewed 147

I would like to extend an expression (Expression<Func<TModel, TProperty>>):

class CustomModel
{
    public BlobModel Blob { get; set; }

    public class BlobModel
    {
        public string SubBlob { get; set; }
    }
}


var expression = model => model.Blog;
var subBlobExpression = expression.???.SubBlob;

It is possible? The goal is to use the validation in a shared partialview (ASP.NET MVC project).

The htmlAttributes in the ValidationMessageFor method doesn't work and use the model without Expression either!

1 Answers
Related