Tuesday, January 23, 2024

How to save List of object to database with XML

 public void SaveAllActSectionDetailsList(long referenceId, long referenceType, List<ActSectionDetailsDTO> actSectionDetailsList)

        {

            actSectionDetailsList.ForEach(t => { t.ReferenceId = referenceId; t.ReferenceType= referenceType; });

            using (var actSectionDetailsClient = ServiceClient<IActSectionDetailsManager>.Create(ObjectConstants.ActSectionDetailsManager))

            {

                actSectionDetailsClient.Instance.InsertUpdateActSectionDetailsList(new ActSectionDetailsDTO { ActSectionDetailsList = actSectionDetailsList });

            }

        }


---------------  Entity ------------------


Initializes a new instance of the <see cref="ActSectionDetailsDTO"/> class.

        /// </summary>

        public ActSectionDetailsDTO()

        {

            ActSectionDetailsList = new List<ActSectionDetailsDTO>();

        }


        /// <summary>

        /// Gets or sets the act section details list.

        /// </summary>

        /// <value>The act section details list.</value>

        [XmlElement(ElementName = "ActSectionDetailsList")]

        public List<ActSectionDetailsDTO> ActSectionDetailsList { get; set; }


No comments:

Post a Comment