• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AttributeMetadata类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AttributeMetadata的典型用法代码示例。如果您正苦于以下问题:C# AttributeMetadata类的具体用法?C# AttributeMetadata怎么用?C# AttributeMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AttributeMetadata类属于命名空间,在下文中一共展示了AttributeMetadata类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GenerateAttribute

 /// <summary>
 /// Ideally, we wouldn't generate any attributes, but we must in order to leverage
 /// the logic in CrmSvcUtil.  If the attribute for an OptionSet is not generated,
 /// then a null reference exception is thrown when attempting to create the
 /// OptionSet.  We will remove these in our ICustomizeCodeDomService implementation.
 /// </summary>
 public bool GenerateAttribute(
     AttributeMetadata attributeMetadata, IServiceProvider services)
 {
     return (attributeMetadata.AttributeType == AttributeTypeCode.Picklist
         || attributeMetadata.AttributeType == AttributeTypeCode.State
         || attributeMetadata.AttributeType == AttributeTypeCode.Status);
 }
开发者ID:cesugden,项目名称:Scripts,代码行数:13,代码来源:FilteringService.cs


示例2: UpdateForms

        private void UpdateForms(IOrganizationService service, AttributeMetadata att)
        {
            /*
             * <row>
             *   <cell id="{056d159e-9144-d809-378b-9e04a7626953}" showlabel="true" locklevel="0">
             *     <labels>
             *       <label description="Points" languagecode="1033" />
             *     </labels>
             *     <control id="new_points" classid="{4273EDBD-AC1D-40d3-9FB2-095C621B552D}" datafieldname="new_points" disabled="true" />
             *   </cell>
             * </row>
             */

            foreach (var form in GetFormsWithAttribute(service, att))
            {
                Trace("Updating Form " + form.Name);
                var xml = form.FormXml;
                var dataFieldStart = "datafieldname=\"" + att.LogicalName + "\"";
                var index = xml.IndexOf(dataFieldStart, StringComparison.OrdinalIgnoreCase);
                while (index >= 0)
                {
                    index = xml.LastIndexOf("<cell ", index, StringComparison.OrdinalIgnoreCase);
                    var cellEnd = xml.IndexOf("</cell>", index, StringComparison.OrdinalIgnoreCase) + "</cell>".Length;
                    xml = xml.Remove(index, cellEnd - index);

                    index = xml.IndexOf(dataFieldStart, index, StringComparison.OrdinalIgnoreCase);
                }
                form.FormXml = xml;
                service.Update(form);
            }
        }
开发者ID:daryllabar,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:31,代码来源:DeleteLogic.cs


示例3: OptionSetBean

        /// <summary>
        /// フィールドのオプションセットを取得する。
        /// </summary>
        /// <param name="attr"></param>
        public OptionSetBean(AttributeMetadata attr)
        {
            valueMap = new Dictionary<int, Label>();
            PicklistAttributeMetadata picklistAttr = attr as PicklistAttributeMetadata;
            StateAttributeMetadata stateAttr = attr as StateAttributeMetadata;
            StatusAttributeMetadata statusAttr = attr as StatusAttributeMetadata;

            // オプションセットを取得する。
            OptionSetMetadata option = null;
            if (picklistAttr != null)
            {
                option = picklistAttr.OptionSet;
            }
            else if (stateAttr != null)
            {
                option = stateAttr.OptionSet;
            }
            else if (statusAttr != null)
            {
                option = statusAttr.OptionSet;
            }
            else
            {
                return;
            }

            foreach (OptionMetadata opt in option.Options)
            {
                if (opt.Value != null)
                {

                    valueMap.Add((int)opt.Value, opt.Label);
                }
            }
        }
开发者ID:gk0909c,项目名称:DynamicsDataExplorer,代码行数:39,代码来源:OptionSetBean.cs


