本文整理汇总了C#中SPField.WithAssertAndCast方法的典型用法代码示例。如果您正苦于以下问题:C# SPField.WithAssertAndCast方法的具体用法?C# SPField.WithAssertAndCast怎么用?C# SPField.WithAssertAndCast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPField
的用法示例。
在下文中一共展示了SPField.WithAssertAndCast方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessFieldProperties
protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
{
// let base setting be setup
base.ProcessFieldProperties(field, fieldModel);
var spField = field.WithAssertAndCast<SPFieldUrl>("field", value => value.RequireNotNull());
var typedFieldModel = fieldModel.WithAssertAndCast<URLFieldDefinition>("model", value => value.RequireNotNull());
if (!string.IsNullOrEmpty(typedFieldModel.DisplayFormat))
spField.DisplayFormat = (SPUrlFieldFormatType)Enum.Parse(typeof(SPUrlFieldFormatType), typedFieldModel.DisplayFormat);
}
示例2: ProcessFieldProperties
protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
{
// let base setting be setup
base.ProcessFieldProperties(field, fieldModel);
// process bcs field specific properties
var bcsField = field.WithAssertAndCast<SPBusinessDataField>("field", value => value.RequireNotNull());
var bcsFieldModel = fieldModel.WithAssertAndCast<BusinessDataFieldDefinition>("model", value => value.RequireNotNull());
bcsField.SystemInstanceName = bcsFieldModel.SystemInstanceName;
bcsField.EntityNamespace = bcsFieldModel.EntityNamespace;
bcsField.EntityName = bcsFieldModel.EntityName;
bcsField.BdcFieldName = bcsFieldModel.BdcFieldName;
}
示例3: ProcessFieldProperties
protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
{
// let base setting be setup
base.ProcessFieldProperties(field, fieldModel);
if (!string.IsNullOrEmpty(fieldModel.ValidationMessage))
field.ValidationMessage = fieldModel.ValidationMessage;
if (!string.IsNullOrEmpty(fieldModel.ValidationFormula))
field.ValidationFormula = fieldModel.ValidationFormula;
var spField = field.WithAssertAndCast<SPFieldText>("field", value => value.RequireNotNull());
var typedFieldModel = fieldModel.WithAssertAndCast<TextFieldDefinition>("model", value => value.RequireNotNull());
if (typedFieldModel.MaxLength.HasValue)
spField.MaxLength = typedFieldModel.MaxLength.Value;
}
示例4: ProcessFieldProperties
protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
{
// let base setting be setup
base.ProcessFieldProperties(field, fieldModel);
// process taxonomy field specific properties
var taxField = field.WithAssertAndCast<TaxonomyField>("field", value => value.RequireNotNull());
var taxFieldModel = fieldModel.WithAssertAndCast<TaxonomyFieldDefinition>("model", value => value.RequireNotNull());
var site = GetCurrentSite();
taxField.AllowMultipleValues = taxFieldModel.IsMulti;
if (taxFieldModel.Open.HasValue)
taxField.Open = taxFieldModel.Open.Value;
if (taxFieldModel.CreateValuesInEditForm.HasValue)
taxField.CreateValuesInEditForm = taxFieldModel.CreateValuesInEditForm.Value;
if (taxFieldModel.IsPathRendered.HasValue)
taxField.IsPathRendered = taxFieldModel.IsPathRendered.Value;
TermStore tesmStore = LookupTermStore(site, taxFieldModel);
if (tesmStore != null)
{
taxField.SspId = tesmStore.Id;
TermSet termSet = LookupTermSet(site, tesmStore, taxFieldModel);
Term term = LookupTerm(site, tesmStore, taxFieldModel);
if (termSet != null)
taxField.TermSetId = termSet.Id;
if (term != null)
taxField.AnchorId = term.Id;
}
}