本文整理汇总了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);
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例7: GetNameForAttribute
public static string GetNameForAttribute(AttributeMetadata attributeMetadata)
{
if (!_attributeNames.ContainsKey(attributeMetadata.LogicalName))
{
return null;
}
return _attributeNames[attributeMetadata.LogicalName];
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}