本文整理汇总了C#中FormInfo.RemoveFields方法的典型用法代码示例。如果您正苦于以下问题:C# FormInfo.RemoveFields方法的具体用法?C# FormInfo.RemoveFields怎么用?C# FormInfo.RemoveFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormInfo
的用法示例。
在下文中一共展示了FormInfo.RemoveFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyCustomFields
/// <summary>
/// Copies custom fields from old version of form definition to the new form definition.
/// </summary>
/// <param name="oldVersionFi">Old version form definition</param>
/// <param name="newVersionFi">New version form definition</param>
/// <param name="overwrite">Indicates whether existing fields should be overwritten. Alternative form fields need to be overwritten due to the combination with upgraded class form.</param>
private static void CopyCustomFields(FormInfo oldVersionFi, FormInfo newVersionFi, bool overwrite)
{
// Remove all system fields from old definition to get only custom fields
oldVersionFi.RemoveFields(f => f.System);
// Combine forms so that custom fields from old definition are appended to the new definition
newVersionFi.CombineWithForm(oldVersionFi, new CombineWithFormSettings
{
IncludeCategories = false,
RemoveEmptyCategories = true,
OverwriteExisting = overwrite
});
}
示例2: CopyCustomFields
/// <summary>
/// Copies custom fields from old version of form definition to the new form definition.
/// </summary>
/// <param name="oldVersionFi">Old version form definition</param>
/// <param name="newVersionFi">New version form definition</param>
/// <param name="overwrite">Indicates whether existing fields should be overwritten. Alternative form fields need to be overwritten due to the combination with upgraded class form.</param>
/// <param name="isSystemTable">Indicates whether the class is customizable.</param>
private static void CopyCustomFields(FormInfo oldVersionFi, FormInfo newVersionFi, bool overwrite, bool isSystemTable)
{
// Remove all system fields from old definition to get only custom fields
// Remove all dummy fields from old definition for non-customizable classes (Since v9 is condition f => f.System sufficient because dummy fields created in development mode are system)
// * Dummy field in alternative forms are not marked as system in version < v9 and should be updated. Without this condition the old version of dummy field was used instead of new one.
// * Dummy field is not removed from customizable classes due to possible customization.
oldVersionFi.RemoveFields(f => f.System || (f.IsDummyField && !isSystemTable));
// Combine forms so that custom fields from old definition are appended to the new definition
newVersionFi.CombineWithForm(oldVersionFi, new CombineWithFormSettings
{
IncludeCategories = false,
RemoveEmptyCategories = true,
OverwriteExisting = overwrite
});
}