WebService序列化失败
1.的Auxiliary
namespace Westminster.MOE.Cache.ItemCategory {
[Serializable]
public class Auxiliary : BaseSqlCache4ItemCat<1或者2>
{
public string AuxKey { get; set; }
public string AuxDesc { get; set; }
public string AuxDesc_CN { get; set; }
public string AuxDesc_TW { get; set; }
public int AuxOrder { get; set; }
}
public abstract class BaseSqlCache4ItemCat<T> : BaseSqlCache<T> where T : class, new()
{
...
}
public abstract class BaseSqlCache<T> where T : class, new()
{
private List<T> _CacheData = null;
public List<T> CacheData
{
get
{
if (!string.IsNullOrEmpty(CacheKey))
{
if (Common.MOECache[CacheKey] == null)
{
InitCacheData();
}
return Common.MOECache[CacheKey] as List<T>;
}
return null;
}
}
...
}
}
2.的Auxiliary
namespace Westminster.MOE.Entity.Cache
{
[Serializable]
public class Auxiliary
{
public string AuxKey { get; set; }
public string AuxDesc { get; set; }
public string AuxDesc_CN { get; set; }
public string AuxDesc_TW { get; set; }
public int AuxOrder { get; set; }
public Auxiliary(tbMOE_Auxiliary t)
{
AuxKey = t.AuxKey;
AuxDesc = t.AuxDesc;
AuxDesc_CN = t.AuxDesc_CN;
AuxDesc_TW = t.AuxDesc_TW;
AuxOrder = t.AuxOrder;
}
public Auxiliary() { }
}
}
WebService 的方法:
[WebMethod]
[XmlInclude(typeof(1或者2))]
public Object GetCacheData(MOEEnums.CacheData data)
{
Type type = typeof(MOECache).GetProperty(data.ToString()).PropertyType;
Object o = typeof(MOECache).GetProperty(data.ToString()).GetValue(null, null);
Object dataList = type.GetProperty("CacheData").GetValue(o, null);
return dataList;
}
问题:为什么我用1的时候,就可以序列化成功,但是我用2的时候,为什么就不行呢?
请大家帮帮小弟的忙了。