Say I have this class:
public class MyObject
{
public string Name { get;set;}
}
When making db calls to see if there's any items with a name, I do this:
public List<MyObject> ListObjectsByName(string _myObject)
{
var objectQry = from object in db.MyObject
where object.Name == _myObject
select object;
if(!objectQry.Any())
{
return null;
}
return objectQry.ToList();
}
I would like to block any harmful attempt to my database by parsing the _myObject
string, so that if a clown tries to get all *DELETE
MyObjects, my app won't crash. I'm using MVC 4. Is there any way to do that?