当前位置: 首页>>代码示例>>C#>>正文


C# SPField.WithAssertAndCast方法代码示例

本文整理汇总了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);
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:11,代码来源:URLFieldModelHandler.cs

示例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;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:15,代码来源:BusinessDataFieldModelHandler.cs

示例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;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:17,代码来源:TextFieldModelHandler.cs

示例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;
            }
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:38,代码来源:TaxonomyFieldModelHandler.cs


注:本文中的SPField.WithAssertAndCast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。