Skip to content

Commit ae5ee1c

Browse files
committed
Always load entities as sync for Condition, LinkEmtity and Value controls #1160
1 parent bfd94cd commit ae5ee1c

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

FetchXmlBuilder/Controls/conditionControl.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ protected override ControlValidationResult ValidateControl(Control control)
240240
break;
241241

242242
case AttributeTypeCode.DateTime:
243-
if (!DateTime.TryParse(value, out DateTime _))
243+
if (!DateTime.TryParse(value, out var _))
244244
{
245245
return new ControlValidationResult(ControlValidationLevel.Error, "Operator " + oper.ToString() + " requires date value");
246246
}
@@ -252,12 +252,12 @@ protected override ControlValidationResult ValidateControl(Control control)
252252
case AttributeTypeCode.Picklist:
253253
case AttributeTypeCode.BigInt:
254254
case AttributeTypeCode.EntityName:
255-
if (!int.TryParse(value, out int _))
255+
if (!int.TryParse(value, out var _))
256256
{
257257
if (oper.IsMultipleValuesType && !string.IsNullOrWhiteSpace(value))
258258
{
259259
var split = value.Split(',');
260-
if (split.Any(v => !int.TryParse(v.Trim(), out int _)))
260+
if (split.Any(v => !int.TryParse(v.Trim(), out var _)))
261261
{
262262
return new ControlValidationResult(ControlValidationLevel.Error, "Operator " + oper.ToString() + " requires whole number values separated by commas");
263263
}
@@ -272,7 +272,7 @@ protected override ControlValidationResult ValidateControl(Control control)
272272
case AttributeTypeCode.Decimal:
273273
case AttributeTypeCode.Double:
274274
case AttributeTypeCode.Money:
275-
if (!decimal.TryParse(value, out decimal _))
275+
if (!decimal.TryParse(value, out var _))
276276
{
277277
return new ControlValidationResult(ControlValidationLevel.Error, "Operator " + oper.ToString() + " requires decimal value");
278278
}
@@ -282,7 +282,7 @@ protected override ControlValidationResult ValidateControl(Control control)
282282
case AttributeTypeCode.Customer:
283283
case AttributeTypeCode.Owner:
284284
case AttributeTypeCode.Uniqueidentifier:
285-
if (!Guid.TryParse(value, out Guid _))
285+
if (!Guid.TryParse(value, out var _))
286286
{
287287
return new ControlValidationResult(ControlValidationLevel.Error, "Operator " + oper.ToString() + " requires a proper guid with format: " + Guid.Empty.ToString());
288288
}
@@ -434,9 +434,12 @@ private void RefreshAttributes()
434434
{
435435
if (!fxb.working)
436436
{
437-
fxb.LoadEntityDetails(entityName, RefreshAttributes);
437+
fxb.LoadEntityDetails(entityName, null, false);
438+
}
439+
else
440+
{
441+
return;
438442
}
439-
return;
440443
}
441444
BeginInit();
442445
var attributes = fxb.GetDisplayAttributes(entityName);
@@ -495,7 +498,8 @@ private void RefreshValueOf()
495498
{
496499
if (!fxb.working)
497500
{
498-
fxb.LoadEntityDetails(entityName, RefreshAttributes);
501+
fxb.LoadEntityDetails(entityName, null, false);
502+
RefreshAttributes();
499503
}
500504
return;
501505
}
@@ -635,7 +639,7 @@ enummeta.OptionSet is OptionSetMetadata options &&
635639
else if (fxb.settings.UseLookup
636640
&& (attributeMetadata is LookupAttributeMetadata
637641
|| attributeMetadata.AttributeType == AttributeTypeCode.Uniqueidentifier)
638-
&& Guid.TryParse(cmbValue.Text, out Guid id) && !Guid.Empty.Equals(id))
642+
&& Guid.TryParse(cmbValue.Text, out var id) && !Guid.Empty.Equals(id))
639643
{
640644
var loookuptargets = new List<string>();
641645
if (!string.IsNullOrWhiteSpace(txtUitype.Text))
@@ -727,7 +731,7 @@ enummeta.OptionSet is OptionSetMetadata options &&
727731
else if (valueType == AttributeTypeCode.DateTime)
728732
{
729733
panValue.Visible = !rbDatePicker.Checked;
730-
dtPicker.Value = DateTime.TryParse(cmbValue.Text, out DateTime dt) ? dt : DateTime.Now;
734+
dtPicker.Value = DateTime.TryParse(cmbValue.Text, out var dt) ? dt : DateTime.Now;
731735
panDateSelector.Visible = true;
732736
panDatePicker.Visible = rbDatePicker.Checked;
733737
}

FetchXmlBuilder/Controls/linkEntityControl.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ protected override void PopulateControls()
4747
{
4848
if (!fxb.working)
4949
{
50-
fxb.LoadEntityDetails(parententityname, RefreshRelationships);
50+
fxb.LoadEntityDetails(parententityname, null, false);
51+
RefreshRelationships();
5152
}
5253
}
5354
else

FetchXmlBuilder/Controls/valueControl.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@ public valueControl(TreeNode node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderC
3838
{
3939
if (!fxb.working)
4040
{
41-
fxb.LoadEntityDetails(_entityName, RefreshValues);
41+
fxb.LoadEntityDetails(_entityName, null, false);
4242
}
4343
}
44-
else
45-
{
46-
RefreshValues();
47-
}
44+
RefreshValues();
4845
}
4946

5047
private void RefreshValues()

0 commit comments

Comments
 (0)