问题描述
可以动态生成实体类"吗?有这样的例子吗?
说明:
有一个实体类"TableList",它的属性是动态生成的.应该准确地说,其属性的数量是动态的.
1,提供参数"ColumnCount",根据它指定"TableList属性"的编号.
2,如果"ColumnCount"为"2",则实体类"TableList"具有属性"Column1","Column2".
3,如果"ColumnCount"为"3",则实体类"TableList"具有属性"Column1","Column2","Column3".
4,如果"ColumnCount"为"4",则实体类"TableList"具有属性"Column1","Column2","Column3","Column4".
5,等等.
所以特意:
主要是解决"DataGrid"绑定问题.想要绑定到"DataGrid"的实体集"的列号"可以是动态的.在Silverlight上.
问候
Can generate "entity class" dynamically ? Is there such examples?
Description:
There is a entity class "TableList", it''s properties is dynamic generation. It should be accurate say , the number of its properties is dynamic.
1, Providing parameters "ColumnCount", according to it specified the "TableList properties" number.
2, If "ColumnCount" is "2", then entity class "TableList" there is attribute "Column1", "Column2".
3, If "ColumnCount" is "3", then entity class "TableList" there is attribute "Column1", "Column2","Column3".
4, If "ColumnCount" is "4", then entity class "TableList" there is attribute "Column1", "Column2","Column3","Column4".
5,So on.
So on purpose:
Mainly is to solve the problem of "DataGrid" binding. Wanting the "column number" of "entity set" which binds to "DataGrid" can be dynamic.
这篇关于可以生成“实体类".动态地?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!