在下面的代码中,我尝试将 添加AttributeValueInfoEntity
到AttributeValueExportList
,但是它没有ArticleAttributeExportLarge
在我放入//largeExportList.AttributeExportList
代码的位置显示为对象的属性。
我做错了什么,还是我错过了 C# 中的重要嵌套规则?
public partial class Export_Articles_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ArticleInfoEntity[] articleInfoList = ArticleInfoFactory.Instance.ListInfo(244);
List<ArticleExportLarge> list = new List<ArticleExportLarge>();
foreach (ArticleInfoEntity aie in articleInfoList)
{
ArticleExportLarge largeExportList = new ArticleExportLarge(aie);
largeExportList.AttributeExportList = new List<ArticleAttributeExportLarge>();
List<AttributeInfoEntity> attributeInfoList = AttributeInfoFactory.Instance.ListByArticle(aie.ArticleId);
foreach (AttributeInfoEntity attributeInfo in attributeInfoList)
{
largeExportList.AttributeExportList.Add(new ArticleAttributeExportLarge(attributeInfo));
List<AttributeValueInfoEntity> ArticleValueInfoList = AttributeValueInfoFactory.Instance.ListByArticleAndAttribute(aie.ArticleId, attributeInfo.AttributeId);
foreach (AttributeValueInfoEntity avie in ArticleValueInfoList)
{
//largeExportList.AttributeExportList
}
}
list.Add(largeExportList);
}
}
}
public class ArticleExportLarge
{
private ArticleInfoEntity articleInfo;
private List<ArticleAttributeExportLarge> attributeExportList;
public ArticleExportLarge(ArticleInfoEntity articleInfo)
{
this.articleInfo = articleInfo;
}
[XmlElement(ElementName = "attributeList")]
public List<ArticleAttributeExportLarge> AttributeExportList
{
get { return attributeExportList; }
set { attributeExportList = value; }
}
}
public class ArticleAttributeExportLarge
{
private AttributeInfoEntity attributeInfo;
private List<ArticleAttributeValueExportLarge> attributeValueExportList;
public ArticleAttributeExportLarge(AttributeInfoEntity attributeInfo)
{
this.attributeInfo = attributeInfo;
}
[XmlElement(ElementName = "attributeValueList")]
public List<ArticleAttributeValueExportLarge> AttributeValueExportList
{
get { return attributeValueExportList; }
set { attributeValueExportList = value; }
}
}
public class ArticleAttributeValueExportLarge
{
private AttributeValueInfoEntity attributeValueExportEntity;
public AttributeValueInfoEntity AttributeValueExportEntity
{
get { return attributeValueExportEntity; }
set { this.attributeValueExportEntity = value; }
}
}