示例4: Run

        public void Run(AttributeMetadata att, string newAttributeSchemaName, Steps stepsToPerform, Action actions, AttributeMetadata newAttributeType = null)
        {
            var state = GetApplicationMigrationState(Service, att, newAttributeSchemaName, actions);
            AssertValidStepsForState(att.SchemaName, newAttributeSchemaName, stepsToPerform, state, actions);
            var oldAtt = state.Old;
            var tmpAtt = state.Temp;
            var newAtt = state.New;

            switch (actions)
            {
                case Action.RemoveTemp:
                    RemoveTemp(stepsToPerform, tmpAtt);
                    break;

                case Action.Rename:
                case Action.Rename | Action.ChangeType:
                    CreateNew(newAttributeSchemaName, stepsToPerform, oldAtt, ref newAtt, newAttributeType); // Create or Retrieve the New Attribute
                    MigrateToNew(stepsToPerform, oldAtt, newAtt, actions);
                    RemoveExisting(stepsToPerform, oldAtt);
                    break;

                case Action.ChangeCase:
                case Action.ChangeCase | Action.ChangeType:
                case Action.ChangeType:
                    CreateTemp(stepsToPerform, oldAtt, ref tmpAtt, newAttributeType); // Either Create or Retrieve the Temp
                    MigrateToTemp(stepsToPerform, oldAtt, tmpAtt, actions);
                    RemoveExisting(stepsToPerform, oldAtt);
                    CreateNew(newAttributeSchemaName, stepsToPerform, tmpAtt, ref newAtt, newAttributeType);
                    MigrateToNew(stepsToPerform, tmpAtt, newAtt, actions);
                    RemoveTemp(stepsToPerform, tmpAtt);
                    break;
            }
        }
开发者ID:ganpathv,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:33,代码来源:Logic.cs


示例5: BuildCodeTypeReferenceForPartyList

 CodeTypeReference ITypeMappingService.GetTypeForAttributeType(EntityMetadata entityMetadata, AttributeMetadata attributeMetadata, IServiceProvider services)
 {
     var type = typeof (object);
     if (attributeMetadata.AttributeType.HasValue)
     {
         var key = attributeMetadata.AttributeType.Value;
         if (_attributeTypeMapping.ContainsKey(key))
         {
             type = _attributeTypeMapping[key];
         }
         else
         {
             if (key == AttributeTypeCode.PartyList)
             {
                 return BuildCodeTypeReferenceForPartyList(services);
             }
             var attributeOptionSet = GetAttributeOptionSet(attributeMetadata);
             if (attributeOptionSet != null)
             {
                 return BuildCodeTypeReferenceForOptionSet(attributeMetadata.LogicalName, entityMetadata, attributeOptionSet, services);
             }
         }
         if (type.IsValueType)
         {
             type = typeof (Nullable<>).MakeGenericType(new[] {type});
         }
     }
     return TypeRef(type);
 }
开发者ID:snugglesftw,项目名称:Crm,代码行数:29,代码来源:TypeMappingService.cs


示例6: CloneAttributes

        private AttributeMetadata CloneAttributes(AttributeMetadata att, string schemaName, AttributeMetadata newAttributeType)
        {
            var clone = CloneAttributes((dynamic)(newAttributeType ?? att));

            clone.CanModifyAdditionalSettings = att.CanModifyAdditionalSettings;
            clone.Description = att.Description;
            clone.DisplayName = att.DisplayName;
            clone.ExtensionData = att.ExtensionData;
            clone.IsAuditEnabled = att.IsAuditEnabled;
            clone.IsCustomizable = att.IsCustomizable;
            clone.IsRenameable = att.IsRenameable;
            clone.IsSecured = att.IsSecured;
            clone.IsValidForAdvancedFind = att.IsValidForAdvancedFind;
            clone.LinkedAttributeId = att.LinkedAttributeId;
            clone.RequiredLevel = att.RequiredLevel;


            // Fix for issue 1468 Inactive Language Causing Error
            RemoveInvalidLanguageLocalizedLabels(att.Description);
            RemoveInvalidLanguageLocalizedLabels(att.DisplayName);

            clone.LogicalName = schemaName.ToLower();
            clone.SchemaName = schemaName;

            // Update EntityLogicalName for other methods to use
            SetEntityLogicalName(clone, att.EntityLogicalName);
            return clone;
        }
开发者ID:ganpathv,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:28,代码来源:AttributeMetadataCloner.cs


示例7: GetNameForAttribute

 public static string GetNameForAttribute(AttributeMetadata attributeMetadata)
 {
     if (!_attributeNames.ContainsKey(attributeMetadata.LogicalName))
     {
         return null;
     }
     return _attributeNames[attributeMetadata.LogicalName];
 }
开发者ID:snugglesftw,项目名称:Crm,代码行数:8,代码来源:StaticNamingService.cs


示例8: CopyValueInternal

 private object CopyValueInternal(AttributeMetadata oldAttribute, IntegerAttributeMetadata newAttribute, object value)
 {
     int output;
     if (int.TryParse(value.ToString(), out output))
     {
         return output;
     }
     Trace("Unable to convert value \"" + value + "\" of type \"" + value.GetType().Name + "\" to Integer");
     return null;
 }
开发者ID:ganpathv,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:10,代码来源:AttributeValueCopier.cs


