VI.DB/VI.DB.Entities/StateLessEntityLogic.cs
Compact public source page. The previous oversized rendered HTML was archived outside the public site; this page keeps source-derived context plus a bounded excerpt for browsing/search.
original 0.50 MBcompact pageexcerpt 2 lines
Source-derived context
classes StateLessEntityLogic, Expensive, ExpensiveCheck, ExpensiveFormat; methods MoveNext, SetStateMachine, _003C_003Em__Finally1, _003C_003Em__Finally2, Value, CanSee; references ESet; markers reads entity values, references DB/Dialog objects
StateLessEntityLogicExpensiveExpensiveCheckExpensiveFormatStateSpecial_003C_GetMatchingSetValueActions_003Ed__74MoveNextSetStateMachine_003C_003Em__Finally1_003C_003Em__Finally2ValueCanSeeMinLenMaxLenCheckFormatRegisterExpensiveAddExpensiveRegisterMethodRegisterFunctionAddMethodCreateMethodRadioGroupSwitchFnPreventLoopsPreventLoopsFnESetTryResultGetValueGetValueAsync
Bounded excerpt
First lines from the rendered source block, bounded to keep the public page fast.
1using System;2using System.Collections;3using System.Collections.Concurrent;4using System.Collections.Generic;5using System.ComponentModel;6using System.Diagnostics;7using System.Linq;8using System.Linq.Expressions;9using System.Reflection;10using System.Runtime.CompilerServices;11using System.Runtime.InteropServices;12using System.Threading;13using System.Threading.Tasks;14using NLog;15using VI.Base;16using VI.Base.Graphs;17using VI.DB.MetaData;1819namespace VI.DB.Entities;2021public abstract class StateLessEntityLogic : EntityLogicBase, IFluentInterface22{23 internal class Expensive24 {25 [field: CompilerGenerated]26 public string Property27 {28 [CompilerGenerated]29 get;30 [CompilerGenerated]31 set;32 }3334 [field: CompilerGenerated]35 public ILogicCondition[] Conditions36 {37 [CompilerGenerated]38 get;39 [CompilerGenerated]40 set;41 }4243 [field: CompilerGenerated]44 public string[] DependsOn45 {46 [CompilerGenerated]47 get;48 [CompilerGenerated]49 set;50 }51 }5253 internal class ExpensiveCheck : Expensive54 {55 [field: CompilerGenerated]56 public Func<ISession, IEntity, IEntityWalker, object, CancellationToken, System.Threading.Tasks.Task<bool>> Function57 {58 [CompilerGenerated]59 get;60 [CompilerGenerated]61 set;62 }63 }6465 internal class ExpensiveFormat : Expensive66 {67 [field: CompilerGenerated]68 public Func<ISession, IEntity, IEntityWalker, object, CancellationToken, System.Threading.Tasks.Task<object>> Function69 {70 [CompilerGenerated]71 get;72 [CompilerGenerated]73 set;74 }75 }7677 protected static class State78 {79 public const string IsLoaded = "[IsLoaded]";8081 public const string IsDeleted = "[IsDeleted]";82 }8384 protected static class Special85 {86 public const string InModuleMaster = "SPECIAL(InModuleMaster)";8788 public const string IsTransport = "SPECIAL(IsTransport)";8990 public const string IsFullSync = "SPECIAL(IsFullSync)";9192 public const string ModuleName = "SPECIAL(Module)";9394 public const string IsInteractive = "SPECIAL(IsInteractive)";9596 public const string IsHotfixMode = "SPECIAL(IsHotfixMode)";9798 public const string EntityState = "SPECIAL(EntityState)";99100 public const string IsReadOnlyUser = "SPECIAL(ReadOnly)";101 }102103 [StructLayout((LayoutKind)3)]104 [CompilerGenerated]105 private struct _003CCheckValuesAsync_003Ed__67 : IAsyncStateMachine106 {107 public int _003C_003E1__state;108109 public AsyncTaskMethodBuilder<Diff> _003C_003Et__builder;110111 public LogicReadOnlyParameters parameters;112113 public IEntity entity;114115 public Diff changes;116117 public StateLessEntityLogic _003C_003E4__this;118119 public CancellationToken cancellationToken;120121 private EntityWalker _003Cwalker_003E5__2;122123 private LogicValueStore _003Cstore_003E5__3;124125 private Diff _003Cresulting_003E5__4;126127 private System.Collections.Generic.IEnumerator<DiffOperation> _003C_003E7__wrap4;128129 private DiffOperation _003Cchange_003E5__6;130131 private Enumerator<ExpensiveFormat> _003C_003E7__wrap6;132133 private ExpensiveFormat _003Cformat_003E5__8;134135 private object _003Cold_003E5__9;136137 private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;138139 private DiffOperation _003C_003E7__wrap9;140141 private ConfiguredTaskAwaiter<object> _003C_003Eu__2;142143 private Enumerator<ILogicAction> _003C_003E7__wrap10;144145 private ConfiguredTaskAwaiter<TryResult<object>> _003C_003Eu__3;146147 private Enumerator<ExpensiveCheck> _003C_003E7__wrap11;148149 private ExpensiveCheck _003Ccheck_003E5__13;150151 private bool _003CisPropertyItself_003E5__14;152153 private ConfiguredValueTaskAwaiter<object> _003C_003Eu__4;154155 private void MoveNext()156 {157 //IL_033d: Unknown result type (might be due to invalid IL or missing references)158 //IL_0342: Unknown result type (might be due to invalid IL or missing references)159 //IL_034a: Unknown result type (might be due to invalid IL or missing references)160 //IL_0642: Unknown result type (might be due to invalid IL or missing references)161 //IL_0647: Unknown result type (might be due to invalid IL or missing references)162 //IL_064f: Unknown result type (might be due to invalid IL or missing references)163 //IL_084f: Unknown result type (might be due to invalid IL or missing references)164 //IL_0854: Unknown result type (might be due to invalid IL or missing references)165 //IL_085c: Unknown result type (might be due to invalid IL or missing references)166 //IL_08f7: Unknown result type (might be due to invalid IL or missing references)167 //IL_08fc: Unknown result type (might be due to invalid IL or missing references)168 //IL_0904: Unknown result type (might be due to invalid IL or missing references)169 //IL_098e: Unknown result type (might be due to invalid IL or missing references)170 //IL_0993: Unknown result type (might be due to invalid IL or missing references)171 //IL_099b: Unknown result type (might be due to invalid IL or missing references)172 //IL_0083: Unknown result type (might be due to invalid IL or missing references)173 //IL_0088: Unknown result type (might be due to invalid IL or missing references)174 //IL_0400: Unknown result type (might be due to invalid IL or missing references)175 //IL_0405: Unknown result type (might be due to invalid IL or missing references)176 //IL_040d: Unknown result type (might be due to invalid IL or missing references)177 //IL_027a: Unknown result type (might be due to invalid IL or missing references)178 //IL_027f: Unknown result type (might be due to invalid IL or missing references)179 //IL_0561: Unknown result type (might be due to invalid IL or missing references)180 //IL_0566: Unknown result type (might be due to invalid IL or missing references)181 //IL_074b: Unknown result type (might be due to invalid IL or missing references)182 //IL_0750: Unknown result type (might be due to invalid IL or missing references)183 //IL_0945: Unknown result type (might be due to invalid IL or missing references)184 //IL_0950: Unknown result type (might be due to invalid IL or missing references)185 //IL_0955: Unknown result type (might be due to invalid IL or missing references)186 //IL_0959: Unknown result type (might be due to invalid IL or missing references)187 //IL_095e: Unknown result type (might be due to invalid IL or missing references)188 //IL_03b7: Unknown result type (might be due to invalid IL or missing references)189 //IL_03c2: Unknown result type (might be due to invalid IL or missing references)190 //IL_03c7: Unknown result type (might be due to invalid IL or missing references)191 //IL_03cb: Unknown result type (might be due to invalid IL or missing references)192 //IL_03d0: Unknown result type (might be due to invalid IL or missing references)193 //IL_06c3: Unknown result type (might be due to invalid IL or missing references)194 //IL_0973: Unknown result type (might be due to invalid IL or missing references)195 //IL_0975: Unknown result type (might be due to invalid IL or missing references)196 //IL_09ff: Unknown result type (might be due to invalid IL or missing references)197 //IL_03e5: Unknown result type (might be due to invalid IL or missing references)198 //IL_03e7: Unknown result type (might be due to invalid IL or missing references)199 //IL_04db: Unknown result type (might be due to invalid IL or missing references)200 //IL_05f9: Unknown result type (might be due to invalid IL or missing references)201 //IL_0604: Unknown result type (might be due to invalid IL or missing references)202 //IL_0609: Unknown result type (might be due to invalid IL or missing references)203 //IL_060d: Unknown result type (might be due to invalid IL or missing references)204 //IL_0612: Unknown result type (might be due to invalid IL or missing references)205 //IL_08aa: Unknown result type (might be due to invalid IL or missing references)206 //IL_08b9: Unknown result type (might be due to invalid IL or missing references)207 //IL_08be: Unknown result type (might be due to invalid IL or missing references)208 //IL_08c2: Unknown result type (might be due to invalid IL or missing references)209 //IL_08c7: Unknown result type (might be due to invalid IL or missing references)210 //IL_0806: Unknown result type (might be due to invalid IL or missing references)211 //IL_0811: Unknown result type (might be due to invalid IL or missing references)212 //IL_0816: Unknown result type (might be due to invalid IL or missing references)213 //IL_081a: Unknown result type (might be due to invalid IL or missing references)214 //IL_081f: Unknown result type (might be due to invalid IL or missing references)215 //IL_02f4: Unknown result type (might be due to invalid IL or missing references)216 //IL_02ff: Unknown result type (might be due to invalid IL or missing references)217 //IL_0304: Unknown result type (might be due to invalid IL or missing references)218 //IL_0308: Unknown result type (might be due to invalid IL or missing references)219 //IL_030d: Unknown result type (might be due to invalid IL or missing references)220 //IL_0627: Unknown result type (might be due to invalid IL or missing references)221 //IL_0629: Unknown result type (might be due to invalid IL or missing references)222 //IL_08dc: Unknown result type (might be due to invalid IL or missing references)223 //IL_08de: Unknown result type (might be due to invalid IL or missing references)224 //IL_0834: Unknown result type (might be due to invalid IL or missing references)225 //IL_0836: Unknown result type (might be due to invalid IL or missing references)226 //IL_0322: Unknown result type (might be due to invalid IL or missing references)227 //IL_0324: Unknown result type (might be due to invalid IL or missing references)228 int num = _003C_003E1__state;229 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;230 Diff result3;231 try232 {233 switch (num)234 {235 default:236 {237 _003Cwalker_003E5__2 = new EntityWalker(parameters.Session, entity, parameters.IdentityMap);238 System.Collections.Generic.IEnumerator<DiffOperation> enumerator = changes.GetEnumerator();239 try240 {241 while (((System.Collections.IEnumerator)enumerator).MoveNext())242 {243 DiffOperation current = enumerator.Current;244 if (!current.Type.IsValue())245 {246 continue;247 }248 Enumerator<ILogicAction> enumerator2 = stateLessEntityLogic._actions.GetEnumerator();249 try250 {251 while (enumerator2.MoveNext())252 {253 ILogicAction current2 = enumerator2.Current;254 if (!current2.ActionType.Equals(LogicActionType.FormatValue) || !string.Equals(current.Name, current2.Property, (StringComparison)5))255 {256 continue;257 }258 object value = current.Value;259 ValType valType = DbVal.GetValType(current2.Parameters[0].Type);260 object obj = DbVal.ConvertTo(value, valType);261 object obj2 = current2.Call(new object[1] { obj });262 if (DbVal.Compare(obj2, obj, valType) != 0)263 {264 current.AlreadyApplied = false;265 current.Value = obj2;266 if (!parameters.Table.Columns[current2.Property].DoNotLogChanges)267 {268 stateLessEntityLogic._Debug(parameters.Session, "Format: {0} => {1}", obj, obj2);269 }270 else271 {272 stateLessEntityLogic._Debug(parameters.Session, "Format: <Hidden>");273 }274 }275 }276 }277 finally278 {279 if (num < 0)280 {281 ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();282 }283 }284 }285 }286 finally287 {288 if (num < 0)289 {290 ((System.IDisposable)enumerator)?.Dispose();291 }292 }293 _003Cstore_003E5__3 = stateLessEntityLogic.CreateStore(parameters.Session, entity, _003Cwalker_003E5__2);294 _003Cresulting_003E5__4 = changes;295 enumerator = changes.GetEnumerator();296 try297 {298 while (((System.Collections.IEnumerator)enumerator).MoveNext())299 {300 DiffOperation current3 = enumerator.Current;301 if (current3.Type.IsValue())302 {303 _003Cstore_003E5__3.SetValue(current3.Name, current3.Value);304 }305 }306 }307 finally308 {309 if (num < 0)310 {311 ((System.IDisposable)enumerator)?.Dispose();312 }313 }314 _003C_003E7__wrap4 = changes.GetEnumerator();315 goto case 0;316 }317 case 0:318 case 1:319 try320 {321 if ((uint)num <= 1u)322 {323 goto IL_0285;324 }325 goto IL_04e8;326 IL_04e8:327 while (((System.Collections.IEnumerator)_003C_003E7__wrap4).MoveNext())328 {329 _003Cchange_003E5__6 = _003C_003E7__wrap4.Current;330 if (!_003Cchange_003E5__6.Type.IsValue())331 {332 continue;333 }334 _003C_003E7__wrap6 = stateLessEntityLogic._expensiveFormats.GetEnumerator();335 goto IL_0285;336 }337 goto end_IL_0244;338 IL_0285:339 try340 {341 ConfiguredTaskAwaiter<object> val;342 if (num != 0)343 {344 if (num != 1)345 {346 goto IL_04ad;347 }348 val = _003C_003Eu__2;349 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<object>);350 num = (_003C_003E1__state = -1);351 goto IL_041c;352 }353 ConfiguredTaskAwaiter<bool> val2 = _003C_003Eu__1;354 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);355 num = (_003C_003E1__state = -1);356 goto IL_0359;357 IL_041c:358 object result = val.GetResult();359 _003C_003E7__wrap9.Value = result;360 _003C_003E7__wrap9 = null;361 if (!parameters.Table.Columns[_003Cformat_003E5__8.Property].DoNotLogChanges)362 {363 stateLessEntityLogic._Debug(parameters.Session, "Format: {0} => {1}", _003Cold_003E5__9, _003Cchange_003E5__6.Value);364 }365 else366 {367 stateLessEntityLogic._Debug(parameters.Session, "Format: <Hidden>");368 }369 _003Cold_003E5__9 = null;370 _003Cformat_003E5__8 = null;371 goto IL_04ad;372 IL_02c9:373 bool flag = _003Cformat_003E5__8.Conditions != null;374 if (flag)375 {376 val2 = stateLessEntityLogic._CheckConditionsAsync(_003Cformat_003E5__8.Conditions, invert: false, _003Cstore_003E5__3, cancellationToken).ConfigureAwait(false).GetAwaiter();377 if (!val2.IsCompleted)378 {379 num = (_003C_003E1__state = 0);380 _003C_003Eu__1 = val2;381 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003CCheckValuesAsync_003Ed__67>(ref val2, ref this);382 return;383 }384 goto IL_0359;385 }386 goto IL_0365;387 IL_0359:388 flag = !val2.GetResult();389 goto IL_0365;390 IL_04ad:391 while (_003C_003E7__wrap6.MoveNext())392 {393 _003Cformat_003E5__8 = _003C_003E7__wrap6.Current;394 if (!string.Equals(_003Cchange_003E5__6.Name, _003Cformat_003E5__8.Property, (StringComparison)5))395 {396 continue;397 }398 goto IL_02c9;399 }400 goto end_IL_0285;401 IL_0365:402 if (!flag)403 {404 _003Cold_003E5__9 = _003Cchange_003E5__6.Value;405 _003C_003E7__wrap9 = _003Cchange_003E5__6;406 val = _003Cformat_003E5__8.Function.Invoke(parameters.Session, entity, (IEntityWalker)_003Cwalker_003E5__2, _003Cchange_003E5__6.Value, cancellationToken).ConfigureAwait(false).GetAwaiter();407 if (!val.IsCompleted)408 {409 num = (_003C_003E1__state = 1);410 _003C_003Eu__2 = val;411 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<object>, _003CCheckValuesAsync_003Ed__67>(ref val, ref this);412 return;413 }414 goto IL_041c;415 }416 goto IL_04ad;417 end_IL_0285:;418 }419 finally420 {421 if (num < 0)422 {423 ((System.IDisposable)_003C_003E7__wrap6/*cast due to .constrained prefix*/).Dispose();424 }425 }426 _003C_003E7__wrap6 = default(Enumerator<ExpensiveFormat>);427 _003Cchange_003E5__6 = null;428 goto IL_04e8;429 end_IL_0244:;430 }431 finally432 {433 if (num < 0 && _003C_003E7__wrap4 != null)434 {435 ((System.IDisposable)_003C_003E7__wrap4).Dispose();436 }437 }438 _003C_003E7__wrap4 = null;439 _003C_003E7__wrap4 = changes.GetEnumerator();440 goto case 2;441 case 2:442 try443 {444 if (num == 2)445 {446 goto IL_056c;447 }448 goto IL_06d0;449 IL_06d0:450 while (((System.Collections.IEnumerator)_003C_003E7__wrap4).MoveNext())451 {452 _003Cchange_003E5__6 = _003C_003E7__wrap4.Current;453 if (!_003Cchange_003E5__6.Type.IsValue())454 {455 continue;456 }457 _003C_003E7__wrap10 = stateLessEntityLogic._actions.GetEnumerator();458 goto IL_056c;459 }460 goto end_IL_052b;461 IL_056c:462 try463 {464 if (num != 2)465 {466 goto IL_0695;467 }468 ConfiguredTaskAwaiter<TryResult<object>> val3 = _003C_003Eu__3;469 _003C_003Eu__3 = default(ConfiguredTaskAwaiter<TryResult<object>>);470 num = (_003C_003E1__state = -1);471 goto IL_065e;472 IL_065e:473 TryResult<object> result2 = val3.GetResult();474 if (result2.Success && !(bool)result2.Result)475 {476 _003Cresulting_003E5__4 = _003Cresulting_003E5__4.RemoveOrRevert(_003Cchange_003E5__6);477 }478 goto IL_0695;479 IL_0695:480 while (_003C_003E7__wrap10.MoveNext())481 {482 ILogicAction current4 = _003C_003E7__wrap10.Current;483 if (!current4.ActionType.Equals(LogicActionType.CheckValue) || !string.Equals(_003Cchange_003E5__6.Name, current4.Property, (StringComparison)5))484 {485 continue;486 }487 object value2 = DbVal.ConvertTo(_003Cchange_003E5__6.Value, DbVal.GetValType(current4.Parameters[0].Type));488 _003Cstore_003E5__3.SetValue("[[local]]", value2);489 val3 = stateLessEntityLogic._RunActionAsync(current4, _003Cstore_003E5__3, cancellationToken).ConfigureAwait(false).GetAwaiter();490 if (!val3.IsCompleted)491 {492 num = (_003C_003E1__state = 2);493 _003C_003Eu__3 = val3;494 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<TryResult<object>>, _003CCheckValuesAsync_003Ed__67>(ref val3, ref this);495 return;496 }497 goto IL_065e;498 }499 }500 finally501 {502 if (num < 0)503 {504 ((System.IDisposable)_003C_003E7__wrap10/*cast due to .constrained prefix*/).Dispose();505 }506 }507 _003C_003E7__wrap10 = default(Enumerator<ILogicAction>);508 _003Cchange_003E5__6 = null;509 goto IL_06d0;510 end_IL_052b:;511 }512 finally513 {514 if (num < 0 && _003C_003E7__wrap4 != null)515 {516 ((System.IDisposable)_003C_003E7__wrap4).Dispose();517 }518 }519 _003C_003E7__wrap4 = null;520 _003C_003E7__wrap4 = changes.GetEnumerator();521 break;522 case 3:523 case 4:524 case 5:525 break;526 }527 try528 {529 if ((uint)(num - 3) <= 2u)530 {531 goto IL_0756;532 }533 goto IL_0a0c;534 IL_0a0c:535 while (((System.Collections.IEnumerator)_003C_003E7__wrap4).MoveNext())536 {537 _003Cchange_003E5__6 = _003C_003E7__wrap4.Current;538 if (!_003Cchange_003E5__6.Type.IsValue())539 {540 continue;541 }542 _003C_003E7__wrap11 = stateLessEntityLogic._expensiveChecks.GetEnumerator();543 goto IL_0756;544 }545 goto end_IL_0713;546 IL_0756:547 try548 {549 ConfiguredValueTaskAwaiter<object> val4;550 ConfiguredTaskAwaiter<bool> val2;551 bool flag;552 object result;553 object obj3;554 switch (num)555 {556 case 3:557 val2 = _003C_003Eu__1;558 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);559 num = (_003C_003E1__state = -1);560 goto IL_086b;561 case 4:562 val4 = _003C_003Eu__4;563 _003C_003Eu__4 = default(ConfiguredValueTaskAwaiter<object>);564 num = (_003C_003E1__state = -1);565 goto IL_0913;566 case 5:567 val2 = _003C_003Eu__1;568 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);569 num = (_003C_003E1__state = -1);570 goto IL_09aa;571 default:572 {573 while (_003C_003E7__wrap11.MoveNext())574 {575 _003Ccheck_003E5__13 = _003C_003E7__wrap11.Current;576 _003CisPropertyItself_003E5__14 = string.Equals(_003Cchange_003E5__6.Name, _003Ccheck_003E5__13.Property, (StringComparison)5);577 if (!_003CisPropertyItself_003E5__14)578 {579 string[] dependsOn = _003Ccheck_003E5__13.DependsOn;580 if (dependsOn == null || !MemoryExtensions.Contains<string>(System.ReadOnlySpan<string>.op_Implicit(dependsOn), _003Cchange_003E5__6.Name, (IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase))581 {582 continue;583 }584 }585 goto IL_07db;586 }587 break;588 }589 IL_086b:590 flag = !val2.GetResult();591 goto IL_0877;592 IL_0877:593 if (!flag)594 {595 if (_003CisPropertyItself_003E5__14)596 {597 result = _003Cchange_003E5__6.Value;598 goto IL_091c;599 }600 val4 = _003Cstore_003E5__3.GetAsync(_003Ccheck_003E5__13.Property, cancellationToken).ConfigureAwait(false).GetAwaiter();601 if (!val4.IsCompleted)602 {603 num = (_003C_003E1__state = 4);604 _003C_003Eu__4 = val4;605 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<object>, _003CCheckValuesAsync_003Ed__67>(ref val4, ref this);606 return;607 }608 goto IL_0913;609 }610 goto default;611 IL_091c:612 obj3 = result;613 val2 = _003Ccheck_003E5__13.Function.Invoke(parameters.Session, entity, (IEntityWalker)_003Cwalker_003E5__2, obj3, cancellationToken).ConfigureAwait(false).GetAwaiter();614 if (!val2.IsCompleted)615 {616 num = (_003C_003E1__state = 5);617 _003C_003Eu__1 = val2;618 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003CCheckValuesAsync_003Ed__67>(ref val2, ref this);619 return;620 }621 goto IL_09aa;622 IL_09aa:623 if (!val2.GetResult())624 {625 _003Cresulting_003E5__4 = _003Cresulting_003E5__4.RemoveOrRevert(_003Cchange_003E5__6);626 }627 _003Ccheck_003E5__13 = null;628 goto default;629 IL_07db:630 flag = _003Ccheck_003E5__13.Conditions != null;631 if (flag)632 {633 val2 = stateLessEntityLogic._CheckConditionsAsync(_003Ccheck_003E5__13.Conditions, invert: false, _003Cstore_003E5__3, cancellationToken).ConfigureAwait(false).GetAwaiter();634 if (!val2.IsCompleted)635 {636 num = (_003C_003E1__state = 3);637 _003C_003Eu__1 = val2;638 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003CCheckValuesAsync_003Ed__67>(ref val2, ref this);639 return;640 }641 goto IL_086b;642 }643 goto IL_0877;644 IL_0913:645 result = val4.GetResult();646 goto IL_091c;647 }648 }649 finally650 {651 if (num < 0)652 {653 ((System.IDisposable)_003C_003E7__wrap11/*cast due to .constrained prefix*/).Dispose();654 }655 }656 _003C_003E7__wrap11 = default(Enumerator<ExpensiveCheck>);657 _003Cchange_003E5__6 = null;658 goto IL_0a0c;659 end_IL_0713:;660 }661 finally662 {663 if (num < 0 && _003C_003E7__wrap4 != null)664 {665 ((System.IDisposable)_003C_003E7__wrap4).Dispose();666 }667 }668 _003C_003E7__wrap4 = null;669 result3 = _003Cresulting_003E5__4;670 }671 catch (System.Exception exception)672 {673 _003C_003E1__state = -2;674 _003Cwalker_003E5__2 = null;675 _003Cstore_003E5__3 = null;676 _003Cresulting_003E5__4 = null;677 _003C_003Et__builder.SetException(exception);678 return;679 }680 _003C_003E1__state = -2;681 _003Cwalker_003E5__2 = null;682 _003Cstore_003E5__3 = null;683 _003Cresulting_003E5__4 = null;684 _003C_003Et__builder.SetResult(result3);685 }686687 [DebuggerHidden]688 private void SetStateMachine(IAsyncStateMachine stateMachine)689 {690 _003C_003Et__builder.SetStateMachine(stateMachine);691 }692 }693694 [StructLayout((LayoutKind)3)]695 [CompilerGenerated]696 private struct _003COnSavedAsync_003Ed__60 : IAsyncStateMachine697 {698 public int _003C_003E1__state;699700 public AsyncTaskMethodBuilder _003C_003Et__builder;701702 public StateLessEntityLogic _003C_003E4__this;703704 public LogicReadWriteParameters parameters;705706 public IEntity entity;707708 public CancellationToken cancellationToken;709710 private LogicValueStore _003Cstore_003E5__2;711712 private System.IDisposable _003C_003E7__wrap2;713714 private Enumerator<LogicEventRegistration> _003C_003E7__wrap3;715716 private LogicEventRegistration _003Cevt_003E5__5;717718 private ConfiguredTaskAwaiter<object[]> _003C_003Eu__1;719720 private string[] _003C_003E7__wrap5;721722 private int _003C_003E7__wrap6;723724 private ConfiguredTaskAwaiter _003C_003Eu__2;725726 private void MoveNext()727 {728 //IL_02f6: Unknown result type (might be due to invalid IL or missing references)729 //IL_02fb: Unknown result type (might be due to invalid IL or missing references)730 //IL_0303: Unknown result type (might be due to invalid IL or missing references)731 //IL_00ac: Unknown result type (might be due to invalid IL or missing references)732 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)733 //IL_02b0: Unknown result type (might be due to invalid IL or missing references)734 //IL_02bb: Unknown result type (might be due to invalid IL or missing references)735 //IL_02c0: Unknown result type (might be due to invalid IL or missing references)736 //IL_02c4: Unknown result type (might be due to invalid IL or missing references)737 //IL_02c9: Unknown result type (might be due to invalid IL or missing references)738 //IL_02de: Unknown result type (might be due to invalid IL or missing references)739 //IL_02e0: Unknown result type (might be due to invalid IL or missing references)740 //IL_0133: Unknown result type (might be due to invalid IL or missing references)741 //IL_0138: Unknown result type (might be due to invalid IL or missing references)742 //IL_0140: Unknown result type (might be due to invalid IL or missing references)743 //IL_01f4: Unknown result type (might be due to invalid IL or missing references)744 //IL_01f9: Unknown result type (might be due to invalid IL or missing references)745 //IL_0201: Unknown result type (might be due to invalid IL or missing references)746 //IL_00ea: Unknown result type (might be due to invalid IL or missing references)747 //IL_00f5: Unknown result type (might be due to invalid IL or missing references)748 //IL_00fa: Unknown result type (might be due to invalid IL or missing references)749 //IL_00fe: Unknown result type (might be due to invalid IL or missing references)750 //IL_0103: Unknown result type (might be due to invalid IL or missing references)751 //IL_0118: Unknown result type (might be due to invalid IL or missing references)752 //IL_011a: Unknown result type (might be due to invalid IL or missing references)753 //IL_0274: Unknown result type (might be due to invalid IL or missing references)754 //IL_01ab: Unknown result type (might be due to invalid IL or missing references)755 //IL_01b6: Unknown result type (might be due to invalid IL or missing references)756 //IL_01bb: Unknown result type (might be due to invalid IL or missing references)757 //IL_01bf: Unknown result type (might be due to invalid IL or missing references)758 //IL_01c4: Unknown result type (might be due to invalid IL or missing references)759 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)760 //IL_01db: Unknown result type (might be due to invalid IL or missing references)761 int num = _003C_003E1__state;762 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;763 try764 {765 ConfiguredTaskAwaiter val;766 if ((uint)num > 1u)767 {768 if (num == 2)769 {770 val = _003C_003Eu__2;771 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);772 num = (_003C_003E1__state = -1);773 goto IL_0312;774 }775 if (stateLessEntityLogic._events.Count <= 0)776 {777 goto IL_02a2;778 }779 EntityWalker walker = new EntityWalker(parameters.Session, entity, parameters.IdentityMap);780 _003Cstore_003E5__2 = stateLessEntityLogic.CreateStore(parameters.Session, entity, walker);781 LogSessionId sessionId = new LogSessionId(parameters.Session.Id, useMultiLanguage: false);782 _003C_003E7__wrap2 = stateLessEntityLogic._log.LogBlock(sessionId, LogLevel.Debug, "Generating logic events");783 }784 ConfiguredTaskAwaitable val3;785 try786 {787 if ((uint)num > 1u)788 {789 _003C_003E7__wrap3 = stateLessEntityLogic._events.GetEnumerator();790 }791 try792 {793 if (num != 0)794 {795 if (num != 1)796 {797 goto IL_0246;798 }799 val = _003C_003Eu__2;800 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);801 num = (_003C_003E1__state = -1);802 goto IL_0210;803 }804 ConfiguredTaskAwaiter<object[]> val2 = _003C_003Eu__1;805 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<object[]>);806 num = (_003C_003E1__state = -1);807 goto IL_014f;808 IL_014f:809 object[] result = val2.GetResult();810 if (_003Cevt_003E5__5.ShouldBeRaised(result))811 {812 _003C_003E7__wrap5 = _003Cevt_003E5__5.Events;813 _003C_003E7__wrap6 = 0;814 goto IL_0225;815 }816 goto IL_0246;817 IL_0210:818 ((ConfiguredTaskAwaiter)(ref val)).GetResult();819 _003C_003E7__wrap6++;820 goto IL_0225;821 IL_0225:822 if (_003C_003E7__wrap6 < _003C_003E7__wrap5.Length)823 {824 string eventname = _003C_003E7__wrap5[_003C_003E7__wrap6];825 val3 = parameters.UnitOfWork.GenerateAsync(entity, eventname, null, cancellationToken).ConfigureAwait(false);826 val = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();827 if (!((ConfiguredTaskAwaiter)(ref val)).IsCompleted)828 {829 num = (_003C_003E1__state = 1);830 _003C_003Eu__2 = val;831 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavedAsync_003Ed__60>(ref val, ref this);832 return;833 }834 goto IL_0210;835 }836 _003C_003E7__wrap5 = null;837 _003Cevt_003E5__5 = null;838 goto IL_0246;839 IL_0246:840 if (_003C_003E7__wrap3.MoveNext())841 {842 _003Cevt_003E5__5 = _003C_003E7__wrap3.Current;843 val2 = stateLessEntityLogic._GetParameterValuesAsync(_003Cevt_003E5__5.Parameters, _003Cstore_003E5__2, cancellationToken).ConfigureAwait(false).GetAwaiter();844 if (!val2.IsCompleted)845 {846 num = (_003C_003E1__state = 0);847 _003C_003Eu__1 = val2;848 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<object[]>, _003COnSavedAsync_003Ed__60>(ref val2, ref this);849 return;850 }851 goto IL_014f;852 }853 }854 finally855 {856 if (num < 0)857 {858 ((System.IDisposable)_003C_003E7__wrap3/*cast due to .constrained prefix*/).Dispose();859 }860 }861 _003C_003E7__wrap3 = default(Enumerator<LogicEventRegistration>);862 }863 finally864 {865 if (num < 0 && _003C_003E7__wrap2 != null)866 {867 _003C_003E7__wrap2.Dispose();868 }869 }870 _003C_003E7__wrap2 = null;871 _003Cstore_003E5__2 = null;872 goto IL_02a2;873 IL_02a2:874 val3 = ((EntityLogicBase)stateLessEntityLogic).OnSavedAsync(entity, parameters, cancellationToken).ConfigureAwait(false);875 val = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();876 if (!((ConfiguredTaskAwaiter)(ref val)).IsCompleted)877 {878 num = (_003C_003E1__state = 2);879 _003C_003Eu__2 = val;880 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavedAsync_003Ed__60>(ref val, ref this);881 return;882 }883 goto IL_0312;884 IL_0312:885 ((ConfiguredTaskAwaiter)(ref val)).GetResult();886 }887 catch (System.Exception exception)888 {889 _003C_003E1__state = -2;890 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);891 return;892 }893 _003C_003E1__state = -2;894 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();895 }896897 [DebuggerHidden]898 private void SetStateMachine(IAsyncStateMachine stateMachine)899 {900 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);901 }902 }903904 [StructLayout((LayoutKind)3)]905 [CompilerGenerated]906 private struct _003C_CheckConditionsAsync_003Ed__78 : IAsyncStateMachine907 {908 public int _003C_003E1__state;909910 public AsyncTaskMethodBuilder<bool> _003C_003Et__builder;911912 public ILogicCondition[] conditions;913914 public StateLessEntityLogic _003C_003E4__this;915916 public LogicValueStore store;917918 public CancellationToken cancellationToken;919920 public bool invert;921922 private ILogicCondition[] _003C_003E7__wrap1;923924 private int _003C_003E7__wrap2;925926 private ILogicCondition _003Ccondition_003E5__4;927928 private ConfiguredTaskAwaiter<object[]> _003C_003Eu__1;929930 private void MoveNext()931 {932 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)933 //IL_00af: Unknown result type (might be due to invalid IL or missing references)934 //IL_00b7: Unknown result type (might be due to invalid IL or missing references)935 //IL_0061: Unknown result type (might be due to invalid IL or missing references)936 //IL_006c: Unknown result type (might be due to invalid IL or missing references)937 //IL_0071: Unknown result type (might be due to invalid IL or missing references)938 //IL_0075: Unknown result type (might be due to invalid IL or missing references)939 //IL_007a: Unknown result type (might be due to invalid IL or missing references)940 //IL_008f: Unknown result type (might be due to invalid IL or missing references)941 //IL_0091: Unknown result type (might be due to invalid IL or missing references)942 int num = _003C_003E1__state;943 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;944 bool result;945 try946 {947 ConfiguredTaskAwaiter<object[]> val;948 if (num == 0)949 {950 val = _003C_003Eu__1;951 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<object[]>);952 num = (_003C_003E1__state = -1);953 goto IL_00c6;954 }955 if (conditions != null)956 {957 _003C_003E7__wrap1 = conditions;958 _003C_003E7__wrap2 = 0;959 goto IL_00fc;960 }961 result = true;962 goto end_IL_000e;963 IL_00fc:964 if (_003C_003E7__wrap2 < _003C_003E7__wrap1.Length)965 {966 _003Ccondition_003E5__4 = _003C_003E7__wrap1[_003C_003E7__wrap2];967 val = stateLessEntityLogic._GetParameterValuesAsync(_003Ccondition_003E5__4.Parameters, store, cancellationToken).ConfigureAwait(false).GetAwaiter();968 if (!val.IsCompleted)969 {970 num = (_003C_003E1__state = 0);971 _003C_003Eu__1 = val;972 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<object[]>, _003C_CheckConditionsAsync_003Ed__78>(ref val, ref this);973 return;974 }975 goto IL_00c6;976 }977 _003C_003E7__wrap1 = null;978 result = true;979 goto end_IL_000e;980 IL_00c6:981 object[] result2 = val.GetResult();982 if (_003Ccondition_003E5__4.Evaluate(result2) ^ invert)983 {984 _003Ccondition_003E5__4 = null;985 _003C_003E7__wrap2++;986 goto IL_00fc;987 }988 result = false;989 end_IL_000e:;990 }991 catch (System.Exception exception)992 {993 _003C_003E1__state = -2;994 _003C_003Et__builder.SetException(exception);995 return;996 }997 _003C_003E1__state = -2;998 _003C_003Et__builder.SetResult(result);999 }10001001 [DebuggerHidden]1002 private void SetStateMachine(IAsyncStateMachine stateMachine)1003 {1004 _003C_003Et__builder.SetStateMachine(stateMachine);1005 }1006 }10071008 [StructLayout((LayoutKind)3)]1009 [CompilerGenerated]1010 private struct _003C_ExecuteValues_003Ed__87 : IAsyncStateMachine1011 {1012 public int _003C_003E1__state;10131014 public AsyncTaskMethodBuilder _003C_003Et__builder;10151016 public IEntity entity;10171018 public ISession session;10191020 public StateLessEntityLogic _003C_003E4__this;10211022 public System.Collections.Generic.IEnumerable<ILogicAction> actions;10231024 public CancellationToken ct;10251026 private ConfiguredTaskAwaiter<Diff> _003C_003Eu__1;10271028 private void MoveNext()1029 {1030 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)1031 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)1032 //IL_00b2: Unknown result type (might be due to invalid IL or missing references)1033 //IL_005f: Unknown result type (might be due to invalid IL or missing references)1034 //IL_006a: Unknown result type (might be due to invalid IL or missing references)1035 //IL_006f: Unknown result type (might be due to invalid IL or missing references)1036 //IL_0073: Unknown result type (might be due to invalid IL or missing references)1037 //IL_0078: Unknown result type (might be due to invalid IL or missing references)1038 //IL_008d: Unknown result type (might be due to invalid IL or missing references)1039 //IL_008f: Unknown result type (might be due to invalid IL or missing references)1040 int num = _003C_003E1__state;1041 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;1042 try1043 {1044 ConfiguredTaskAwaiter<Diff> val;1045 if (num != 0)1046 {1047 IIdentityMap identityMap2;1048 if (!(entity is InteractiveEntity interactiveEntity))1049 {1050 IIdentityMap identityMap = new IdentityMap(session.Resolve<IEntitySource>());1051 identityMap2 = identityMap;1052 }1053 else1054 {1055 identityMap2 = interactiveEntity.IdentityMap;1056 }1057 IIdentityMap identityMap3 = identityMap2;1058 val = stateLessEntityLogic._RunActionsAsync(session, entity, identityMap3, actions, "Customizer execute values rules", EntityState.LogicSetValues, ct).ConfigureAwait(false).GetAwaiter();1059 if (!val.IsCompleted)1060 {1061 num = (_003C_003E1__state = 0);1062 _003C_003Eu__1 = val;1063 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Diff>, _003C_ExecuteValues_003Ed__87>(ref val, ref this);1064 return;1065 }1066 }1067 else1068 {1069 val = _003C_003Eu__1;1070 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<Diff>);1071 num = (_003C_003E1__state = -1);1072 }1073 val.GetResult();1074 }1075 catch (System.Exception exception)1076 {1077 _003C_003E1__state = -2;1078 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);1079 return;1080 }1081 _003C_003E1__state = -2;1082 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();1083 }10841085 [DebuggerHidden]1086 private void SetStateMachine(IAsyncStateMachine stateMachine)1087 {1088 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);1089 }1090 }10911092 [CompilerGenerated]1093 private sealed class _003C_GetMatchingSetValueActions_003Ed__74 : System.Collections.Generic.IEnumerable<ILogicAction>, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator<ILogicAction>, System.Collections.IEnumerator, System.IDisposable1094 {1095 private int _003C_003E1__state;10961097 private ILogicAction _003C_003E2__current;10981099 private int _003C_003El__initialThreadId;11001101 public StateLessEntityLogic _003C_003E4__this;11021103 private Diff changes;11041105 public Diff _003C_003E3__changes;11061107 private Enumerator<ILogicAction> _003C_003E7__wrap1;11081109 private ILogicAction _003Caction_003E5__3;11101111 private System.Collections.Generic.IEnumerator<DiffOperation> _003C_003E7__wrap3;11121113 private DiffOperation _003Cchange_003E5__5;11141115 private string[] _003C_003E7__wrap5;11161117 private int _003C_003E7__wrap6;11181119 ILogicAction System.Collections.Generic.IEnumerator<ILogicAction>.Current1120 {1121 [DebuggerHidden]1122 get1123 {1124 return _003C_003E2__current;1125 }1126 }11271128 object System.Collections.IEnumerator.Current1129 {1130 [DebuggerHidden]1131 get1132 {1133 return _003C_003E2__current;1134 }1135 }11361137 [DebuggerHidden]1138 public _003C_GetMatchingSetValueActions_003Ed__74(int _003C_003E1__state)1139 {1140 this._003C_003E1__state = _003C_003E1__state;1141 _003C_003El__initialThreadId = Environment.CurrentManagedThreadId;1142 }11431144 [DebuggerHidden]1145 void System.IDisposable.Dispose()1146 {1147 //IL_0035: Unknown result type (might be due to invalid IL or missing references)1148 int num = _003C_003E1__state;1149 if ((uint)(num - -4) <= 1u || num == 1)1150 {1151 try1152 {1153 if (num == -4 || num == 1)1154 {1155 try1156 {1157 }1158 finally1159 {1160 _003C_003Em__Finally2();1161 }1162 }1163 }1164 finally1165 {1166 _003C_003Em__Finally1();1167 }1168 }1169 _003C_003E7__wrap1 = default(Enumerator<ILogicAction>);1170 _003Caction_003E5__3 = null;1171 _003C_003E7__wrap3 = null;1172 _003Cchange_003E5__5 = null;1173 _003C_003E7__wrap5 = null;1174 _003C_003E1__state = -2;1175 }11761177 private bool MoveNext()1178 {1179 //IL_002d: Unknown result type (might be due to invalid IL or missing references)1180 //IL_0032: Unknown result type (might be due to invalid IL or missing references)1181 //IL_01ad: Unknown result type (might be due to invalid IL or missing references)1182 try1183 {1184 int num = _003C_003E1__state;1185 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;1186 if (num != 0)1187 {1188 if (num != 1)1189 {1190 return false;1191 }1192 _003C_003E1__state = -4;1193 goto IL_0141;1194 }1195 _003C_003E1__state = -1;1196 _003C_003E7__wrap1 = stateLessEntityLogic._actions.GetEnumerator();1197 _003C_003E1__state = -3;1198 goto IL_0191;1199 IL_00e2:1200 string[] array = stateLessEntityLogic._GetLocalDependencies(_003Caction_003E5__3);1201 _003C_003E7__wrap5 = array;1202 _003C_003E7__wrap6 = 0;1203 goto IL_014f;1204 IL_0191:1205 do1206 {1207 if (_003C_003E7__wrap1.MoveNext())1208 {1209 _003Caction_003E5__3 = _003C_003E7__wrap1.Current;1210 continue;1211 }1212 _003C_003Em__Finally1();1213 _003C_003E7__wrap1 = default(Enumerator<ILogicAction>);1214 return false;1215 }1216 while (_003Caction_003E5__3.ActionType.Equals(LogicActionType.CheckValue) || _003Caction_003E5__3.ActionType.Equals(LogicActionType.FormatValue) || string.IsNullOrEmpty(_003Caction_003E5__3.Property));1217 _003C_003E7__wrap3 = changes.GetEnumerator();1218 _003C_003E1__state = -4;1219 goto IL_016d;1220 IL_016d:1221 while (((System.Collections.IEnumerator)_003C_003E7__wrap3).MoveNext())1222 {1223 _003Cchange_003E5__5 = _003C_003E7__wrap3.Current;1224 if (!_003Cchange_003E5__5.Type.IsValue())1225 {1226 continue;1227 }1228 goto IL_00e2;1229 }1230 _003C_003Em__Finally2();1231 _003C_003E7__wrap3 = null;1232 _003Caction_003E5__3 = null;1233 goto IL_0191;1234 IL_0141:1235 _003C_003E7__wrap6++;1236 goto IL_014f;1237 IL_014f:1238 if (_003C_003E7__wrap6 < _003C_003E7__wrap5.Length)1239 {1240 if (string.Equals(_003C_003E7__wrap5[_003C_003E7__wrap6], _003Cchange_003E5__5.Name, (StringComparison)5))1241 {1242 _003C_003E2__current = _003Caction_003E5__3;1243 _003C_003E1__state = 1;1244 return true;1245 }1246 goto IL_0141;1247 }1248 _003C_003E7__wrap5 = null;1249 _003Cchange_003E5__5 = null;1250 goto IL_016d;1251 }1252 catch1253 {1254 //try-fault1255 ((System.IDisposable)this).Dispose();1256 throw;1257 }1258 }12591260 bool System.Collections.IEnumerator.MoveNext()1261 {1262 //ILSpy generated this explicit interface implementation from .override directive in MoveNext1263 return this.MoveNext();1264 }12651266 private void _003C_003Em__Finally1()1267 {1268 _003C_003E1__state = -1;1269 ((System.IDisposable)_003C_003E7__wrap1/*cast due to .constrained prefix*/).Dispose();1270 }12711272 private void _003C_003Em__Finally2()1273 {1274 _003C_003E1__state = -3;1275 if (_003C_003E7__wrap3 != null)1276 {1277 ((System.IDisposable)_003C_003E7__wrap3).Dispose();1278 }1279 }12801281 [DebuggerHidden]1282 void System.Collections.IEnumerator.Reset()1283 {1284 //IL_0000: Unknown result type (might be due to invalid IL or missing references)1285 throw new NotSupportedException();1286 }12871288 [DebuggerHidden]1289 System.Collections.Generic.IEnumerator<ILogicAction> System.Collections.Generic.IEnumerable<ILogicAction>.GetEnumerator()1290 {1291 _003C_GetMatchingSetValueActions_003Ed__74 _003C_GetMatchingSetValueActions_003Ed__;1292 if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId)1293 {1294 _003C_003E1__state = 0;1295 _003C_GetMatchingSetValueActions_003Ed__ = this;1296 }1297 else1298 {1299 _003C_GetMatchingSetValueActions_003Ed__ = new _003C_GetMatchingSetValueActions_003Ed__74(0)1300 {1301 _003C_003E4__this = _003C_003E4__this1302 };1303 }1304 _003C_GetMatchingSetValueActions_003Ed__.changes = _003C_003E3__changes;1305 return _003C_GetMatchingSetValueActions_003Ed__;1306 }13071308 [DebuggerHidden]1309 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()1310 {1311 return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable<ILogicAction>)this).GetEnumerator();1312 }1313 }13141315 [StructLayout((LayoutKind)3)]1316 [CompilerGenerated]1317 private struct _003C_GetParameterValuesAsync_003Ed__79 : IAsyncStateMachine1318 {1319 public int _003C_003E1__state;13201321 public AsyncTaskMethodBuilder<object[]> _003C_003Et__builder;13221323 public LogicParameter[] parameters;13241325 public LogicValueStore store;13261327 public CancellationToken cancellationToken;13281329 private object[] _003Cresulting_003E5__2;13301331 private int _003Cpos_003E5__3;13321333 private LogicParameter[] _003C_003E7__wrap3;13341335 private int _003C_003E7__wrap4;13361337 private ValType _003CvalType_003E5__6;13381339 private ConfiguredValueTaskAwaiter<object> _003C_003Eu__1;13401341 private void MoveNext()1342 {1343 //IL_012d: Unknown result type (might be due to invalid IL or missing references)1344 //IL_0132: Unknown result type (might be due to invalid IL or missing references)1345 //IL_013a: Unknown result type (might be due to invalid IL or missing references)1346 //IL_01b8: Unknown result type (might be due to invalid IL or missing references)1347 //IL_01bd: Unknown result type (might be due to invalid IL or missing references)1348 //IL_01c5: Unknown result type (might be due to invalid IL or missing references)1349 //IL_016b: Unknown result type (might be due to invalid IL or missing references)1350 //IL_017a: Unknown result type (might be due to invalid IL or missing references)1351 //IL_017f: Unknown result type (might be due to invalid IL or missing references)1352 //IL_0183: Unknown result type (might be due to invalid IL or missing references)1353 //IL_0188: Unknown result type (might be due to invalid IL or missing references)1354 //IL_00e0: Unknown result type (might be due to invalid IL or missing references)1355 //IL_00ef: Unknown result type (might be due to invalid IL or missing references)1356 //IL_00f4: Unknown result type (might be due to invalid IL or missing references)1357 //IL_00f8: Unknown result type (might be due to invalid IL or missing references)1358 //IL_00fd: Unknown result type (might be due to invalid IL or missing references)1359 //IL_019d: Unknown result type (might be due to invalid IL or missing references)1360 //IL_019f: Unknown result type (might be due to invalid IL or missing references)1361 //IL_0112: Unknown result type (might be due to invalid IL or missing references)1362 //IL_0114: Unknown result type (might be due to invalid IL or missing references)1363 int num = _003C_003E1__state;1364 object[] result;1365 try1366 {1367 ConfiguredValueTaskAwaiter<object> val;1368 if (num == 0)1369 {1370 val = _003C_003Eu__1;1371 _003C_003Eu__1 = default(ConfiguredValueTaskAwaiter<object>);1372 num = (_003C_003E1__state = -1);1373 goto IL_0149;1374 }1375 if (num == 1)1376 {1377 val = _003C_003Eu__1;1378 _003C_003Eu__1 = default(ConfiguredValueTaskAwaiter<object>);1379 num = (_003C_003E1__state = -1);1380 goto IL_01d4;1381 }1382 if (parameters != null && parameters.Length != 0)1383 {1384 _003Cresulting_003E5__2 = new object[parameters.Length];1385 _003Cpos_003E5__3 = 0;1386 _003C_003E7__wrap3 = parameters;1387 _003C_003E7__wrap4 = 0;1388 goto IL_0206;1389 }1390 result = _emptyValues;1391 goto end_IL_0007;1392 IL_01dc:1393 object obj;1394 _003Cresulting_003E5__2[_003Cpos_003E5__3++] = obj;1395 _003C_003E7__wrap4++;1396 goto IL_0206;1397 IL_01d4:1398 obj = val.GetResult();1399 goto IL_01dc;1400 IL_0149:1401 obj = DbVal.ConvertTo(val.GetResult(), _003CvalType_003E5__6);1402 goto IL_01dc;1403 IL_0206:1404 if (_003C_003E7__wrap4 < _003C_003E7__wrap3.Length)1405 {1406 LogicParameter logicParameter = _003C_003E7__wrap3[_003C_003E7__wrap4];1407 if (logicParameter.Type.IsGenericType && logicParameter.Type.GetGenericTypeDefinition() == typeof(AsyncLazy<>))1408 {1409 obj = _GetLazy(store, logicParameter.Definition, logicParameter.Type.GetGenericArguments()[0]);1410 goto IL_01dc;1411 }1412 if (DbVal.TryGetValType(logicParameter.Type, out _003CvalType_003E5__6))1413 {1414 val = store.GetAsync(logicParameter.Definition, cancellationToken).ConfigureAwait(false).GetAwaiter();1415 if (!val.IsCompleted)1416 {1417 num = (_003C_003E1__state = 0);1418 _003C_003Eu__1 = val;1419 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<object>, _003C_GetParameterValuesAsync_003Ed__79>(ref val, ref this);1420 return;1421 }1422 goto IL_0149;1423 }1424 val = store.GetAsync(logicParameter.Definition, cancellationToken).ConfigureAwait(false).GetAwaiter();1425 if (!val.IsCompleted)1426 {1427 num = (_003C_003E1__state = 1);1428 _003C_003Eu__1 = val;1429 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<object>, _003C_GetParameterValuesAsync_003Ed__79>(ref val, ref this);1430 return;1431 }1432 goto IL_01d4;1433 }1434 _003C_003E7__wrap3 = null;1435 result = _003Cresulting_003E5__2;1436 end_IL_0007:;1437 }1438 catch (System.Exception exception)1439 {1440 _003C_003E1__state = -2;1441 _003Cresulting_003E5__2 = null;1442 _003C_003Et__builder.SetException(exception);1443 return;1444 }1445 _003C_003E1__state = -2;1446 _003Cresulting_003E5__2 = null;1447 _003C_003Et__builder.SetResult(result);1448 }14491450 [DebuggerHidden]1451 private void SetStateMachine(IAsyncStateMachine stateMachine)1452 {1453 _003C_003Et__builder.SetStateMachine(stateMachine);1454 }1455 }14561457 [StructLayout((LayoutKind)3)]1458 [CompilerGenerated]1459 private struct _003C_RunActionAsync_003Ed__77 : IAsyncStateMachine1460 {1461 public int _003C_003E1__state;14621463 public AsyncTaskMethodBuilder<TryResult<object>> _003C_003Et__builder;14641465 public ILogicAction action;14661467 public StateLessEntityLogic _003C_003E4__this;14681469 public LogicValueStore store;14701471 public CancellationToken cancellationToken;14721473 private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;14741475 private ConfiguredTaskAwaiter<object[]> _003C_003Eu__2;14761477 private void MoveNext()1478 {1479 //IL_0099: Unknown result type (might be due to invalid IL or missing references)1480 //IL_009e: Unknown result type (might be due to invalid IL or missing references)1481 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)1482 //IL_0129: Unknown result type (might be due to invalid IL or missing references)1483 //IL_012e: Unknown result type (might be due to invalid IL or missing references)1484 //IL_0136: Unknown result type (might be due to invalid IL or missing references)1485 //IL_0050: Unknown result type (might be due to invalid IL or missing references)1486 //IL_005b: Unknown result type (might be due to invalid IL or missing references)1487 //IL_0060: Unknown result type (might be due to invalid IL or missing references)1488 //IL_0064: Unknown result type (might be due to invalid IL or missing references)1489 //IL_0069: Unknown result type (might be due to invalid IL or missing references)1490 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)1491 //IL_00ee: Unknown result type (might be due to invalid IL or missing references)1492 //IL_00f3: Unknown result type (might be due to invalid IL or missing references)1493 //IL_00f7: Unknown result type (might be due to invalid IL or missing references)1494 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)1495 //IL_007e: Unknown result type (might be due to invalid IL or missing references)1496 //IL_0080: Unknown result type (might be due to invalid IL or missing references)1497 //IL_0111: Unknown result type (might be due to invalid IL or missing references)1498 //IL_0113: Unknown result type (might be due to invalid IL or missing references)1499 int num = _003C_003E1__state;1500 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;1501 TryResult<object> result2;1502 try1503 {1504 ConfiguredTaskAwaiter<object[]> val;1505 bool flag;1506 ConfiguredTaskAwaiter<bool> val2;1507 if (num != 0)1508 {1509 if (num == 1)1510 {1511 val = _003C_003Eu__2;1512 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<object[]>);1513 num = (_003C_003E1__state = -1);1514 goto IL_0145;1515 }1516 flag = action.Conditions != null;1517 if (!flag)1518 {1519 goto IL_00c1;1520 }1521 val2 = stateLessEntityLogic._CheckConditionsAsync(action.Conditions, action.InvertConditions, store, cancellationToken).ConfigureAwait(false).GetAwaiter();1522 if (!val2.IsCompleted)1523 {1524 num = (_003C_003E1__state = 0);1525 _003C_003Eu__1 = val2;1526 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003C_RunActionAsync_003Ed__77>(ref val2, ref this);1527 return;1528 }1529 }1530 else1531 {1532 val2 = _003C_003Eu__1;1533 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);1534 num = (_003C_003E1__state = -1);1535 }1536 flag = !val2.GetResult();1537 goto IL_00c1;1538 IL_0145:1539 object[] result = val.GetResult();1540 result2 = TryResult.FromResult(action.Call(result));1541 goto end_IL_000e;1542 IL_00c1:1543 if (!flag)1544 {1545 val = stateLessEntityLogic._GetParameterValuesAsync(action.Parameters, store, cancellationToken).ConfigureAwait(false).GetAwaiter();1546 if (!val.IsCompleted)1547 {1548 num = (_003C_003E1__state = 1);1549 _003C_003Eu__2 = val;1550 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<object[]>, _003C_RunActionAsync_003Ed__77>(ref val, ref this);1551 return;1552 }1553 goto IL_0145;1554 }1555 result2 = TryResult<object>.Failed;1556 end_IL_000e:;1557 }1558 catch (System.Exception exception)1559 {1560 _003C_003E1__state = -2;1561 _003C_003Et__builder.SetException(exception);1562 return;1563 }1564 _003C_003E1__state = -2;1565 _003C_003Et__builder.SetResult(result2);1566 }15671568 [DebuggerHidden]1569 private void SetStateMachine(IAsyncStateMachine stateMachine)1570 {1571 _003C_003Et__builder.SetStateMachine(stateMachine);1572 }1573 }15741575 [StructLayout((LayoutKind)3)]1576 [CompilerGenerated]1577 private struct _003C_RunActionsAsync_003Ed__76 : IAsyncStateMachine1578 {1579 public int _003C_003E1__state;15801581 public AsyncTaskMethodBuilder<Diff> _003C_003Et__builder;15821583 public System.Collections.Generic.IEnumerable<ILogicAction> actions;15841585 public IEntity entity;15861587 public EntityState stateToSet;15881589 public ISession session;15901591 public IIdentityMap identityMap;15921593 public StateLessEntityLogic _003C_003E4__this;15941595 public string logString;15961597 public CancellationToken cancellationToken;15981599 private System.Collections.Generic.IEnumerator<ILogicAction> _003CeActions_003E5__2;16001601 private DiffBuilder _003Cops_003E5__3;16021603 private LogicValueStore _003Cstore_003E5__4;16041605 private LogSessionId _003ClogSessionId_003E5__5;16061607 private System.IDisposable _003C_003E7__wrap5;16081609 private IMetaTable _003Ctable_003E5__7;16101611 private ConfiguredTaskAwaiter<IMetaTable> _003C_003Eu__1;16121613 private ILogicAction _003Caction_003E5__8;16141615 private ConfiguredTaskAwaiter<TryResult<object>> _003C_003Eu__2;16161617 private void MoveNext()1618 {1619 //IL_0178: Unknown result type (might be due to invalid IL or missing references)1620 //IL_017d: Unknown result type (might be due to invalid IL or missing references)1621 //IL_0185: Unknown result type (might be due to invalid IL or missing references)1622 //IL_0380: Unknown result type (might be due to invalid IL or missing references)1623 //IL_0385: Unknown result type (might be due to invalid IL or missing references)1624 //IL_038d: Unknown result type (might be due to invalid IL or missing references)1625 //IL_012f: Unknown result type (might be due to invalid IL or missing references)1626 //IL_013a: Unknown result type (might be due to invalid IL or missing references)1627 //IL_013f: Unknown result type (might be due to invalid IL or missing references)1628 //IL_0143: Unknown result type (might be due to invalid IL or missing references)1629 //IL_0148: Unknown result type (might be due to invalid IL or missing references)1630 //IL_015d: Unknown result type (might be due to invalid IL or missing references)1631 //IL_015f: Unknown result type (might be due to invalid IL or missing references)1632 //IL_0337: Unknown result type (might be due to invalid IL or missing references)1633 //IL_0342: Unknown result type (might be due to invalid IL or missing references)1634 //IL_0347: Unknown result type (might be due to invalid IL or missing references)1635 //IL_034b: Unknown result type (might be due to invalid IL or missing references)1636 //IL_0350: Unknown result type (might be due to invalid IL or missing references)1637 //IL_0365: Unknown result type (might be due to invalid IL or missing references)1638 //IL_0367: Unknown result type (might be due to invalid IL or missing references)1639 int num = _003C_003E1__state;1640 StateLessEntityLogic stateLessEntityLogic = _003C_003E4__this;1641 Diff result;1642 try1643 {1644 if ((uint)num <= 1u)1645 {1646 goto IL_0072;1647 }1648 if (actions == null)1649 {1650 result = Diff.Empty;1651 }1652 else1653 {1654 _003CeActions_003E5__2 = actions.GetEnumerator();1655 if (((System.Collections.IEnumerator)_003CeActions_003E5__2).MoveNext())1656 {1657 entity.State |= stateToSet;1658 goto IL_0072;1659 }1660 ((System.IDisposable)_003CeActions_003E5__2).Dispose();1661 result = Diff.Empty;1662 }1663 goto end_IL_000e;1664 IL_0072:1665 try1666 {1667 if ((uint)num > 1u)1668 {1669 _003Cops_003E5__3 = new DiffBuilder();1670 EntityWalker walker = new EntityWalker(session, entity, identityMap);1671 _003Cstore_003E5__4 = stateLessEntityLogic.CreateStore(session, entity, walker);1672 _003ClogSessionId_003E5__5 = new LogSessionId(session.Id, useMultiLanguage: false);1673 _003C_003E7__wrap5 = (stateLessEntityLogic._log.IsDebugEnabled ? stateLessEntityLogic._log.LogBlock(_003ClogSessionId_003E5__5, LogLevel.Debug, logString, entity.Tablename) : Disposable.Empty);1674 }1675 try1676 {1677 ConfiguredTaskAwaiter<TryResult<object>> val;1678 ConfiguredTaskAwaiter<IMetaTable> val2;1679 if (num != 0)1680 {1681 if (num == 1)1682 {1683 val = _003C_003Eu__2;1684 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<TryResult<object>>);1685 num = (_003C_003E1__state = -1);1686 goto IL_039c;1687 }1688 val2 = session.MetaData().GetTableAsync(entity.Tablename, cancellationToken).ConfigureAwait(false)1689 .GetAwaiter();1690 if (!val2.IsCompleted)1691 {1692 num = (_003C_003E1__state = 0);1693 _003C_003Eu__1 = val2;1694 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IMetaTable>, _003C_RunActionsAsync_003Ed__76>(ref val2, ref this);1695 return;1696 }1697 }1698 else1699 {1700 val2 = _003C_003Eu__1;1701 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IMetaTable>);1702 num = (_003C_003E1__state = -1);1703 }1704 IMetaTable result2 = val2.GetResult();1705 _003Ctable_003E5__7 = result2;1706 goto IL_01a5;1707 IL_01a5:1708 _003Caction_003E5__8 = _003CeActions_003E5__2.Current;1709 if (_003Caction_003E5__8 != null)1710 {1711 if (stateLessEntityLogic._log.IsDebugEnabled)1712 {1713 NLogExtensions.Debug(stateLessEntityLogic._log, _003ClogSessionId_003E5__5, "Action on {0} {1} depends on {2}", _003Caction_003E5__8.Property, _003Caction_003E5__8.ActionType, string.Join(", ", Enumerable.Select<LogicParameter, string>((System.Collections.Generic.IEnumerable<LogicParameter>)_003Caction_003E5__8.Parameters, (Func<LogicParameter, string>)((LogicParameter p) => p.Definition))));1714 }1715 if (!_003Ctable_003E5__7.Columns.TryGetValue(_003Caction_003E5__8.Property, out var value) || value.Enabled)1716 {1717 if (stateLessEntityLogic._log.IsTraceEnabled)1718 {1719 NLogExtensions.Trace(stateLessEntityLogic._log, _003ClogSessionId_003E5__5, $"Running {_003Caction_003E5__8.ActionType} for {_003Caction_003E5__8.Property} in {((MemberInfo)((object)stateLessEntityLogic).GetType()).Name}");1720 }1721 val = stateLessEntityLogic._RunActionAsync(_003Caction_003E5__8, _003Cstore_003E5__4, cancellationToken).ConfigureAwait(false).GetAwaiter();1722 if (!val.IsCompleted)1723 {1724 num = (_003C_003E1__state = 1);1725 _003C_003Eu__2 = val;1726 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<TryResult<object>>, _003C_RunActionsAsync_003Ed__76>(ref val, ref this);1727 return;1728 }1729 goto IL_039c;1730 }1731 if (stateLessEntityLogic._log.IsDebugEnabled)1732 {1733 NLogExtensions.Debug(stateLessEntityLogic._log, _003ClogSessionId_003E5__5, "Column {0} is disabled -> Ignoring action.", _003Caction_003E5__8.Property);1734 }1735 }1736 goto IL_0537;1737 IL_0537:1738 if (((System.Collections.IEnumerator)_003CeActions_003E5__2).MoveNext())1739 {1740 goto IL_01a5;1741 }1742 _003Ctable_003E5__7 = null;1743 goto end_IL_010e;1744 IL_039c:1745 TryResult<object> result3 = val.GetResult();1746 if (!result3.Success)1747 {1748 NLogExtensions.Trace(stateLessEntityLogic._log, _003ClogSessionId_003E5__5, (Func<string>)(() => " ==> Action returns, that the result should be ignored."));1749 }1750 else1751 {1752 object obj = result3.Result;1753 if (_003Caction_003E5__8.ReturnType.IsGenericType && _003Caction_003E5__8.ReturnType.GetGenericTypeDefinition() == typeof(TryResult<>))1754 {1755 PropertyInfo property = _003Caction_003E5__8.ReturnType.GetProperty("Success");1756 if (!(bool)(((property != null) ? property.GetValue(obj) : null) ?? ((object)false)))1757 {1758 goto IL_0537;1759 }1760 PropertyInfo property2 = _003Caction_003E5__8.ReturnType.GetProperty("Result");1761 obj = ((property2 != null) ? property2.GetValue(obj) : null);1762 }1763 if (stateLessEntityLogic._log.IsDebugEnabled)1764 {1765 NLogExtensions.Debug(stateLessEntityLogic._log, _003ClogSessionId_003E5__5, "Result: {0} {1} = {2}", _003Caction_003E5__8.Property, _003Caction_003E5__8.ActionType, obj);1766 }1767 DiffOperation diffOperation = new DiffOperation1768 {1769 Name = _003Caction_003E5__8.Property,1770 Type = _003Caction_003E5__8.ActionType.DiffType,1771 Value = obj1772 };1773 _003Cops_003E5__3.Append(diffOperation);1774 if (diffOperation.Type.IsValue())1775 {1776 _003Cstore_003E5__4.SetValue(diffOperation.Name, diffOperation.Value);1777 }1778 _003Caction_003E5__8 = null;1779 }1780 goto IL_0537;1781 end_IL_010e:;1782 }1783 finally1784 {1785 if (num < 0 && _003C_003E7__wrap5 != null)1786 {1787 _003C_003E7__wrap5.Dispose();1788 }1789 }1790 _003C_003E7__wrap5 = null;1791 result = _003Cops_003E5__3.ToDiff();1792 }1793 finally1794 {1795 if (num < 0)1796 {1797 entity.State &= ~stateToSet;1798 ((System.IDisposable)_003CeActions_003E5__2).Dispose();1799 }1800 }1801 end_IL_000e:;1802 }1803 catch (System.Exception exception)1804 {1805 _003C_003E1__state = -2;1806 _003CeActions_003E5__2 = null;1807 _003C_003Et__builder.SetException(exception);1808 return;1809 }1810 _003C_003E1__state = -2;1811 _003CeActions_003E5__2 = null;1812 _003C_003Et__builder.SetResult(result);1813 }18141815 [DebuggerHidden]1816 private void SetStateMachine(IAsyncStateMachine stateMachine)1817 {1818 _003C_003Et__builder.SetStateMachine(stateMachine);1819 }1820 }18211822 private readonly List<ILogicAction> _actions = new List<ILogicAction>();18231824 private readonly Dictionary<string, ExpensiveFunction> _expensive = new Dictionary<string, ExpensiveFunction>((IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase);18251826 private readonly List<IEntityMethod> _methods = new List<IEntityMethod>();18271828 private readonly List<ExpensiveCheck> _expensiveChecks = new List<ExpensiveCheck>();18291830 private readonly List<ExpensiveFormat> _expensiveFormats = new List<ExpensiveFormat>();18311832 private ILogicCondition[] _conditions;18331834 private readonly List<LogicEventRegistration> _events = new List<LogicEventRegistration>();18351836 private static readonly object[] _emptyValues = new object[0];18371838 private readonly Logger _log = LogManager.GetLogger("ObjectLog");18391840 private static readonly ConcurrentDictionary<System.Type, Func<LogicValueStore, string, object>> _lazyCreatorMethods = new ConcurrentDictionary<System.Type, Func<LogicValueStore, string, object>>();18411842 protected ILogicSection Section => new LogicSection(this);18431844 public override int Priority => 10;18451846 protected bool IsInternalProcess => InternalProcess.IsInternalProcess;18471848 protected StateLessEntityLogic()1849 {1850 RegisterMethod("ExecuteValuesLogic").As(_ExecuteValuesLogic).Behavior(MethodBehavior.AllowMethodCombination);1851 RegisterMethod("ExecuteValueLogic").As<string>(_ExecuteValueLogic).Behavior(MethodBehavior.AllowMethodCombination);1852 }18531854 protected ILogicValueCondition Value(params string[] properties)1855 {1856 return new LogicRegistration(this, properties, LogicActionType.SetValue);1857 }18581859 protected ILogicValueConditions<bool> CanSee(params string[] properties)1860 {1861 return new LogicRegistration<bool, IOptions>(this, properties, LogicActionType.CanSee);1862 }18631864 protected ILogicValueConditionsWithOptions<bool, ICanEditOptions> CanEdit(params string[] properties)1865 {1866 return new LogicRegistration<bool, ICanEditOptions>(this, properties, LogicActionType.CanEdit);1867 }18681869 protected ILogicValueConditions<int> MinLen(params string[] properties)1870 {1871 return new LogicRegistration<int, IOptions>(this, properties, LogicActionType.MinLen);1872 }18731874 protected ILogicValueConditions<int> MaxLen(params string[] properties)1875 {1876 return new LogicRegistration<int, IOptions>(this, properties, LogicActionType.MaxLen);1877 }18781879 protected ILogicCheck<bool> Check(string property)1880 {1881 return new LogicRegistration<bool, IOptions>(this, new string[1] { property }, LogicActionType.CheckValue);1882 }18831884 protected ILogicCheck2<bool> Check(string p1, string p2)1885 {1886 return new CombinedCheckRegistration(this, p1, p2);1887 }18881889 protected ILogicCheck3<bool> Check(string p1, string p2, string p3)1890 {1891 return new CombinedCheckRegistration(this, p1, p2, p3);1892 }18931894 protected ILogicCheck4<bool> Check(string p1, string p2, string p3, string p4)1895 {1896 return new CombinedCheckRegistration(this, p1, p2, p3, p4);1897 }18981899 protected ILogicCheck5<bool> Check(string p1, string p2, string p3, string p4, string p5)1900 {1901 return new CombinedCheckRegistration(this, p1, p2, p3, p4, p5);1902 }19031904 protected ILogicCheckMore Check(params string[] parameters)1905 {1906 return new CombinedCheckRegistration(this, parameters);1907 }19081909 protected ILogicFormat Format(params string[] properties)1910 {1911 return new LogicRegistration(this, properties, LogicActionType.FormatValue);1912 }19131914 protected ILogicExpensive RegisterExpensive(string key)1915 {1916 return new LogicExpensiveRegistration(this, key);1917 }19181919 internal void AddExpensive(string key, ExpensiveFunction function)1920 {1921 //IL_000d: Unknown result type (might be due to invalid IL or missing references)1922 if (string.IsNullOrEmpty(key))1923 {1924 throw new ArgumentNullException("key");1925 }1926 _expensive.Add(key, function);1927 }19281929 protected ILogicMethod RegisterMethod(string key)1930 {1931 return new LogicMethodRegistration(this, key, isFunction: false);1932 }19331934 protected ILogicFunction RegisterFunction(string key)1935 {1936 return new LogicMethodRegistration(this, key, isFunction: true);1937 }19381939 protected internal ILogicMethodOptions RegisterMethod(string key, bool isFunction, System.Delegate method)1940 {1941 IEntityMethod entityMethod = CreateMethod(key, isFunction, method);1942 AddMethod(entityMethod);1943 return new LogicMethodOptionsBuilder(this, (StateLessMethod)entityMethod);1944 }19451946 [EditorBrowsable(/*Could not decode attribute arguments.*/)]1947 protected void AddMethod(IEntityMethod method)1948 {1949 _methods.Add(method);1950 }19511952 [EditorBrowsable(/*Could not decode attribute arguments.*/)]1953 protected virtual IEntityMethod CreateMethod(string key, bool isFunction, System.Delegate method)1954 {1955 return new StateLessMethod(key, isFunction, method);1956 }19571958 public void RadioGroup(string p1, string p2)1959 {1960 Value(p1).From(p2).As<bool, TryResult<bool>>(SwitchFn);1961 Value(p2).From(p1).As<bool, TryResult<bool>>(SwitchFn);1962 [CompilerGenerated]1963 static TryResult<bool> SwitchFn(bool x)1964 {1965 if (!x)1966 {1967 return TryResult<bool>.Failed;1968 }1969 return TryResult.FromResult(value: false);1970 }1971 }19721973 public void RadioGroup(string p1, string p2, string p3)1974 {1975 Value(p1).From(p2, p3).As<bool, bool, TryResult<bool>>(SwitchFn);1976 Value(p2).From(p1, p3).As<bool, bool, TryResult<bool>>(SwitchFn);1977 Value(p3).From(p1, p2).As<bool, bool, TryResult<bool>>(SwitchFn);1978 [CompilerGenerated]1979 static TryResult<bool> SwitchFn(bool x1, bool x2)1980 {1981 if (!(x1 || x2))1982 {1983 return TryResult<bool>.Failed;1984 }1985 return TryResult.FromResult(value: false);1986 }1987 }19881989 public void RadioGroup(string p1, string p2, string p3, string p4)1990 {1991 Value(p1).From(p2, p3, p4).As<bool, bool, bool, TryResult<bool>>(SwitchFn);1992 Value(p2).From(p1, p3, p4).As<bool, bool, bool, TryResult<bool>>(SwitchFn);1993 Value(p3).From(p1, p2, p4).As<bool, bool, bool, TryResult<bool>>(SwitchFn);1994 Value(p4).From(p1, p2, p3).As<bool, bool, bool, TryResult<bool>>(SwitchFn);1995 [CompilerGenerated]1996 static TryResult<bool> SwitchFn(bool x1, bool x2, bool x3)1997 {1998 if (!(x1 || x2 || x3))1999 {2000 return TryResult<bool>.Failed;2001 }2002 return TryResult.FromResult(value: false);2003 }2004 }20052006 public void RadioGroup(string p1, string p2, string p3, string p4, string p5)2007 {2008 Value(p1).From(p2, p3, p4, p5).As<bool, bool, bool, bool, TryResult<bool>>(SwitchFn);2009 Value(p2).From(p1, p3, p4, p5).As<bool, bool, bool, bool, TryResult<bool>>(SwitchFn);2010 Value(p3).From(p1, p2, p4, p5).As<bool, bool, bool, bool, TryResult<bool>>(SwitchFn);2011 Value(p4).From(p1, p2, p3, p5).As<bool, bool, bool, bool, TryResult<bool>>(SwitchFn);2012 Value(p5).From(p1, p2, p3, p4).As<bool, bool, bool, bool, TryResult<bool>>(SwitchFn);2013 [CompilerGenerated]2014 static TryResult<bool> SwitchFn(bool x1, bool x2, bool x3, bool x4)2015 {2016 if (!(x1 || x2 || x3 || x4))2017 {2018 return TryResult<bool>.Failed;2019 }2020 return TryResult.FromResult(value: false);2021 }2022 }20232024 public void PreventLoops(string fkProperty)2025 {2026 Check(fkProperty).AsExpensive<string>((Func<ISession, IEntity, string, CancellationToken, System.Threading.Tasks.Task<bool>>)PreventLoopsFn);2027 [AsyncStateMachine(typeof(_003C_003Ec__DisplayClass40_0._003C_003CPreventLoops_003Eg__PreventLoopsFn_007C0_003Ed))]2028 async System.Threading.Tasks.Task<bool> PreventLoopsFn(ISession s, IEntity e, string v, CancellationToken ct)2029 {2030 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2031 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2032 //IL_002e: Unknown result type (might be due to invalid IL or missing references)2033 //IL_0030: Unknown result type (might be due to invalid IL or missing references)2034 IEntitySource src = s.Source();2035 IMetaTable tbl = await s.MetaData().GetTableAsync(e.Tablename, ct).ConfigureAwait(false);2036 IMetaColumn col = tbl.Columns[fkProperty];2037 string value = v;2038 string key = await e.GetValueAsync<string>(tbl.PrimaryKeyColumns[0].Columnname, ct).ConfigureAwait(false);2039 if (!col.IsFK)2040 {2041 throw new ViException(810026, fkProperty);2042 }2043 IMetaTableRelation metaTableRelation = await col.GetFKRelationAsync(ct).ConfigureAwait(false);2044 if (!string.Equals(tbl.Tablename, metaTableRelation.ParentTableName, (StringComparison)5))2045 {2046 throw new ViException(810288, ExceptionRelevance.Technical, fkProperty, tbl.Tablename);2047 }2048 while (!DbVal.IsEmpty(value, col.Type))2049 {2050 if (string.Equals(key, value, (StringComparison)4))2051 {2052 throw new ViException(810287, ExceptionRelevance.EndUser);2053 }2054 Query query = Query.From(new DbObjectKey(tbl.Tablename, DbVal.ConvertTo<string>(value))).Select(fkProperty);2055 value = await src.GetSingleValueAsync<string>(query, ct).ConfigureAwait(false);2056 }2057 return true;2058 }2059 }20602061 protected ILogicEventValues Event(params string[] events)2062 {2063 return new LogicEventRegistration(this, events);2064 }20652066 internal void Add(ILogicAction action, ILogicCondition[] actionConditions)2067 {2068 ILogicCondition[] array = _CombineConditions(_conditions, actionConditions);2069 if (array != null && array.Length != 0)2070 {2071 action.Conditions = array;2072 _actions.Add(action);2073 if (action.ActionType.Equals(LogicActionType.CanSee) || action.ActionType.Equals(LogicActionType.CanEdit))2074 {2075 _actions.Add((ILogicAction)new SetFixValueLogicAction<bool>(action.ActionType, action.Property, value: true)2076 {2077 Conditions = array,2078 InvertConditions = true2079 });2080 }2081 else if (action.ActionType.Equals(LogicActionType.MinLen))2082 {2083 _actions.Add((ILogicAction)new SetFixValueLogicAction<int>(action.ActionType, action.Property, 0)2084 {2085 Conditions = array,2086 InvertConditions = true2087 });2088 }2089 }2090 else2091 {2092 _actions.Add(action);2093 }2094 }20952096 private static ILogicCondition[] _CombineConditions(ILogicCondition[] a, ILogicCondition[] b)2097 {2098 if ((a == null || a.Length == 0) && (b == null || b.Length == 0))2099 {2100 return null;2101 }2102 if (a == null || a.Length == 0)2103 {2104 return b;2105 }2106 if (b == null || b.Length == 0)2107 {2108 return a;2109 }2110 ILogicCondition[] array = new ILogicCondition[a.Length + b.Length];2111 System.Array.Copy((System.Array)a, (System.Array)array, a.Length);2112 System.Array.Copy((System.Array)b, 0, (System.Array)array, a.Length, b.Length);2113 return array;2114 }21152116 internal ExpensiveCheck AddExpensiveCheck(string property, Func<ISession, IEntity, IEntityWalker, object, CancellationToken, System.Threading.Tasks.Task<bool>> check)2117 {2118 ExpensiveCheck expensiveCheck = new ExpensiveCheck2119 {2120 Property = property,2121 Function = check,2122 Conditions = _conditions2123 };2124 _expensiveChecks.Add(expensiveCheck);2125 return expensiveCheck;2126 }21272128 internal ExpensiveFormat AddExpensiveFormat(string property, Func<ISession, IEntity, IEntityWalker, object, CancellationToken, System.Threading.Tasks.Task<object>> format)2129 {2130 ExpensiveFormat expensiveFormat = new ExpensiveFormat2131 {2132 Property = property,2133 Function = format,2134 Conditions = _conditions2135 };2136 _expensiveFormats.Add(expensiveFormat);2137 return expensiveFormat;2138 }21392140 internal void AddCondition(ILogicCondition condition)2141 {2142 //IL_0008: Unknown result type (might be due to invalid IL or missing references)2143 if (condition == null)2144 {2145 throw new ArgumentNullException("condition");2146 }2147 _conditions = ((_conditions != null) ? _conditions.Append(condition) : new ILogicCondition[1] { condition });2148 }21492150 internal void RemoveCondition(ILogicCondition condition)2151 {2152 //IL_0008: Unknown result type (might be due to invalid IL or missing references)2153 if (condition == null)2154 {2155 throw new ArgumentNullException("condition");2156 }2157 if (_conditions != null)2158 {2159 if (_conditions.Length == 1 && _conditions[0] == condition)2160 {2161 _conditions = null;2162 return;2163 }2164 _conditions = Enumerable.ToArray<ILogicCondition>(Enumerable.Except<ILogicCondition>((System.Collections.Generic.IEnumerable<ILogicCondition>)_conditions, (System.Collections.Generic.IEnumerable<ILogicCondition>)new ILogicCondition[1] { condition }));2165 }2166 }21672168 internal void AddEvent(LogicEventRegistration eventRegistration)2169 {2170 _events.Add(eventRegistration);2171 }21722173 internal System.Collections.Generic.IEnumerable<ILogicAction> GetActions(string name, LogicActionType type)2174 {2175 return Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType == type && StringComparer.OrdinalIgnoreCase.Equals(a.Property, name)));2176 }21772178 internal System.Collections.Generic.IEnumerable<ILogicAction> GetActions(Func<ILogicAction, bool> predicate)2179 {2180 return Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, predicate);2181 }21822183 internal System.Collections.Generic.IEnumerable<ILogicAction> GetActions()2184 {2185 return (System.Collections.Generic.IEnumerable<ILogicAction>)_actions;2186 }21872188 internal IDictionary<string, ExpensiveFunction> GetExpensiveFunctions()2189 {2190 return (IDictionary<string, ExpensiveFunction>)(object)_expensive;2191 }21922193 internal List<ExpensiveCheck> GetExpensiveChecks()2194 {2195 return _expensiveChecks;2196 }21972198 internal List<ExpensiveFormat> GetExpensiveFormats()2199 {2200 return _expensiveFormats;2201 }22022203 public override System.Threading.Tasks.Task<Diff> OnInitializeAsync(IEntity entity, LogicReadOnlyParameters parameters, CancellationToken cancellationToken)2204 {2205 //IL_0071: Unknown result type (might be due to invalid IL or missing references)2206 System.Collections.Generic.IEnumerable<ILogicAction> obj = ((!entity.IsLoaded) ? Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)([CompilerGenerated] (ILogicAction a) => a.ActionType.Equals(LogicActionType.SetValue) && !Enumerable.Any<string>((System.Collections.Generic.IEnumerable<string>)_GetLocalDependencies(a)))) : Enumerable.Empty<ILogicAction>());2207 System.Collections.Generic.IEnumerable<ILogicAction> enumerable = Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType.IsMeta));2208 System.Collections.Generic.IEnumerable<ILogicAction> actions = Enumerable.Concat<ILogicAction>(obj, enumerable);2209 return _RunActionsAsync(parameters.Session, entity, parameters.IdentityMap, actions, "{0}: Initializing Customizer", EntityState.LogicInitialize, cancellationToken);2210 }22112212 public override System.Threading.Tasks.Task<Diff> OnLoadedAsync(IEntity entity, LogicReadOnlyParameters parameters, CancellationToken cancellationToken)2213 {2214 //IL_0044: Unknown result type (might be due to invalid IL or missing references)2215 System.Collections.Generic.IEnumerable<ILogicAction> actions = Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType.IsMeta || (a.ActionType.Equals(LogicActionType.SetValue) && Enumerable.Any<LogicParameter>((System.Collections.Generic.IEnumerable<LogicParameter>)a.Parameters, (Func<LogicParameter, bool>)((LogicParameter p) => string.Equals(p.Definition, "[IsLoaded]", (StringComparison)5))))));2216 return _RunActionsAsync(parameters.Session, entity, parameters.IdentityMap, actions, "Customizer OnLoaded", EntityState.LogicLoaded, cancellationToken);2217 }22182219 public override System.Threading.Tasks.Task<Diff> OnDiscardedAsync(IEntity entity, LogicReadOnlyParameters parameters, CancellationToken cancellationToken)2220 {2221 //IL_0044: Unknown result type (might be due to invalid IL or missing references)2222 System.Collections.Generic.IEnumerable<ILogicAction> actions = Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType.IsMeta));2223 return _RunActionsAsync(parameters.Session, entity, parameters.IdentityMap, actions, "Customizer OnDiscarded", EntityState.LogicDiscarded, cancellationToken);2224 }22252226 [AsyncStateMachine(typeof(_003COnSavedAsync_003Ed__60))]2227 public override System.Threading.Tasks.Task OnSavedAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken)2228 {2229 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2230 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2231 //IL_0026: Unknown result type (might be due to invalid IL or missing references)2232 //IL_0027: Unknown result type (might be due to invalid IL or missing references)2233 _003COnSavedAsync_003Ed__60 _003COnSavedAsync_003Ed__ = default(_003COnSavedAsync_003Ed__60);2234 _003COnSavedAsync_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();2235 _003COnSavedAsync_003Ed__._003C_003E4__this = this;2236 _003COnSavedAsync_003Ed__.entity = entity;2237 _003COnSavedAsync_003Ed__.parameters = parameters;2238 _003COnSavedAsync_003Ed__.cancellationToken = cancellationToken;2239 _003COnSavedAsync_003Ed__._003C_003E1__state = -1;2240 ((AsyncTaskMethodBuilder)(ref _003COnSavedAsync_003Ed__._003C_003Et__builder)).Start<_003COnSavedAsync_003Ed__60>(ref _003COnSavedAsync_003Ed__);2241 return ((AsyncTaskMethodBuilder)(ref _003COnSavedAsync_003Ed__._003C_003Et__builder)).Task;2242 }22432244 public override System.Threading.Tasks.Task<Bow<string>[]> GetLocalDependenciesAsync(IMetaTable table, CancellationToken cancellationToken)2245 {2246 System.Collections.Generic.IEnumerable<Bow<string>> enumerable = Enumerable.SelectMany<ILogicAction, string, Bow<string>>(Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType.IsColumnDependency && !string.IsNullOrEmpty(a.Property) && a.Parameters != null && table.Columns.IsAvailable(a.Property))), (Func<ILogicAction, System.Collections.Generic.IEnumerable<string>>)((ILogicAction a) => Enumerable.Where<string>((System.Collections.Generic.IEnumerable<string>)_GetLocalDependencies(a), (Func<string, bool>)((string p) => table.Columns.IsAvailable(p)))), (Func<ILogicAction, string, Bow<string>>)((ILogicAction a, string p) => new Bow<string>(p, a.Property, Priority + a.ActionType.BowPriority)));2247 System.Collections.Generic.IEnumerable<Bow<string>> enumerable2 = Enumerable.SelectMany<Expensive, string, Bow<string>>(Enumerable.Concat<Expensive>(Enumerable.Cast<Expensive>((System.Collections.IEnumerable)_expensiveChecks), (System.Collections.Generic.IEnumerable<Expensive>)_expensiveFormats), (Func<Expensive, System.Collections.Generic.IEnumerable<string>>)((Expensive e) => Enumerable.Where<string>(e.DependsOn.AvoidNull(), (Func<string, bool>)((string p) => table.Columns.IsAvailable(p)))), (Func<Expensive, string, Bow<string>>)((Expensive e, string p) => new Bow<string>(p, e.Property, Priority)));2248 return System.Threading.Tasks.Task.FromResult<Bow<string>[]>(Enumerable.ToArray<Bow<string>>(Enumerable.Concat<Bow<string>>(enumerable, enumerable2)));2249 }22502251 public override System.Threading.Tasks.Task<LogicFieldInfo[]> GetPotentialMandatoryFieldsAsync(CancellationToken cancellationToken)2252 {2253 return System.Threading.Tasks.Task.FromResult<LogicFieldInfo[]>(Enumerable.ToArray<LogicFieldInfo>(Enumerable.Select<ILogicAction, LogicFieldInfo>(Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType.Equals(LogicActionType.MinLen) && !string.IsNullOrEmpty(a.Property))), (Func<ILogicAction, LogicFieldInfo>)delegate(ILogicAction a)2254 {2255 string property = a.Property;2256 ILogicCondition[] conditions = a.Conditions;2257 string[] whenFlags = ((conditions != null) ? Enumerable.ToArray<string>(Enumerable.Distinct<string>(Enumerable.SelectMany<ILogicCondition, string>((System.Collections.Generic.IEnumerable<ILogicCondition>)conditions, (Func<ILogicCondition, System.Collections.Generic.IEnumerable<string>>)((ILogicCondition c) => c.WhenFlags)), (IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase)) : null);2258 ILogicCondition[] conditions2 = a.Conditions;2259 return new LogicFieldInfo(property, whenFlags, (conditions2 != null) ? Enumerable.ToArray<string>(Enumerable.Distinct<string>(Enumerable.SelectMany<ILogicCondition, string>((System.Collections.Generic.IEnumerable<ILogicCondition>)conditions2, (Func<ILogicCondition, System.Collections.Generic.IEnumerable<string>>)((ILogicCondition c) => c.ExceptFlags)), (IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase)) : null);2260 })));2261 }22622263 public override System.Threading.Tasks.Task<LogicFieldInfo[]> GetPotentialAutoValueFieldsAsync(CancellationToken cancellationToken)2264 {2265 return System.Threading.Tasks.Task.FromResult<LogicFieldInfo[]>(Enumerable.ToArray<LogicFieldInfo>(Enumerable.Select<ILogicAction, LogicFieldInfo>(Enumerable.Where<ILogicAction>((System.Collections.Generic.IEnumerable<ILogicAction>)_actions, (Func<ILogicAction, bool>)((ILogicAction a) => a.ActionType.Equals(LogicActionType.SetValue) && !string.IsNullOrEmpty(a.Property))), (Func<ILogicAction, LogicFieldInfo>)delegate(ILogicAction a)2266 {2267 string property = a.Property;2268 ILogicCondition[] conditions = a.Conditions;2269 string[] whenFlags = ((conditions != null) ? Enumerabl
…