我不得不在Visual Studio项目中创建DAC扩展而不是DAC类进行自定义,因为我必须为少数字段定义下拉值,如果我直接从自定义扩展DAC,我就无法创建它 .
以下是来自Visual Studio项目的带有下拉字段及其值的DAC扩展代码 -
public class SOOrderExtension : PXCacheExtension
{
#region Class DropDownValue
public static class DropDownValue
{
public const string Value1 = "1";
public const string Value2 = "2";
public const string Value3 = "3";
}
#endregion
#region UsrDropDown
[PXDBString(1)]
[PXUIField(DisplayName = "My DropDown")]
[PXStringList(new string[]
{
DropDownValue.Value1, DropDownValue.Value2, DropDownValue.Value3
},
new string[]
{
"One", "Two", "Three"
})]
public virtual string UsrDropDown { get; set; }
public abstract class usrDropDown : IBqlField { }
#endregion
}
这工作正常,它已在SOOrder现有表中创建了新的用户定义字段 . 但是,如果我在此DAC扩展类中添加任何新字段,它不会在SOOrder表中创建新字段,只是在我发布自定义时跳过 . 因此,我需要在自定义中添加一个SQL脚本,以将这些新字段添加到SOOrder表中 .
我不确定这是否是正确的方法 . 理想情况下,如果我在Visual Studio中的DAC扩展中添加新字段,它应该在SOOrder表中创建新字段,就像我将DAC扩展中的新字段直接添加到自定义中一样 .