Database initialize class

???? ?? ???? ?????? ????? ???????? ?? ?????? ?????? .

??? ?? ????? ?????? :

 

Repository class implementation

 

?????? ??????? ????? ???? ?????? ??????? ?? ???? ?????????? repository class , ????? ????? ??????? ??? ????? ???????? ??????? LINQ ??? Entity  .

?????? BloodDonorRepository  , ???? ?? ???? ??? ???? ?????? ??  IBloodDonorRepository interface

 

?????? ??????? ?? ?????????? , ??? ?????? LINQ to Entity  ?? ??? ???????? ?? ????? ???????? , ??? ???? ?????? ?????

a blood donor

 

  1. Create object of context class
  2. Use context.entiy.Add(entity)
  3. Use context.SaveChnages()

 

 

???? ?????? ????? ??? ????? ???? ?????????? ????????? ?? ??????? , ????? ??? ??? ????? ??? Build  ??????? , ??????? ?? ????? ????? .

 

Web Project 


??? ???? ?????? ????? MVC  , ???? ????? ??????? ?? ???????? ??????? Core and Interface  , ?? ?????? ??????? ??????? ??? ?????? .

  1. infrastructure project
  2. core project
  3. Entity Framework package

 

??? ????? ?? ??????? , ?? ???? Build ????? ?? ?? ?? ?? ???? .

?? ??????  New Controller  ?? Entity Framework  .??? ?????? ??????  BloodDonorsController  .

????? ????? ?????? ???????? ??????? :

  1. BloodDonor class from the core project as the Model class
  2. BloodDonorContext class as the data context class from the Infrastructure project



Share

Comments