none
One To Many Relation in Entities and DB Delete Operation

    Question

  •    I have Table  "A"  and Refercing Table "B" and "C".... "A" have One to Many Relation with "B" And "C".... Casecade in On...

    I want if A have Data in B and C  then i perform Delete Operation on A record the not allow me to Delete Record other wise allow me to delete it...

    i am using EF6 ....

    how i can Check B C having records..? if tables exceed to 100, suppose B C D E F ...etc
    Monday, January 13, 2014 4:08 PM

Answers

  • Hello,

    >> i perform Delete Operation on A record the not allow me to Delete Record other wise allow me to delete it...

    Do not quite understand what this mean? Could you please state this more clearly?

    >> how i can Check B C having records..? if tables exceed to 100, suppose B C D E F ...etc

    For checking count, we can use codes as below:

    int count = db.Orders.Count();

    This will not load data to local and just return the row count of the specified table.

    If I misunderstand, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, January 14, 2014 9:02 AM