using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace WebAPIBase.NetCore.BusinessCore
{
    public class SingleTableClassBuilder : AbstractClassBuilder
    {
        public override EntityData BuildClass(string className)
        {
            try
            {
                EntityData entityData = new EntityData();
                entityData.ClassName = className;
                entityData.MainTableName = className;
                entityData.EntityTypeName = "Single";
                XmlNode xmlRoot = GetXmlRoot(className);
                XmlNode tablenode = xmlRoot.SelectSingleNode("Table");
                entityData.Tables.Add(BuildTable(tablenode));
                return entityData;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
