Esempio n. 1
0
 private static void PersistChildren(Show show, SqlConnection conn)
 {
     foreach (var showGenre in show.ShowGenres)
     {
         showGenre.ShowId = show.Id;
         ShowGenreHelper.Persist(showGenre, conn);
     }
     foreach (var credit in show.Credits)
     {
         credit.ShowId = show.Id;
         CreditHelper.Persist(credit, conn);
     }
 }
Esempio n. 2
0
 private static void PersistChildren(Person Person, SqlConnection conn)
 {
     foreach (var credit in Person.Credits)
     {
         credit.PersonId = Person.Id;
         CreditHelper.Persist(credit, conn);
     }
     foreach (var attachment in Person.PersonAttachments)
     {
         attachment.PersonId = Person.Id;
         PersonAttachmentHelper.Persist(attachment, conn);
     }
 }
Esempio n. 3
0
        internal static void DeleteEntity(Person item, SqlConnection conn)
        {
            // Cascade delete Credits
            foreach (var credit in item.Credits)
            {
                CreditHelper.DeleteEntity(credit, conn);
            }

            using (SqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = "delete Person where Id = @Id";
                cmd.Parameters.AddWithValue("@Id", item.Id);
                cmd.ExecuteNonQuery();
            }
        }