Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class MyCustomController : BaseController
  2. {
  3. TBTEntities db;
  4.  
  5.  
  6. public ActionResult Abcdef()
  7. {
  8. // burda direk db yi kullansak nasıl olur
  9.  
  10. db.tabloadi.where(.....).....
  11. return View();
  12. }
  13.  
  14. public ActionResult Xyzzzz()
  15. {
  16. // yada using blockları içinde çağırsak
  17. using (var database = new TBTEntities())
  18. {
  19.  
  20. database.tabloadi.where(.....)....
  21. }
  22.  
  23. return View();
  24. }
  25.  
  26.  
  27. public MyCustomController()
  28. {
  29. // burda Entity nesnemi yarattım
  30. db = new TBTEntities();
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement