Am I missing something? (using version 1.2)
Code:
/* ... snip ... */
public abstract class AgentRow
{
/* ... begin ... */
[ComponentProperty(ComponentType=typeof(DenormalizedList<string>), PropertyName="Languages")]
[Property(1, Name="Item1")]
[Column(2, Name="Languages1", SqlType="char", Length=3, NotNull=false)]
[Property(3, Name="Item2")]
[Column(4, Name="Languages2", SqlType="char", Length=3, NotNull=false)]
[Property(5, Name="Item3")]
[Column(6, Name="Languages3", SqlType="char", Length=3, NotNull=false)]
[Property(7, Name="Item4")]
[Column(8, Name="Languages4", SqlType="char", Length=3, NotNull=false)]
[Property(9, Name="Item5")]
[Column(10, Name="Languages5", SqlType="char", Length=3, NotNull=false)]
public virtual DenormalizedList<string> Languages
{
get { return _languages; }
protected set { _languages = value; }
}
/* ... end ... */
}
/* ... snip ... */
[Serializable]
[Component]
public class DenormalizedList<T> : List<T>
{
public DenormalizedList() : base(5) { }
private void __add(T item)
{
if (item != null) Add(item);
}
private T __get(int index)
{
if (index > 0 && index < Count)
return this[index];
return default(T);
}
protected virtual T Item1 { set { __add(value); } get { return __get(0); } }
protected virtual T Item2 { set { __add(value); } get { return __get(1); } }
protected virtual T Item3 { set { __add(value); } get { return __get(2); } }
protected virtual T Item4 { set { __add(value); } get { return __get(3); } }
protected virtual T Item5 { set { __add(value); } get { return __get(4); } }
}
/* ... snip ... */
... Is generating invalid xml.... the workaround I came up with was...
Code:
/* ... snip ... */
public abstract class AgentRow
{
/* ... snip ... */
[RawXml(After=typeof(PropertyAttribute), Content=@"
<component name=""Languages"" class=""DenormalizedList`1[[System.String, mscorlib]]"">
<property name=""Item1"">
<column name=""Languages1"" length=""3"" not-null=""false"" sql-type=""char"" />
</property>
<property name=""Item2"">
<column name=""Languages2"" length=""3"" not-null=""false"" sql-type=""char"" />
</property>
<property name=""Item3"">
<column name=""Languages3"" length=""3"" not-null=""false"" sql-type=""char"" />
</property>
<property name=""Item4"">
<column name=""Languages4"" length=""3"" not-null=""false"" sql-type=""char"" />
</property>
<property name=""Item5"">
<column name=""Languages5"" length=""3"" not-null=""false"" sql-type=""char"" />
</property>
</component>
")]
public virtual DenormalizedList<string> Languages
{
get { return _languages; }
protected set { _languages = value; }
}
/* ... snip ... */
}
/* ... snip ... */
[Serializable]
[Component]
public class DenormalizedList<T> : List<T>
{
public DenormalizedList() : base(5) { }
private void __add(T item)
{
if (item != null) Add(item);
}
private T __get(int index)
{
if (index > 0 && index < Count)
return this[index];
return default(T);
}
protected virtual T Item1 { set { __add(value); } get { return __get(0); } }
protected virtual T Item2 { set { __add(value); } get { return __get(1); } }
protected virtual T Item3 { set { __add(value); } get { return __get(2); } }
protected virtual T Item4 { set { __add(value); } get { return __get(3); } }
protected virtual T Item5 { set { __add(value); } get { return __get(4); } }
}
/* ... snip ... */