VI.DB/VI.DB.Entities/XMarkedForDeletionEntityLogic.cs
Decompiler Source FileVI.DB.XMarkedForDeletionEntityLogicDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- Method registration: DeleteOutstanding at line 266
Typed Edges
- No typed edges extracted for this source.
References
- No direct source references extracted.
Referenced By
- No direct source references extracted.
C# source-derived context
Generated by pattern extraction from the decompiled C# source and decompile index. This is factual source evidence, not inferred behavior.
reads entity values
Summary: classes XMarkedForDeletionEntityLogic; methods MoveNext, SetStateMachine, OnSavingAsync, _DeleteOutstandingAsync, _CheckManageOutstanding, _CheckValidForDeletion; markers reads entity values
Classes
XMarkedForDeletionEntityLogicMethods
DB/Dialog object references
None extracted.
OIM key/entity markers
None extracted.API/entity calls
GetValue GetOriginalXMarkedForDeletion IsToDelete MarkForDeletionWithoutDelayRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Diagnostics;3using System.Runtime.CompilerServices;4using System.Runtime.InteropServices;5using System.Threading;6using System.Threading.Tasks;7using VI.Base;89namespace VI.DB.Entities;1011internal class XMarkedForDeletionEntityLogic : StateLessEntityLogic12{13 [StructLayout((LayoutKind)3)]14 [CompilerGenerated]15 private struct _003COnSavingAsync_003Ed__1 : IAsyncStateMachine16 {17 public int _003C_003E1__state;1819 public AsyncTaskMethodBuilder<Diff> _003C_003Et__builder;2021 public IEntity entity;2223 public LogicReadWriteParameters parameters;2425 public CancellationToken cancellationToken;2627 public XMarkedForDeletionEntityLogic _003C_003E4__this;2829 private ConfiguredValueTaskAwaiter _003C_003Eu__1;3031 private ConfiguredTaskAwaiter<Diff> _003C_003Eu__2;3233 private void MoveNext()34 {35 //IL_00a8: Unknown result type (might be due to invalid IL or missing references)36 //IL_00ad: Unknown result type (might be due to invalid IL or missing references)37 //IL_00b4: Unknown result type (might be due to invalid IL or missing references)38 //IL_011e: Unknown result type (might be due to invalid IL or missing references)39 //IL_0123: Unknown result type (might be due to invalid IL or missing references)40 //IL_012b: Unknown result type (might be due to invalid IL or missing references)41 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)42 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)43 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)44 //IL_00ec: Unknown result type (might be due to invalid IL or missing references)45 //IL_00f1: Unknown result type (might be due to invalid IL or missing references)46 //IL_0106: Unknown result type (might be due to invalid IL or missing references)47 //IL_0108: Unknown result type (might be due to invalid IL or missing references)48 //IL_005d: Unknown result type (might be due to invalid IL or missing references)49 //IL_006c: Unknown result type (might be due to invalid IL or missing references)50 //IL_0071: Unknown result type (might be due to invalid IL or missing references)51 //IL_0075: Unknown result type (might be due to invalid IL or missing references)52 //IL_007a: Unknown result type (might be due to invalid IL or missing references)53 //IL_008e: Unknown result type (might be due to invalid IL or missing references)54 //IL_008f: Unknown result type (might be due to invalid IL or missing references)55 int num = _003C_003E1__state;56 XMarkedForDeletionEntityLogic xMarkedForDeletionEntityLogic = _003C_003E4__this;57 Diff result;58 try59 {60 ConfiguredTaskAwaiter<Diff> val;61 ConfiguredValueTaskAwaiter val3;62 if (num != 0)63 {64 if (num == 1)65 {66 val = _003C_003Eu__2;67 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<Diff>);68 num = (_003C_003E1__state = -1);69 goto IL_013a;70 }71 if (!entity.GetOriginalXMarkedForDeletion().HasFlagFast(XMarkedForDeletion.Outstanding) || (!entity.IsToDelete() && entity.State.HasFlagFast(EntityState.OutStanding)))72 {73 goto IL_00ca;74 }75 ConfiguredValueTaskAwaitable val2 = _CheckManageOutstanding(parameters.Session, cancellationToken).ConfigureAwait(false);76 val3 = ((ConfiguredValueTaskAwaitable)(ref val2)).GetAwaiter();77 if (!((ConfiguredValueTaskAwaiter)(ref val3)).IsCompleted)78 {79 num = (_003C_003E1__state = 0);80 _003C_003Eu__1 = val3;81 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, _003COnSavingAsync_003Ed__1>(ref val3, ref this);82 return;83 }84 }85 else86 {87 val3 = _003C_003Eu__1;88 _003C_003Eu__1 = default(ConfiguredValueTaskAwaiter);89 num = (_003C_003E1__state = -1);90 }91 ((ConfiguredValueTaskAwaiter)(ref val3)).GetResult();92 goto IL_00ca;93 IL_00ca:94 val = ((EntityLogicBase)xMarkedForDeletionEntityLogic).OnSavingAsync(entity, parameters, cancellationToken).ConfigureAwait(false).GetAwaiter();95 if (!val.IsCompleted)96 {97 num = (_003C_003E1__state = 1);98 _003C_003Eu__2 = val;99 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Diff>, _003COnSavingAsync_003Ed__1>(ref val, ref this);100 return;101 }102 goto IL_013a;103 IL_013a:104 result = val.GetResult();105 }106 catch (System.Exception exception)107 {108 _003C_003E1__state = -2;109 _003C_003Et__builder.SetException(exception);110 return;111 }112 _003C_003E1__state = -2;113 _003C_003Et__builder.SetResult(result);114 }115116 [DebuggerHidden]117 private void SetStateMachine(IAsyncStateMachine stateMachine)118 {119 _003C_003Et__builder.SetStateMachine(stateMachine);120 }121 }122123 [StructLayout((LayoutKind)3)]124 [CompilerGenerated]125 private struct _003C_CheckManageOutstanding_003Ed__3 : IAsyncStateMachine126 {127 public int _003C_003E1__state;128129 public AsyncValueTaskMethodBuilder _003C_003Et__builder;130131 public ISession session;132133 public CancellationToken ct;134135 private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;136137 private void MoveNext()138 {139 //IL_0063: Unknown result type (might be due to invalid IL or missing references)140 //IL_0068: Unknown result type (might be due to invalid IL or missing references)141 //IL_006f: Unknown result type (might be due to invalid IL or missing references)142 //IL_0020: Unknown result type (might be due to invalid IL or missing references)143 //IL_002b: Unknown result type (might be due to invalid IL or missing references)144 //IL_0030: Unknown result type (might be due to invalid IL or missing references)145 //IL_0033: Unknown result type (might be due to invalid IL or missing references)146 //IL_0038: Unknown result type (might be due to invalid IL or missing references)147 //IL_004c: Unknown result type (might be due to invalid IL or missing references)148 //IL_004d: Unknown result type (might be due to invalid IL or missing references)149 int num = _003C_003E1__state;150 try151 {152 ConfiguredTaskAwaiter<bool> val;153 if (num != 0)154 {155 val = session.Principal.Features.IsAllowedAsync("Common_ManageOutstanding", ct).ConfigureAwait(false).GetAwaiter();156 if (!val.IsCompleted)157 {158 num = (_003C_003E1__state = 0);159 _003C_003Eu__1 = val;160 ((AsyncValueTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003C_CheckManageOutstanding_003Ed__3>(ref val, ref this);161 return;162 }163 }164 else165 {166 val = _003C_003Eu__1;167 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);168 num = (_003C_003E1__state = -1);169 }170 if (!val.GetResult())171 {172 throw new ViException(810323, ExceptionRelevance.EndUser);173 }174 }175 catch (System.Exception exception)176 {177 _003C_003E1__state = -2;178 ((AsyncValueTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);179 return;180 }181 _003C_003E1__state = -2;182 ((AsyncValueTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();183 }184185 [DebuggerHidden]186 private void SetStateMachine(IAsyncStateMachine stateMachine)187 {188 ((AsyncValueTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);189 }190 }191192 [StructLayout((LayoutKind)3)]193 [CompilerGenerated]194 private struct _003C_DeleteOutstandingAsync_003Ed__2 : IAsyncStateMachine195 {196 public int _003C_003E1__state;197198 public AsyncTaskMethodBuilder _003C_003Et__builder;199200 public ISession session;201202 public CancellationToken ct;203204 public IEntity entity;205206 private ConfiguredValueTaskAwaiter _003C_003Eu__1;207208 private void MoveNext()209 {210 //IL_0057: Unknown result type (might be due to invalid IL or missing references)211 //IL_005c: Unknown result type (might be due to invalid IL or missing references)212 //IL_0063: Unknown result type (might be due to invalid IL or missing references)213 //IL_0011: Unknown result type (might be due to invalid IL or missing references)214 //IL_001f: Unknown result type (might be due to invalid IL or missing references)215 //IL_0024: Unknown result type (might be due to invalid IL or missing references)216 //IL_0027: Unknown result type (might be due to invalid IL or missing references)217 //IL_002c: Unknown result type (might be due to invalid IL or missing references)218 //IL_0040: Unknown result type (might be due to invalid IL or missing references)219 //IL_0041: Unknown result type (might be due to invalid IL or missing references)220 int num = _003C_003E1__state;221 try222 {223 ConfiguredValueTaskAwaiter val2;224 if (num != 0)225 {226 ConfiguredValueTaskAwaitable val = _CheckManageOutstanding(session, ct).ConfigureAwait(false);227 val2 = ((ConfiguredValueTaskAwaitable)(ref val)).GetAwaiter();228 if (!((ConfiguredValueTaskAwaiter)(ref val2)).IsCompleted)229 {230 num = (_003C_003E1__state = 0);231 _003C_003Eu__1 = val2;232 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, _003C_DeleteOutstandingAsync_003Ed__2>(ref val2, ref this);233 return;234 }235 }236 else237 {238 val2 = _003C_003Eu__1;239 _003C_003Eu__1 = default(ConfiguredValueTaskAwaiter);240 num = (_003C_003E1__state = -1);241 }242 ((ConfiguredValueTaskAwaiter)(ref val2)).GetResult();243 _CheckValidForDeletion(entity);244 entity.State &= ~EntityState.OutStanding;245 entity.MarkForDeletionWithoutDelay();246 }247 catch (System.Exception exception)248 {249 _003C_003E1__state = -2;250 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);251 return;252 }253 _003C_003E1__state = -2;254 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();255 }256257 [DebuggerHidden]258 private void SetStateMachine(IAsyncStateMachine stateMachine)259 {260 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);261 }262 }263264 public XMarkedForDeletionEntityLogic()265 {266 RegisterMethod("DeleteOutstanding").As(_DeleteOutstandingAsync).NeedsSaving();267 }268269 [AsyncStateMachine(typeof(_003COnSavingAsync_003Ed__1))]270 public override async System.Threading.Tasks.Task<Diff> OnSavingAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken)271 {272 //IL_0002: Unknown result type (might be due to invalid IL or missing references)273 //IL_0007: Unknown result type (might be due to invalid IL or missing references)274 //IL_0026: Unknown result type (might be due to invalid IL or missing references)275 //IL_0027: Unknown result type (might be due to invalid IL or missing references)276 if (entity.GetOriginalXMarkedForDeletion().HasFlagFast(XMarkedForDeletion.Outstanding) && (entity.IsToDelete() || !entity.State.HasFlagFast(EntityState.OutStanding)))277 {278 await _CheckManageOutstanding(parameters.Session, cancellationToken).ConfigureAwait(false);279 }280 return await base.OnSavingAsync(entity, parameters, cancellationToken).ConfigureAwait(false);281 }282283 [AsyncStateMachine(typeof(_003C_DeleteOutstandingAsync_003Ed__2))]284 private System.Threading.Tasks.Task _DeleteOutstandingAsync(ISession session, IEntity entity, CancellationToken ct)285 {286 //IL_0002: Unknown result type (might be due to invalid IL or missing references)287 //IL_0007: Unknown result type (might be due to invalid IL or missing references)288 //IL_001e: Unknown result type (might be due to invalid IL or missing references)289 //IL_001f: Unknown result type (might be due to invalid IL or missing references)290 _003C_DeleteOutstandingAsync_003Ed__2 _003C_DeleteOutstandingAsync_003Ed__ = default(_003C_DeleteOutstandingAsync_003Ed__2);291 _003C_DeleteOutstandingAsync_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();292 _003C_DeleteOutstandingAsync_003Ed__.session = session;293 _003C_DeleteOutstandingAsync_003Ed__.entity = entity;294 _003C_DeleteOutstandingAsync_003Ed__.ct = ct;295 _003C_DeleteOutstandingAsync_003Ed__._003C_003E1__state = -1;296 ((AsyncTaskMethodBuilder)(ref _003C_DeleteOutstandingAsync_003Ed__._003C_003Et__builder)).Start<_003C_DeleteOutstandingAsync_003Ed__2>(ref _003C_DeleteOutstandingAsync_003Ed__);297 return ((AsyncTaskMethodBuilder)(ref _003C_DeleteOutstandingAsync_003Ed__._003C_003Et__builder)).Task;298 }299300 [AsyncStateMachine(typeof(_003C_CheckManageOutstanding_003Ed__3))]301 private static System.Threading.Tasks.ValueTask _CheckManageOutstanding(ISession session, CancellationToken ct)302 {303 //IL_0002: Unknown result type (might be due to invalid IL or missing references)304 //IL_0007: Unknown result type (might be due to invalid IL or missing references)305 //IL_0016: Unknown result type (might be due to invalid IL or missing references)306 //IL_0017: Unknown result type (might be due to invalid IL or missing references)307 _003C_CheckManageOutstanding_003Ed__3 _003C_CheckManageOutstanding_003Ed__ = default(_003C_CheckManageOutstanding_003Ed__3);308 _003C_CheckManageOutstanding_003Ed__._003C_003Et__builder = AsyncValueTaskMethodBuilder.Create();309 _003C_CheckManageOutstanding_003Ed__.session = session;310 _003C_CheckManageOutstanding_003Ed__.ct = ct;311 _003C_CheckManageOutstanding_003Ed__._003C_003E1__state = -1;312 ((AsyncValueTaskMethodBuilder)(ref _003C_CheckManageOutstanding_003Ed__._003C_003Et__builder)).Start<_003C_CheckManageOutstanding_003Ed__3>(ref _003C_CheckManageOutstanding_003Ed__);313 return ((AsyncValueTaskMethodBuilder)(ref _003C_CheckManageOutstanding_003Ed__._003C_003Et__builder)).Task;314 }315316 private static void _CheckValidForDeletion(IEntity entity)317 {318 if (entity.State.HasFlagFast(EntityState.OutStanding) || (entity.Columns.TryGetValue("xisineffect", out var value) && !value.GetValue<bool>()) || (entity.Columns.TryGetValue("xorigin", out value) && value.GetValue<int>() == 0))319 {320 return;321 }322 throw new ViException(810328, ExceptionRelevance.EndUser, entity.Display);323 }324}325