Basically all I want to do is something like the following:
string EntityFrameworkType = "Product"; string searchField = "ProductName"; string searchValue = "My Product"; using( var context = new entitycontext()) { var result = (from x in context.EntityFrameworkType.Where(l=>l.searchField == searchValue) select x).FirstOrDefault(); }
of course, this syntax will not work because the context does not contain an object called "EntityFrameworkType" ...
Is it possible to do it differently? What I want to do is to generalize my double database validation. In this example, I am looking for any product named "My Product". But I would like to skip on this line, for example, ProductCategory with ProductCategoryId = 1 .... etc.
source share