Posted By

qrist0ph on 05/20/09


Tagged

EF


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Entity Framework Hello World


 / Published in: C#
 

  1. //PVPims_TAFEntities erbt von System.Data.Objects.ObjectContext
  2. PVPims_TAFEntities pvpimpsContext = new PVPims_TAFEntities();
  3. //C231_Grafiken_Dokumente erbt von System.Data.Objects.DataClasses.EntityObject
  4. ObjectQuery<C231_Grafiken_Dokumente> c231 = pvpimpsContext.C231_Grafiken_Dokumente.Top("4");
  5. // Change sth. UI is updated automatically
  6. c231.First().BezNr = 666;
  7. // Undo changes
  8. pvpimpsContext.Refresh(RefreshMode.StoreWins,c231.First());
  9.  
  10.  
  11. PV.Pims.Data.Article.Entities context = new PV.Pims.Data.Article.DocumentEntities();
  12. IQueryable<C231_Grafiken_Dokumente> c231 = context.C231_Grafiken_Dokumente
  13. .Include("BildNrRef.DokumentInformation")
  14. .Where(x => x.BildNr == 300200);
  15.  
  16. IQueryable<C231_Grafiken_Dokumente> c231 = (from item in context.C231_Grafiken_Dokumente
  17. .Include("BildNrRef.DokumentInformation")
  18. .Include("BildNrRef.C232_Zuordnung_der_Bilder_zu_Artikelnummern")
  19. where item.BildNr == 300200
  20. select item);

Report this snippet  

You need to login to post a comment.