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


C# AttributeMetadata类代码示例

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


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


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