示例9: UpdateForumlaDefinition

 private static UpdateFormulaResponse UpdateForumlaDefinition(dynamic att, AttributeMetadata from, AttributeMetadata to)
 {
     var response = new UpdateFormulaResponse
     {
         CurrentForumla = att.FormulaDefinition,
         NewFormula = UpdateFormula(att.FormulaDefinition, from.LogicalName, to.LogicalName)
     };
     att.FormulaDefinition = response.NewFormula;
     return response;
 }
开发者ID:daryllabar,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:10,代码来源:UpdateFormulaDefintionLogic.cs


示例10: RetrieveAttributeResponseWrapper

 /// <summary>
 /// constructor for the wrapper
 /// </summary>
 /// <param name="response">accepts an object that derives from the OrganizationResponse class</param>
 public RetrieveAttributeResponseWrapper(OrganizationResponse response)
 {
     try
     {
         _metadata = ((RetrieveAttributeResponseWrapper)response).AttributeMetadata;
     }
     catch
     {
         _metadata = ((RetrieveAttributeResponse)response).AttributeMetadata;
     }
 }
开发者ID:milos01,项目名称:Crm-Sample-Code,代码行数:15,代码来源:RetrieveAttributeResponseWrapper.cs


示例11:

 bool ICodeWriterFilterService.GenerateAttribute(AttributeMetadata attributeMetadata, IServiceProvider services)
 {
     if (!string.IsNullOrEmpty(attributeMetadata.AttributeOf))
     {
         return false;
     }
     if ((!attributeMetadata.IsValidForCreate.GetValueOrDefault() && !attributeMetadata.IsValidForRead.GetValueOrDefault()) && !attributeMetadata.IsValidForUpdate.GetValueOrDefault())
     {
         return false;
     }
     return true;
 }
开发者ID:snugglesftw,项目名称:Crm,代码行数:12,代码来源:CodeWriterFilterService.cs


示例12: SetAttributeCmb

        /// <summary>
        /// 条件指定用のコンボボックスを設定
        /// </summary>
        /// <param name="attributes"></param>
        /// <returns></returns>
        public void SetAttributeCmb(AttributeMetadata[] attributes, ComboBox cmb)
        {
            List<CmbBean> attributeList = new List<CmbBean>();

            foreach (AttributeMetadata attr in attributes)
            {
                CmbBean bean = new CmbBean(attr.LogicalName, attr.DisplayName);
                attributeList.Add(bean);
            }
            attributeList.Sort((a, b) => a.DisplayName.CompareTo(b.DisplayName));
            SetListToCmb(attributeList, cmb);
        }
开发者ID:gk0909c,项目名称:DynamicsDataExplorer,代码行数:17,代码来源:QueryFormLogic.cs


示例13: PopulateControls

 private void PopulateControls(TreeNode node, AttributeMetadata[] attributes)
 {
     cmbAttribute.Items.Clear();
     if (attributes != null)
     {
         foreach (var attribute in attributes)
         {
             AttributeItem.AddAttributeToComboBox(cmbAttribute, attribute, false);
         }
     }
     var aggregate = FetchXmlBuilder.IsFetchAggregate(node);
     textAlias.Enabled = aggregate;
 }
开发者ID:aytacozkan,项目名称:Cinteros.XrmToolbox.FetchXMLBuilder,代码行数:13,代码来源:orderControl.cs


示例14: attributeControl

 public attributeControl(TreeNode Node, AttributeMetadata[] attributes, FetchXmlBuilder fetchXmlBuilder)
     : this()
 {
     collec = (Dictionary<string, string>)Node.Tag;
     if (collec == null)
     {
         collec = new Dictionary<string, string>();
     }
     node = Node;
     PopulateControls(Node, attributes);
     ControlUtils.FillControls(collec, this.Controls);
     controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
     Saved += fetchXmlBuilder.CtrlSaved;
 }
开发者ID:aytacozkan,项目名称:Cinteros.XrmToolbox.FetchXMLBuilder,代码行数:14,代码来源:attributeControl.cs


示例15: UpdateViews

        private void UpdateViews(IOrganizationService service, AttributeMetadata att)
        {
            foreach (var query in GetViewsWithAttribute(service, att))
            {
                Trace("Updating View " + query.Name);
                query.FetchXml = RemoveFieldFromFetchXml(query.FetchXml, att.LogicalName);

                if (query.LayoutXml != null)
                {
                    query.LayoutXml = RemoveFieldFromFetchXml(query.LayoutXml, att.LogicalName);
                }
                service.Update(query);
            }
        }
开发者ID:daryllabar,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:14,代码来源:DeleteLogic.cs


示例16: TestEnsureEmailGovdeliveryFieldNoField

        public void TestEnsureEmailGovdeliveryFieldNoField()
        {
            var service = new Mock<IOrganizationService>();
            service.Setup(dyn => dyn.Execute(It.IsAny<CreateAttributeRequest>()));

            var client = new Mock<DynamicsClient>("http://blah.test.com", "someone", "password");
            client.Setup(obj => obj.getService()).Returns(service.Object);

               var attributes = new AttributeMetadata[]{};
            client.Setup(obj => obj.retrieveMetadataAttributes(It.IsAny<string>())).Returns(attributes);

            client.Object.EnsureEmailGovdeliveryField();
            client.Verify(obj => obj.retrieveMetadataAttributes(It.IsAny<string>()));
            service.Verify(dyn => dyn.Execute(It.IsAny<CreateAttributeRequest>()));
        }
开发者ID:eebbesen,项目名称:govdelivery-connect-dotnet,代码行数:15,代码来源:DynamicsClientTests.cs


示例17: GetNameForAttribute

 public string GetNameForAttribute(EntityMetadata entityMetadata, AttributeMetadata attributeMetadata, IServiceProvider services)
 {
     List<string> specifiedNames;
     string attributeName;
     if (EntityAttributeSpecifiedNames.TryGetValue(entityMetadata.LogicalName.ToLower(), out specifiedNames) &&
         specifiedNames.Any(s => string.Equals(s, attributeMetadata.LogicalName, StringComparison.OrdinalIgnoreCase)))
     {
         attributeName = specifiedNames.First(s => string.Equals(s, attributeMetadata.LogicalName, StringComparison.OrdinalIgnoreCase));
     }
     else
     {
         attributeName = DefaultService.GetNameForAttribute(entityMetadata, attributeMetadata, services);
     }
     return attributeName;
 }
开发者ID:ganpathv,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:15,代码来源:OverridePropertyNames.cs


示例18: orderControl

        public orderControl(TreeNode Node, AttributeMetadata[] attributes, FetchXmlBuilder fetchXmlBuilder)
            : this()
        {
            form = fetchXmlBuilder;
            friendly = fetchXmlBuilder.currentSettings.useFriendlyNames;
            collec = (Dictionary<string, string>)Node.Tag;
            if (collec == null)
            {
                collec = new Dictionary<string, string>();
            }

            PopulateControls(Node, attributes);
            ControlUtils.FillControls(collec, this.Controls);
            controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
            Saved += fetchXmlBuilder.CtrlSaved;
        }
开发者ID:smgtreker,项目名称:FetchXMLBuilder,代码行数:16,代码来源:orderControl.cs


示例19: CreateValidName

 string INamingService.GetNameForAttribute(EntityMetadata entityMetadata, AttributeMetadata attributeMetadata, IServiceProvider services)
 {
     if (_knowNames.ContainsKey(entityMetadata.MetadataId.Value.ToString() + attributeMetadata.MetadataId.Value))
     {
         return _knowNames[entityMetadata.MetadataId.Value.ToString() + attributeMetadata.MetadataId.Value];
     }
     var name = StaticNamingService.GetNameForAttribute(attributeMetadata) ?? attributeMetadata.SchemaName;
     name = CreateValidName(name);
     var service = (INamingService) services.GetService(typeof (INamingService));
     if (_reservedAttributeNames.Contains(name) || (name == service.GetNameForEntity(entityMetadata, services)))
     {
         name = name + "1";
     }
     _knowNames.Add(entityMetadata.MetadataId.Value.ToString() + attributeMetadata.MetadataId.Value, name);
     return name;
 }
开发者ID:snugglesftw,项目名称:Crm,代码行数:16,代码来源:NamingService.cs


示例20: UpdateCharts

        private void UpdateCharts(IOrganizationService service, AttributeMetadata att)
        {
            foreach (var chart in GetSystemChartsWithAttribute(service, att))
            {
                Trace("Updating Chart " + chart.Name);
                chart.DataDescription = RemoveFieldFromFetchXml(chart.DataDescription, att.LogicalName);
                service.Update(chart);
            }

            foreach (var chart in GetUserChartsWithAttribute(service, att))
            {
                Trace("Updating Chart " + chart.Name);
                chart.DataDescription = RemoveFieldFromFetchXml(chart.DataDescription, att.LogicalName);
                service.Update(chart);
            }
        }
开发者ID:daryllabar,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:16,代码来源:DeleteLogic.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AttributeNode类代码示例发布时间:2022-05-24
下一篇:
C# AttributeList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap