Comment une seule requête SQL avec un View LINQ to SQL?
-
24-10-2019 - |
Question
Je fais normalement quelque chose comme ça ...
var theDogs = from d in db.Dogs where d.Equals(5) select d;
//LetThemOut(theDogs);
où db est le DataContext et les chiens est une table, mais qu'en est-un View?
Est-ce la même chose?
La solution
Yes, it is the same. You just can't insert/update/delete data in a view.
If you're using the LINQ to SQL designer, just drag the view to the DBML designer.
If you're using a manual mapping, just map the object you are defining to a view, instead of a table.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow