QER.Customizer/QER.Customizer/WorkingCopyEntityLogic.cs
Decompiler Source FileQER.Customizer.WorkingCopyEntityLogicDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- ExtendedMethod registration: MakeWorkingCopy at line 1885
- Method registration: ActivateWorkingCopy at line 1893
- Function registration: Copy at line 1900
- Method registration: Enable at line 1904
- Method registration: Disable at line 1910
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 writes entity values
Summary: classes WorkingCopyEntityLogic, _003C_003Ec__DisplayClass19_0, _003C_003Ec__DisplayClass23_0, _003C_003Ec__DisplayClass7_0; methods _003CCopyCR_003Eb__0, _003CCopyMN_003Eb__0, _003CCopyMN_003Eb__1, _003CCopyMN_003Eb__2, _003CActivateWorkingCopy_003Eb__0, MoveNext; markers reads entity values, writes entity values
Classes
WorkingCopyEntityLogic _003C_003Ec__DisplayClass19_0 _003C_003Ec__DisplayClass23_0 _003C_003Ec__DisplayClass7_0Methods
- _003CCopyCR_003Eb__0
- _003CCopyMN_003Eb__0
- _003CCopyMN_003Eb__1
- _003CCopyMN_003Eb__2
- _003CActivateWorkingCopy_003Eb__0
- MoveNext
- SetStateMachine
- OnSavedAsync
- MakeWorkingCopy
- MakeWorkingCopy_OnSaving
- OnWorkingCopySaving
- OnWorkingCopySaved
- ActivateWorkingCopy
- OnActiveCopySaved
- OnActiveCopySaving
- OnCopySaved
- OnCopySaving
- Copy
- Enable
- Disable
- GetEditFlags
- OnDeleteWorkingCopy
- CheckEditFlags
- CheckEditFlag
- CopyCR
- CopyCRObject
- OnRelationObjectSaved
- OnRelationObjectSaving
- CopyMN
DB/Dialog object references
None extracted.
OIM key/entity markers
None extracted.API/entity calls
GetValue TryResult PutValue Create StartUnitOfWork CreateWalker GetValue From Source MetaData GetObjectKey SetValue Database IsDeletedRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Diagnostics;5using System.Linq;6using System.Runtime.CompilerServices;7using System.Runtime.InteropServices;8using System.Threading;9using System.Threading.Tasks;10using VI.Base;11using VI.DB;12using VI.DB.Entities;13using VI.DB.MetaData;1415namespace QER.Customizer;1617public abstract class WorkingCopyEntityLogic<T> : StateBasedEntityLogic where T : struct, IComparable, IConvertible, System.IFormattable18{19 [CompilerGenerated]20 private sealed class _003C_003Ec__DisplayClass19_021 {22 public IMetaTableRelation crRelation;2324 public IEntity eSource;2526 internal ExpressionClause _003CCopyCR_003Eb__0(IExpressionContext c)27 {28 return c.Column(crRelation.ChildColumnName) == eSource.GetValue(crRelation.ParentColumnName).String;29 }30 }3132 [CompilerGenerated]33 private sealed class _003C_003Ec__DisplayClass23_034 {35 public IMetaTableRelation mnRelation;3637 public IEntity eSource;3839 public IEntity eDestination;4041 public IMetaTable mTable;4243 internal ExpressionClause _003CCopyMN_003Eb__0(IExpressionContext c)44 {45 return c.Column(mnRelation.ChildColumnName) == eSource.GetValue<string>(mnRelation.ParentColumnName);46 }4748 internal ExpressionClause _003CCopyMN_003Eb__1(IExpressionContext c)49 {50 return c.Column(mnRelation.ChildColumnName) == eDestination.GetValue<string>(mnRelation.ParentColumnName);51 }5253 internal DbObjectKey _003CCopyMN_003Eb__2(IEntity e)54 {55 return DbObjectKey.Create(mTable, e);56 }57 }5859 [CompilerGenerated]60 private sealed class _003C_003Ec__DisplayClass7_061 {62 public WorkingCopyEntityLogic<T> _003C_003E4__this;6364 public LogicParameter lp;6566 public IMetaTable mTable;6768 internal ExpressionClause _003CActivateWorkingCopy_003Eb__0(IExpressionContext c)69 {70 return c.Column(_003C_003E4__this._wcParams.FKWorkColumn) == lp.Entity.GetValue<string>(mTable.PrimaryKeyColumns[0].Columnname);71 }72 }7374 [StructLayout((LayoutKind)3)]75 [CompilerGenerated]76 private struct _003CActivateWorkingCopy_003Ed__7 : IAsyncStateMachine77 {78 public int _003C_003E1__state;7980 public AsyncTaskMethodBuilder _003C_003Et__builder;8182 public WorkingCopyEntityLogic<T> _003C_003E4__this;8384 public ISession session;8586 public IEntity entity;8788 public CancellationToken ct;8990 private _003C_003Ec__DisplayClass7_0 _003C_003E8__1;9192 public bool bEnable;9394 private IUnitOfWork _003CuoWork_003E5__2;9596 private IEntity _003CeActive_003E5__3;9798 private ConfiguredTaskAwaiter<TryResult<IEntity>> _003C_003Eu__1;99100 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__2;101102 private System.IDisposable _003C_003E7__wrap3;103104 private ConfiguredTaskAwaiter _003C_003Eu__3;105106 private void MoveNext()107 {108 //IL_016f: Unknown result type (might be due to invalid IL or missing references)109 //IL_0174: Unknown result type (might be due to invalid IL or missing references)110 //IL_017c: Unknown result type (might be due to invalid IL or missing references)111 //IL_0222: Unknown result type (might be due to invalid IL or missing references)112 //IL_0227: Unknown result type (might be due to invalid IL or missing references)113 //IL_022f: Unknown result type (might be due to invalid IL or missing references)114 //IL_008b: Unknown result type (might be due to invalid IL or missing references)115 //IL_0126: Unknown result type (might be due to invalid IL or missing references)116 //IL_0131: Unknown result type (might be due to invalid IL or missing references)117 //IL_0136: Unknown result type (might be due to invalid IL or missing references)118 //IL_013a: Unknown result type (might be due to invalid IL or missing references)119 //IL_013f: Unknown result type (might be due to invalid IL or missing references)120 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)121 //IL_01e4: Unknown result type (might be due to invalid IL or missing references)122 //IL_01e9: Unknown result type (might be due to invalid IL or missing references)123 //IL_01ed: Unknown result type (might be due to invalid IL or missing references)124 //IL_01f2: Unknown result type (might be due to invalid IL or missing references)125 //IL_03fe: Unknown result type (might be due to invalid IL or missing references)126 //IL_0403: Unknown result type (might be due to invalid IL or missing references)127 //IL_040b: Unknown result type (might be due to invalid IL or missing references)128 //IL_0481: Unknown result type (might be due to invalid IL or missing references)129 //IL_0486: Unknown result type (might be due to invalid IL or missing references)130 //IL_048e: Unknown result type (might be due to invalid IL or missing references)131 //IL_04fa: Unknown result type (might be due to invalid IL or missing references)132 //IL_04ff: Unknown result type (might be due to invalid IL or missing references)133 //IL_0507: Unknown result type (might be due to invalid IL or missing references)134 //IL_056d: Unknown result type (might be due to invalid IL or missing references)135 //IL_0572: Unknown result type (might be due to invalid IL or missing references)136 //IL_057a: Unknown result type (might be due to invalid IL or missing references)137 //IL_03c0: Unknown result type (might be due to invalid IL or missing references)138 //IL_03c5: Unknown result type (might be due to invalid IL or missing references)139 //IL_03c9: Unknown result type (might be due to invalid IL or missing references)140 //IL_03ce: Unknown result type (might be due to invalid IL or missing references)141 //IL_0154: Unknown result type (might be due to invalid IL or missing references)142 //IL_0156: Unknown result type (might be due to invalid IL or missing references)143 //IL_0207: Unknown result type (might be due to invalid IL or missing references)144 //IL_0209: Unknown result type (might be due to invalid IL or missing references)145 //IL_0438: Unknown result type (might be due to invalid IL or missing references)146 //IL_0443: Unknown result type (might be due to invalid IL or missing references)147 //IL_0448: Unknown result type (might be due to invalid IL or missing references)148 //IL_044c: Unknown result type (might be due to invalid IL or missing references)149 //IL_0451: Unknown result type (might be due to invalid IL or missing references)150 //IL_04bc: Unknown result type (might be due to invalid IL or missing references)151 //IL_04c1: Unknown result type (might be due to invalid IL or missing references)152 //IL_04c5: Unknown result type (might be due to invalid IL or missing references)153 //IL_04ca: Unknown result type (might be due to invalid IL or missing references)154 //IL_0524: Unknown result type (might be due to invalid IL or missing references)155 //IL_052f: Unknown result type (might be due to invalid IL or missing references)156 //IL_0534: Unknown result type (might be due to invalid IL or missing references)157 //IL_0538: Unknown result type (might be due to invalid IL or missing references)158 //IL_053d: Unknown result type (might be due to invalid IL or missing references)159 //IL_03e3: Unknown result type (might be due to invalid IL or missing references)160 //IL_03e5: Unknown result type (might be due to invalid IL or missing references)161 //IL_0466: Unknown result type (might be due to invalid IL or missing references)162 //IL_0468: Unknown result type (might be due to invalid IL or missing references)163 //IL_04df: Unknown result type (might be due to invalid IL or missing references)164 //IL_04e1: Unknown result type (might be due to invalid IL or missing references)165 //IL_0552: Unknown result type (might be due to invalid IL or missing references)166 //IL_0554: Unknown result type (might be due to invalid IL or missing references)167 int num = _003C_003E1__state;168 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;169 try170 {171 if ((uint)num > 5u)172 {173 _003C_003E8__1 = new _003C_003Ec__DisplayClass7_0();174 _003C_003E8__1._003C_003E4__this = _003C_003E4__this;175 _003CuoWork_003E5__2 = session.StartUnitOfWork();176 }177 try178 {179 ConfiguredTaskAwaiter<TryResult<IEntity>> val2;180 ConfiguredTaskAwaiter<IEntity> val;181 TryResult<IEntity> result;182 IEntity result2;183 PropertyBag propertyBag = default(PropertyBag);184 switch (num)185 {186 default:187 {188 _003C_003E8__1.lp = new LogicParameter(session, null, entity, _003CuoWork_003E5__2, entity.CreateWalker(session), ct);189 if (!entity.GetValue("IsWorkingCopy").Bool)190 {191 throw new ViException(2127282, ExceptionRelevance.EndUser);192 }193 _003C_003E8__1.mTable = workingCopyEntityLogic._wcParams.Table;194 Query query = (from c in Query.From(_003C_003E8__1.mTable.Tablename)195 where c.Column(_003C_003E8__1._003C_003E4__this._wcParams.FKWorkColumn) == _003C_003E8__1.lp.Entity.GetValue<string>(_003C_003E8__1.mTable.PrimaryKeyColumns[0].Columnname)196 select c).SelectNonLobs();197 val2 = _003C_003E8__1.lp.Session.Source().TryGetAsync(query, EntityLoadType.DelayedLogic, _003C_003E8__1.lp.CancellationToken).ConfigureAwait(false)198 .GetAwaiter();199 if (!val2.IsCompleted)200 {201 num = (_003C_003E1__state = 0);202 _003C_003Eu__1 = val2;203 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<TryResult<IEntity>>, _003CActivateWorkingCopy_003Ed__7>(ref val2, ref this);204 return;205 }206 goto IL_018b;207 }208 case 0:209 val2 = _003C_003Eu__1;210 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<TryResult<IEntity>>);211 num = (_003C_003E1__state = -1);212 goto IL_018b;213 case 1:214 val = _003C_003Eu__2;215 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<IEntity>);216 num = (_003C_003E1__state = -1);217 goto IL_023e;218 case 2:219 case 3:220 case 4:221 case 5:222 break;223 IL_018b:224 result = val2.GetResult();225 if (result.Success)226 {227 result2 = result.Result;228 goto IL_0247;229 }230 val = _003C_003E8__1.lp.Session.Source().CreateNewAsync(_003C_003E8__1.mTable.Tablename, EntityCreationType.Interactive, _003C_003E8__1.lp.CancellationToken).ConfigureAwait(false)231 .GetAwaiter();232 if (!val.IsCompleted)233 {234 num = (_003C_003E1__state = 1);235 _003C_003Eu__2 = val;236 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CActivateWorkingCopy_003Ed__7>(ref val, ref this);237 return;238 }239 goto IL_023e;240 IL_0247:241 _003CeActive_003E5__3 = result2;242 propertyBag = new PropertyBag();243 if (!workingCopyEntityLogic._wcParams.ExcludeColumns.Contains("IsWorkingCopy"))244 {245 workingCopyEntityLogic._wcParams.ExcludeColumns.Add("isworkingcopy");246 }247 if (!workingCopyEntityLogic._wcParams.ExcludeColumns.Contains("IsInactive"))248 {249 workingCopyEntityLogic._wcParams.ExcludeColumns.Add("isinactive");250 }251 propertyBag.FillFromEntity(_003C_003E8__1.mTable, _003C_003E8__1.lp.Entity, (System.Collections.Generic.IEnumerable<string>)workingCopyEntityLogic._wcParams.ExcludeColumns);252 propertyBag.PutValue(workingCopyEntityLogic._wcParams.FKWorkColumn, _003C_003E8__1.lp.Entity.GetValue(_003C_003E8__1.mTable.PrimaryKeyColumns[0].Columnname));253 propertyBag.PutValue("IsWorkingCopy", false);254 if (bEnable && _003C_003E8__1.mTable.Columns.Contains("IsInactive"))255 {256 propertyBag.PutValue("IsInactive", false);257 }258 _003C_003E7__wrap3 = workingCopyEntityLogic.StartInternalProcess();259 break;260 IL_023e:261 result2 = val.GetResult();262 goto IL_0247;263 }264 try265 {266 ConfiguredTaskAwaitable val4;267 ConfiguredTaskAwaiter val3;268 switch (num)269 {270 default:271 propertyBag.ChangeEntity(_003C_003E8__1.lp.Session, _003CeActive_003E5__3, overwriteValues: true);272 val4 = workingCopyEntityLogic.OnActiveCopySaving(_003CeActive_003E5__3, _003C_003E8__1.lp).ConfigureAwait(false);273 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();274 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)275 {276 num = (_003C_003E1__state = 2);277 _003C_003Eu__3 = val3;278 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CActivateWorkingCopy_003Ed__7>(ref val3, ref this);279 return;280 }281 goto IL_041a;282 case 2:283 val3 = _003C_003Eu__3;284 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);285 num = (_003C_003E1__state = -1);286 goto IL_041a;287 case 3:288 val3 = _003C_003Eu__3;289 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);290 num = (_003C_003E1__state = -1);291 goto IL_049d;292 case 4:293 val3 = _003C_003Eu__3;294 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);295 num = (_003C_003E1__state = -1);296 goto IL_0516;297 case 5:298 {299 val3 = _003C_003Eu__3;300 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);301 num = (_003C_003E1__state = -1);302 break;303 }304 IL_049d:305 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();306 val4 = workingCopyEntityLogic.OnActiveCopySaved(_003CeActive_003E5__3, _003C_003E8__1.lp).ConfigureAwait(false);307 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();308 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)309 {310 num = (_003C_003E1__state = 4);311 _003C_003Eu__3 = val3;312 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CActivateWorkingCopy_003Ed__7>(ref val3, ref this);313 return;314 }315 goto IL_0516;316 IL_041a:317 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();318 val4 = _003CuoWork_003E5__2.PutAsync(_003CeActive_003E5__3, _003C_003E8__1.lp.CancellationToken).ConfigureAwait(false);319 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();320 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)321 {322 num = (_003C_003E1__state = 3);323 _003C_003Eu__3 = val3;324 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CActivateWorkingCopy_003Ed__7>(ref val3, ref this);325 return;326 }327 goto IL_049d;328 IL_0516:329 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();330 val4 = _003CuoWork_003E5__2.CommitAsync(ct).ConfigureAwait(false);331 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();332 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)333 {334 num = (_003C_003E1__state = 5);335 _003C_003Eu__3 = val3;336 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CActivateWorkingCopy_003Ed__7>(ref val3, ref this);337 return;338 }339 break;340 }341 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();342 }343 finally344 {345 if (num < 0 && _003C_003E7__wrap3 != null)346 {347 _003C_003E7__wrap3.Dispose();348 }349 }350 _003C_003E7__wrap3 = null;351 _003CeActive_003E5__3 = null;352 }353 finally354 {355 if (num < 0 && _003CuoWork_003E5__2 != null)356 {357 ((System.IDisposable)_003CuoWork_003E5__2).Dispose();358 }359 }360 _003CuoWork_003E5__2 = null;361 }362 catch (System.Exception exception)363 {364 _003C_003E1__state = -2;365 _003C_003E8__1 = null;366 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);367 return;368 }369 _003C_003E1__state = -2;370 _003C_003E8__1 = null;371 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();372 }373374 [DebuggerHidden]375 private void SetStateMachine(IAsyncStateMachine stateMachine)376 {377 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);378 }379 }380381 [StructLayout((LayoutKind)3)]382 [CompilerGenerated]383 private struct _003CCopy_003Ed__12 : IAsyncStateMachine384 {385 public int _003C_003E1__state;386387 public AsyncTaskMethodBuilder<DbObjectKey> _003C_003Et__builder;388389 public ISession session;390391 public IEntity entity;392393 public CancellationToken ct;394395 public WorkingCopyEntityLogic<T> _003C_003E4__this;396397 public Dictionary<string, object> values;398399 private IUnitOfWork _003CuoWork_003E5__2;400401 private LogicParameter _003Clp_003E5__3;402403 private IMetaTable _003CmTable_003E5__4;404405 private IEntity _003CeCopy_003E5__5;406407 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__1;408409 private System.IDisposable _003C_003E7__wrap5;410411 private ConfiguredTaskAwaiter _003C_003Eu__2;412413 private void MoveNext()414 {415 //IL_00e6: Unknown result type (might be due to invalid IL or missing references)416 //IL_00eb: Unknown result type (might be due to invalid IL or missing references)417 //IL_00f3: Unknown result type (might be due to invalid IL or missing references)418 //IL_005b: Unknown result type (might be due to invalid IL or missing references)419 //IL_009d: Unknown result type (might be due to invalid IL or missing references)420 //IL_00a8: Unknown result type (might be due to invalid IL or missing references)421 //IL_00ad: Unknown result type (might be due to invalid IL or missing references)422 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)423 //IL_00b6: Unknown result type (might be due to invalid IL or missing references)424 //IL_00cb: Unknown result type (might be due to invalid IL or missing references)425 //IL_00cd: Unknown result type (might be due to invalid IL or missing references)426 //IL_02f3: Unknown result type (might be due to invalid IL or missing references)427 //IL_02f8: Unknown result type (might be due to invalid IL or missing references)428 //IL_0300: Unknown result type (might be due to invalid IL or missing references)429 //IL_0371: Unknown result type (might be due to invalid IL or missing references)430 //IL_0376: Unknown result type (might be due to invalid IL or missing references)431 //IL_037e: Unknown result type (might be due to invalid IL or missing references)432 //IL_03e5: Unknown result type (might be due to invalid IL or missing references)433 //IL_03ea: Unknown result type (might be due to invalid IL or missing references)434 //IL_03f2: Unknown result type (might be due to invalid IL or missing references)435 //IL_0458: Unknown result type (might be due to invalid IL or missing references)436 //IL_045d: Unknown result type (might be due to invalid IL or missing references)437 //IL_0465: Unknown result type (might be due to invalid IL or missing references)438 //IL_02b5: Unknown result type (might be due to invalid IL or missing references)439 //IL_02ba: Unknown result type (might be due to invalid IL or missing references)440 //IL_02be: Unknown result type (might be due to invalid IL or missing references)441 //IL_02c3: Unknown result type (might be due to invalid IL or missing references)442 //IL_0328: Unknown result type (might be due to invalid IL or missing references)443 //IL_0333: Unknown result type (might be due to invalid IL or missing references)444 //IL_0338: Unknown result type (might be due to invalid IL or missing references)445 //IL_033c: Unknown result type (might be due to invalid IL or missing references)446 //IL_0341: Unknown result type (might be due to invalid IL or missing references)447 //IL_03a7: Unknown result type (might be due to invalid IL or missing references)448 //IL_03ac: Unknown result type (might be due to invalid IL or missing references)449 //IL_03b0: Unknown result type (might be due to invalid IL or missing references)450 //IL_03b5: Unknown result type (might be due to invalid IL or missing references)451 //IL_040f: Unknown result type (might be due to invalid IL or missing references)452 //IL_041a: Unknown result type (might be due to invalid IL or missing references)453 //IL_041f: Unknown result type (might be due to invalid IL or missing references)454 //IL_0423: Unknown result type (might be due to invalid IL or missing references)455 //IL_0428: Unknown result type (might be due to invalid IL or missing references)456 //IL_02d8: Unknown result type (might be due to invalid IL or missing references)457 //IL_02da: Unknown result type (might be due to invalid IL or missing references)458 //IL_01b6: Unknown result type (might be due to invalid IL or missing references)459 //IL_01bb: Unknown result type (might be due to invalid IL or missing references)460 //IL_0356: Unknown result type (might be due to invalid IL or missing references)461 //IL_0358: Unknown result type (might be due to invalid IL or missing references)462 //IL_03ca: Unknown result type (might be due to invalid IL or missing references)463 //IL_03cc: Unknown result type (might be due to invalid IL or missing references)464 //IL_043d: Unknown result type (might be due to invalid IL or missing references)465 //IL_043f: Unknown result type (might be due to invalid IL or missing references)466 //IL_01c1: Unknown result type (might be due to invalid IL or missing references)467 //IL_01c6: Unknown result type (might be due to invalid IL or missing references)468 int num = _003C_003E1__state;469 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;470 DbObjectKey result2;471 try472 {473 if ((uint)num > 4u)474 {475 _003CuoWork_003E5__2 = session.StartUnitOfWork();476 }477 try478 {479 ConfiguredTaskAwaiter<IEntity> val;480 if (num != 0)481 {482 if ((uint)(num - 1) <= 3u)483 {484 goto IL_0259;485 }486 _003Clp_003E5__3 = new LogicParameter(session, null, entity, _003CuoWork_003E5__2, entity.CreateWalker(session), ct);487 _003CmTable_003E5__4 = workingCopyEntityLogic._wcParams.Table;488 val = _003Clp_003E5__3.Session.Source().CreateNewAsync(_003CmTable_003E5__4.Tablename, EntityCreationType.Interactive, _003Clp_003E5__3.CancellationToken).ConfigureAwait(false)489 .GetAwaiter();490 if (!val.IsCompleted)491 {492 num = (_003C_003E1__state = 0);493 _003C_003Eu__1 = val;494 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CCopy_003Ed__12>(ref val, ref this);495 return;496 }497 }498 else499 {500 val = _003C_003Eu__1;501 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity>);502 num = (_003C_003E1__state = -1);503 }504 IEntity result = val.GetResult();505 _003CeCopy_003E5__5 = result;506 PropertyBag propertyBag = new PropertyBag();507 if (!workingCopyEntityLogic._wcParams.ExcludeColumns.Contains("IsWorkingCopy"))508 {509 workingCopyEntityLogic._wcParams.ExcludeColumns.Add("isworkingcopy");510 }511 if (!workingCopyEntityLogic._wcParams.ExcludeColumns.Contains("IsInactive"))512 {513 workingCopyEntityLogic._wcParams.ExcludeColumns.Add("isinactive");514 }515 propertyBag.FillFromEntity(_003CmTable_003E5__4, _003Clp_003E5__3.Entity, (System.Collections.Generic.IEnumerable<string>)workingCopyEntityLogic._wcParams.ExcludeColumns);516 PropertyBag propertyBag2 = new PropertyBag();517 if (values != null && values.Count > 0)518 {519 Enumerator<string, object> enumerator = values.GetEnumerator();520 try521 {522 while (enumerator.MoveNext())523 {524 KeyValuePair<string, object> current = enumerator.Current;525 propertyBag2.PutValue(current.Key, current.Value);526 }527 }528 finally529 {530 if (num < 0)531 {532 ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();533 }534 }535 }536 propertyBag2.PutValue(workingCopyEntityLogic._wcParams.FKWorkColumn, "");537 propertyBag2.PutValue("IsWorkingCopy", true);538 if (_003CmTable_003E5__4.Columns.Contains("IsInactive"))539 {540 propertyBag2.PutValue("IsInactive", true);541 }542 _003C_003E7__wrap5 = workingCopyEntityLogic.StartInternalProcess();543 goto IL_0259;544 IL_0259:545 try546 {547 ConfiguredTaskAwaitable val3;548 ConfiguredTaskAwaiter val2;549 switch (num)550 {551 default:552 propertyBag.ChangeEntity(_003Clp_003E5__3.Session, _003CeCopy_003E5__5, overwriteValues: true);553 propertyBag2.ChangeEntity(_003Clp_003E5__3.Session, _003CeCopy_003E5__5, overwriteValues: true);554 val3 = workingCopyEntityLogic.OnCopySaving(_003CeCopy_003E5__5, _003Clp_003E5__3).ConfigureAwait(false);555 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();556 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)557 {558 num = (_003C_003E1__state = 1);559 _003C_003Eu__2 = val2;560 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopy_003Ed__12>(ref val2, ref this);561 return;562 }563 goto IL_030f;564 case 1:565 val2 = _003C_003Eu__2;566 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);567 num = (_003C_003E1__state = -1);568 goto IL_030f;569 case 2:570 val2 = _003C_003Eu__2;571 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);572 num = (_003C_003E1__state = -1);573 goto IL_038d;574 case 3:575 val2 = _003C_003Eu__2;576 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);577 num = (_003C_003E1__state = -1);578 goto IL_0401;579 case 4:580 {581 val2 = _003C_003Eu__2;582 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);583 num = (_003C_003E1__state = -1);584 break;585 }586 IL_038d:587 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();588 val3 = workingCopyEntityLogic.OnCopySaved(_003CeCopy_003E5__5, _003Clp_003E5__3).ConfigureAwait(false);589 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();590 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)591 {592 num = (_003C_003E1__state = 3);593 _003C_003Eu__2 = val2;594 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopy_003Ed__12>(ref val2, ref this);595 return;596 }597 goto IL_0401;598 IL_030f:599 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();600 val3 = _003CuoWork_003E5__2.PutAsync(_003CeCopy_003E5__5, _003Clp_003E5__3.CancellationToken).ConfigureAwait(false);601 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();602 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)603 {604 num = (_003C_003E1__state = 2);605 _003C_003Eu__2 = val2;606 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopy_003Ed__12>(ref val2, ref this);607 return;608 }609 goto IL_038d;610 IL_0401:611 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();612 val3 = _003CuoWork_003E5__2.CommitAsync(ct).ConfigureAwait(false);613 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();614 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)615 {616 num = (_003C_003E1__state = 4);617 _003C_003Eu__2 = val2;618 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopy_003Ed__12>(ref val2, ref this);619 return;620 }621 break;622 }623 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();624 }625 finally626 {627 if (num < 0 && _003C_003E7__wrap5 != null)628 {629 _003C_003E7__wrap5.Dispose();630 }631 }632 _003C_003E7__wrap5 = null;633 result2 = new DbObjectKey(_003CmTable_003E5__4, _003CeCopy_003E5__5);634 }635 finally636 {637 if (num < 0 && _003CuoWork_003E5__2 != null)638 {639 ((System.IDisposable)_003CuoWork_003E5__2).Dispose();640 }641 }642 }643 catch (System.Exception exception)644 {645 _003C_003E1__state = -2;646 _003C_003Et__builder.SetException(exception);647 return;648 }649 _003C_003E1__state = -2;650 _003C_003Et__builder.SetResult(result2);651 }652653 [DebuggerHidden]654 private void SetStateMachine(IAsyncStateMachine stateMachine)655 {656 _003C_003Et__builder.SetStateMachine(stateMachine);657 }658 }659660 [StructLayout((LayoutKind)3)]661 [CompilerGenerated]662 private struct _003CCopyCR_003Ed__19 : IAsyncStateMachine663 {664 public int _003C_003E1__state;665666 public AsyncTaskMethodBuilder _003C_003Et__builder;667668 public IMetaTableRelation crRelation;669670 public IEntity eSource;671672 public LogicParameter lp;673674 public WorkingCopyEntityLogic<T> _003C_003E4__this;675676 private _003C_003Ec__DisplayClass19_0 _003C_003E8__1;677678 public IEntity eDestination;679680 private ConfiguredTaskAwaiter<IEntityCollection> _003C_003Eu__1;681682 private System.Collections.Generic.IEnumerator<IEntity> _003C_003E7__wrap1;683684 private ConfiguredTaskAwaiter _003C_003Eu__2;685686 private void MoveNext()687 {688 //IL_00da: Unknown result type (might be due to invalid IL or missing references)689 //IL_00df: Unknown result type (might be due to invalid IL or missing references)690 //IL_00e7: Unknown result type (might be due to invalid IL or missing references)691 //IL_0091: Unknown result type (might be due to invalid IL or missing references)692 //IL_009c: Unknown result type (might be due to invalid IL or missing references)693 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)694 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)695 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)696 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)697 //IL_00c1: Unknown result type (might be due to invalid IL or missing references)698 //IL_017f: Unknown result type (might be due to invalid IL or missing references)699 //IL_0184: Unknown result type (might be due to invalid IL or missing references)700 //IL_018c: Unknown result type (might be due to invalid IL or missing references)701 //IL_0141: Unknown result type (might be due to invalid IL or missing references)702 //IL_0146: Unknown result type (might be due to invalid IL or missing references)703 //IL_014a: Unknown result type (might be due to invalid IL or missing references)704 //IL_014f: Unknown result type (might be due to invalid IL or missing references)705 //IL_0164: Unknown result type (might be due to invalid IL or missing references)706 //IL_0166: Unknown result type (might be due to invalid IL or missing references)707 int num = _003C_003E1__state;708 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;709 try710 {711 ConfiguredTaskAwaiter<IEntityCollection> val;712 if (num != 0)713 {714 if (num == 1)715 {716 goto IL_010b;717 }718 _003C_003E8__1 = new _003C_003Ec__DisplayClass19_0();719 _003C_003E8__1.crRelation = crRelation;720 _003C_003E8__1.eSource = eSource;721 Query query = (from c in Query.From(_003C_003E8__1.crRelation.ChildTableName)722 where c.Column(_003C_003E8__1.crRelation.ChildColumnName) == _003C_003E8__1.eSource.GetValue(_003C_003E8__1.crRelation.ParentColumnName).String723 select c).SelectAll();724 val = lp.Session.Source().GetCollectionAsync(query, EntityCollectionLoadType.Bulk, lp.CancellationToken).ConfigureAwait(false)725 .GetAwaiter();726 if (!val.IsCompleted)727 {728 num = (_003C_003E1__state = 0);729 _003C_003Eu__1 = val;730 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntityCollection>, _003CCopyCR_003Ed__19>(ref val, ref this);731 return;732 }733 }734 else735 {736 val = _003C_003Eu__1;737 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntityCollection>);738 num = (_003C_003E1__state = -1);739 }740 IEntityCollection result = val.GetResult();741 _003C_003E7__wrap1 = ((System.Collections.Generic.IEnumerable<IEntity>)result).GetEnumerator();742 goto IL_010b;743 IL_010b:744 try745 {746 if (num != 1)747 {748 goto IL_01a2;749 }750 ConfiguredTaskAwaiter val2 = _003C_003Eu__2;751 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);752 num = (_003C_003E1__state = -1);753 goto IL_019b;754 IL_019b:755 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();756 goto IL_01a2;757 IL_01a2:758 if (((System.Collections.IEnumerator)_003C_003E7__wrap1).MoveNext())759 {760 IEntity current = _003C_003E7__wrap1.Current;761 ConfiguredTaskAwaitable val3 = workingCopyEntityLogic.CopyCRObject(_003C_003E8__1.crRelation, current, eDestination, lp).ConfigureAwait(false);762 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();763 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)764 {765 num = (_003C_003E1__state = 1);766 _003C_003Eu__2 = val2;767 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyCR_003Ed__19>(ref val2, ref this);768 return;769 }770 goto IL_019b;771 }772 }773 finally774 {775 if (num < 0 && _003C_003E7__wrap1 != null)776 {777 ((System.IDisposable)_003C_003E7__wrap1).Dispose();778 }779 }780 _003C_003E7__wrap1 = null;781 }782 catch (System.Exception exception)783 {784 _003C_003E1__state = -2;785 _003C_003E8__1 = null;786 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);787 return;788 }789 _003C_003E1__state = -2;790 _003C_003E8__1 = null;791 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();792 }793794 [DebuggerHidden]795 private void SetStateMachine(IAsyncStateMachine stateMachine)796 {797 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);798 }799 }800801 [StructLayout((LayoutKind)3)]802 [CompilerGenerated]803 private struct _003CCopyCRObject_003Ed__20 : IAsyncStateMachine804 {805 public int _003C_003E1__state;806807 public AsyncTaskMethodBuilder _003C_003Et__builder;808809 public LogicParameter lp;810811 public IMetaTableRelation crRelation;812813 public IEntity crSource;814815 public IEntity eDestination;816817 public WorkingCopyEntityLogic<T> _003C_003E4__this;818819 private IMetaTable _003CcrTable_003E5__2;820821 private IEntity _003CeCopy_003E5__3;822823 private ConfiguredTaskAwaiter<IMetaTable> _003C_003Eu__1;824825 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__2;826827 private System.IDisposable _003C_003E7__wrap3;828829 private ConfiguredTaskAwaiter _003C_003Eu__3;830831 private void MoveNext()832 {833 //IL_0092: Unknown result type (might be due to invalid IL or missing references)834 //IL_0097: Unknown result type (might be due to invalid IL or missing references)835 //IL_009f: Unknown result type (might be due to invalid IL or missing references)836 //IL_0128: Unknown result type (might be due to invalid IL or missing references)837 //IL_012d: Unknown result type (might be due to invalid IL or missing references)838 //IL_0135: Unknown result type (might be due to invalid IL or missing references)839 //IL_0049: Unknown result type (might be due to invalid IL or missing references)840 //IL_0054: Unknown result type (might be due to invalid IL or missing references)841 //IL_0059: Unknown result type (might be due to invalid IL or missing references)842 //IL_005d: Unknown result type (might be due to invalid IL or missing references)843 //IL_0062: Unknown result type (might be due to invalid IL or missing references)844 //IL_00df: Unknown result type (might be due to invalid IL or missing references)845 //IL_00ea: Unknown result type (might be due to invalid IL or missing references)846 //IL_00ef: Unknown result type (might be due to invalid IL or missing references)847 //IL_00f3: Unknown result type (might be due to invalid IL or missing references)848 //IL_00f8: Unknown result type (might be due to invalid IL or missing references)849 //IL_0077: Unknown result type (might be due to invalid IL or missing references)850 //IL_0079: Unknown result type (might be due to invalid IL or missing references)851 //IL_010d: Unknown result type (might be due to invalid IL or missing references)852 //IL_010f: Unknown result type (might be due to invalid IL or missing references)853 //IL_0224: Unknown result type (might be due to invalid IL or missing references)854 //IL_0229: Unknown result type (might be due to invalid IL or missing references)855 //IL_0231: Unknown result type (might be due to invalid IL or missing references)856 //IL_02a7: Unknown result type (might be due to invalid IL or missing references)857 //IL_02ac: Unknown result type (might be due to invalid IL or missing references)858 //IL_02b4: Unknown result type (might be due to invalid IL or missing references)859 //IL_0321: Unknown result type (might be due to invalid IL or missing references)860 //IL_0326: Unknown result type (might be due to invalid IL or missing references)861 //IL_032e: Unknown result type (might be due to invalid IL or missing references)862 //IL_01e6: Unknown result type (might be due to invalid IL or missing references)863 //IL_01eb: Unknown result type (might be due to invalid IL or missing references)864 //IL_01ef: Unknown result type (might be due to invalid IL or missing references)865 //IL_01f4: Unknown result type (might be due to invalid IL or missing references)866 //IL_025e: Unknown result type (might be due to invalid IL or missing references)867 //IL_0269: Unknown result type (might be due to invalid IL or missing references)868 //IL_026e: Unknown result type (might be due to invalid IL or missing references)869 //IL_0272: Unknown result type (might be due to invalid IL or missing references)870 //IL_0277: Unknown result type (might be due to invalid IL or missing references)871 //IL_02e3: Unknown result type (might be due to invalid IL or missing references)872 //IL_02e8: Unknown result type (might be due to invalid IL or missing references)873 //IL_02ec: Unknown result type (might be due to invalid IL or missing references)874 //IL_02f1: Unknown result type (might be due to invalid IL or missing references)875 //IL_0209: Unknown result type (might be due to invalid IL or missing references)876 //IL_020b: Unknown result type (might be due to invalid IL or missing references)877 //IL_028c: Unknown result type (might be due to invalid IL or missing references)878 //IL_028e: Unknown result type (might be due to invalid IL or missing references)879 //IL_0306: Unknown result type (might be due to invalid IL or missing references)880 //IL_0308: Unknown result type (might be due to invalid IL or missing references)881 int num = _003C_003E1__state;882 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;883 try884 {885 ConfiguredTaskAwaiter<IMetaTable> val2;886 ConfiguredTaskAwaiter<IEntity> val;887 IEntity result;888 PropertyBag propertyBag = default(PropertyBag);889 IMetaTable result2;890 switch (num)891 {892 default:893 val2 = lp.Session.MetaData().GetTableAsync(crRelation.ChildTableName, lp.CancellationToken).ConfigureAwait(false)894 .GetAwaiter();895 if (!val2.IsCompleted)896 {897 num = (_003C_003E1__state = 0);898 _003C_003Eu__1 = val2;899 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IMetaTable>, _003CCopyCRObject_003Ed__20>(ref val2, ref this);900 return;901 }902 goto IL_00ae;903 case 0:904 val2 = _003C_003Eu__1;905 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IMetaTable>);906 num = (_003C_003E1__state = -1);907 goto IL_00ae;908 case 1:909 val = _003C_003Eu__2;910 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<IEntity>);911 num = (_003C_003E1__state = -1);912 goto IL_0144;913 case 2:914 case 3:915 case 4:916 break;917 IL_0144:918 result = val.GetResult();919 _003CeCopy_003E5__3 = result;920 propertyBag = new PropertyBag();921 propertyBag.FillFromEntity(_003CcrTable_003E5__2, crSource);922 propertyBag.PutValue(crRelation.ChildColumnName, eDestination.GetValue<string>(crRelation.ParentColumnName));923 _003C_003E7__wrap3 = workingCopyEntityLogic.StartInternalProcess();924 break;925 IL_00ae:926 result2 = val2.GetResult();927 _003CcrTable_003E5__2 = result2;928 val = lp.Session.Source().CreateNewAsync(crRelation.ChildTableName, EntityCreationType.DelayedLogic, lp.CancellationToken).ConfigureAwait(false)929 .GetAwaiter();930 if (!val.IsCompleted)931 {932 num = (_003C_003E1__state = 1);933 _003C_003Eu__2 = val;934 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CCopyCRObject_003Ed__20>(ref val, ref this);935 return;936 }937 goto IL_0144;938 }939 try940 {941 ConfiguredTaskAwaitable val4;942 ConfiguredTaskAwaiter val3;943 switch (num)944 {945 default:946 propertyBag.ChangeEntity(lp.Session, _003CeCopy_003E5__3, overwriteValues: true);947 val4 = workingCopyEntityLogic.OnRelationObjectSaving(crSource, _003CeCopy_003E5__3, lp).ConfigureAwait(false);948 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();949 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)950 {951 num = (_003C_003E1__state = 2);952 _003C_003Eu__3 = val3;953 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyCRObject_003Ed__20>(ref val3, ref this);954 return;955 }956 goto IL_0240;957 case 2:958 val3 = _003C_003Eu__3;959 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);960 num = (_003C_003E1__state = -1);961 goto IL_0240;962 case 3:963 val3 = _003C_003Eu__3;964 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);965 num = (_003C_003E1__state = -1);966 goto IL_02c3;967 case 4:968 {969 val3 = _003C_003Eu__3;970 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);971 num = (_003C_003E1__state = -1);972 break;973 }974 IL_02c3:975 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();976 val4 = workingCopyEntityLogic.OnRelationObjectSaved(crSource, _003CeCopy_003E5__3, lp).ConfigureAwait(false);977 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();978 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)979 {980 num = (_003C_003E1__state = 4);981 _003C_003Eu__3 = val3;982 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyCRObject_003Ed__20>(ref val3, ref this);983 return;984 }985 break;986 IL_0240:987 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();988 val4 = lp.UnitOfWork.PutAsync(_003CeCopy_003E5__3, lp.CancellationToken).ConfigureAwait(false);989 val3 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();990 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)991 {992 num = (_003C_003E1__state = 3);993 _003C_003Eu__3 = val3;994 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyCRObject_003Ed__20>(ref val3, ref this);995 return;996 }997 goto IL_02c3;998 }999 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();1000 }1001 finally1002 {1003 if (num < 0 && _003C_003E7__wrap3 != null)1004 {1005 _003C_003E7__wrap3.Dispose();1006 }1007 }1008 _003C_003E7__wrap3 = null;1009 }1010 catch (System.Exception exception)1011 {1012 _003C_003E1__state = -2;1013 _003CcrTable_003E5__2 = null;1014 _003CeCopy_003E5__3 = null;1015 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);1016 return;1017 }1018 _003C_003E1__state = -2;1019 _003CcrTable_003E5__2 = null;1020 _003CeCopy_003E5__3 = null;1021 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();1022 }10231024 [DebuggerHidden]1025 private void SetStateMachine(IAsyncStateMachine stateMachine)1026 {1027 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);1028 }1029 }10301031 [StructLayout((LayoutKind)3)]1032 [CompilerGenerated]1033 private struct _003CCopyMN_003Ed__23 : IAsyncStateMachine1034 {1035 public int _003C_003E1__state;10361037 public AsyncTaskMethodBuilder _003C_003Et__builder;10381039 public IMetaTableRelation mnRelation;10401041 public IEntity eSource;10421043 public IEntity eDestination;10441045 public LogicParameter lp;10461047 private _003C_003Ec__DisplayClass23_0 _003C_003E8__1;10481049 public string mnTargetColumn;10501051 private IEntityCollection _003CcolMNSource_003E5__2;10521053 private Dictionary<DbObjectKey, IEntity?> _003CdicMNDest_003E5__3;10541055 private string _003CuidDestination_003E5__4;10561057 private ConfiguredTaskAwaiter<IMetaTable> _003C_003Eu__1;10581059 private ConfiguredTaskAwaiter<IEntityCollection> _003C_003Eu__2;10601061 private System.Collections.Generic.IEnumerator<IEntity> _003C_003E7__wrap4;10621063 private DbObjectKey _003CdboKey_003E5__6;10641065 private IEntity _003CeMN_003E5__7;10661067 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__3;10681069 private ConfiguredTaskAwaiter _003C_003Eu__4;10701071 private void MoveNext()1072 {1073 //IL_00d6: Unknown result type (might be due to invalid IL or missing references)1074 //IL_00db: Unknown result type (might be due to invalid IL or missing references)1075 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)1076 //IL_019a: Unknown result type (might be due to invalid IL or missing references)1077 //IL_019f: Unknown result type (might be due to invalid IL or missing references)1078 //IL_01a7: Unknown result type (might be due to invalid IL or missing references)1079 //IL_0259: Unknown result type (might be due to invalid IL or missing references)1080 //IL_025e: Unknown result type (might be due to invalid IL or missing references)1081 //IL_0266: Unknown result type (might be due to invalid IL or missing references)1082 //IL_008d: Unknown result type (might be due to invalid IL or missing references)1083 //IL_0098: Unknown result type (might be due to invalid IL or missing references)1084 //IL_009d: Unknown result type (might be due to invalid IL or missing references)1085 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)1086 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)1087 //IL_0151: Unknown result type (might be due to invalid IL or missing references)1088 //IL_015c: Unknown result type (might be due to invalid IL or missing references)1089 //IL_0161: Unknown result type (might be due to invalid IL or missing references)1090 //IL_0165: Unknown result type (might be due to invalid IL or missing references)1091 //IL_016a: Unknown result type (might be due to invalid IL or missing references)1092 //IL_0210: Unknown result type (might be due to invalid IL or missing references)1093 //IL_021b: Unknown result type (might be due to invalid IL or missing references)1094 //IL_0220: Unknown result type (might be due to invalid IL or missing references)1095 //IL_0224: Unknown result type (might be due to invalid IL or missing references)1096 //IL_0229: Unknown result type (might be due to invalid IL or missing references)1097 //IL_00bb: Unknown result type (might be due to invalid IL or missing references)1098 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)1099 //IL_017f: Unknown result type (might be due to invalid IL or missing references)1100 //IL_0181: Unknown result type (might be due to invalid IL or missing references)1101 //IL_023e: Unknown result type (might be due to invalid IL or missing references)1102 //IL_0240: Unknown result type (might be due to invalid IL or missing references)1103 //IL_03e0: Unknown result type (might be due to invalid IL or missing references)1104 //IL_03e5: Unknown result type (might be due to invalid IL or missing references)1105 //IL_03ed: Unknown result type (might be due to invalid IL or missing references)1106 //IL_0478: Unknown result type (might be due to invalid IL or missing references)1107 //IL_047d: Unknown result type (might be due to invalid IL or missing references)1108 //IL_0485: Unknown result type (might be due to invalid IL or missing references)1109 //IL_04fb: Unknown result type (might be due to invalid IL or missing references)1110 //IL_0500: Unknown result type (might be due to invalid IL or missing references)1111 //IL_0508: Unknown result type (might be due to invalid IL or missing references)1112 //IL_0611: Unknown result type (might be due to invalid IL or missing references)1113 //IL_0616: Unknown result type (might be due to invalid IL or missing references)1114 //IL_061e: Unknown result type (might be due to invalid IL or missing references)1115 //IL_042f: Unknown result type (might be due to invalid IL or missing references)1116 //IL_043a: Unknown result type (might be due to invalid IL or missing references)1117 //IL_043f: Unknown result type (might be due to invalid IL or missing references)1118 //IL_0443: Unknown result type (might be due to invalid IL or missing references)1119 //IL_0448: Unknown result type (might be due to invalid IL or missing references)1120 //IL_04b2: Unknown result type (might be due to invalid IL or missing references)1121 //IL_04bd: Unknown result type (might be due to invalid IL or missing references)1122 //IL_04c2: Unknown result type (might be due to invalid IL or missing references)1123 //IL_04c6: Unknown result type (might be due to invalid IL or missing references)1124 //IL_04cb: Unknown result type (might be due to invalid IL or missing references)1125 //IL_045d: Unknown result type (might be due to invalid IL or missing references)1126 //IL_045f: Unknown result type (might be due to invalid IL or missing references)1127 //IL_04e0: Unknown result type (might be due to invalid IL or missing references)1128 //IL_04e2: Unknown result type (might be due to invalid IL or missing references)1129 //IL_05c5: Unknown result type (might be due to invalid IL or missing references)1130 //IL_05cb: Unknown result type (might be due to invalid IL or missing references)1131 //IL_05d3: Unknown result type (might be due to invalid IL or missing references)1132 //IL_05d8: Unknown result type (might be due to invalid IL or missing references)1133 //IL_05dc: Unknown result type (might be due to invalid IL or missing references)1134 //IL_05e1: Unknown result type (might be due to invalid IL or missing references)1135 //IL_0397: Unknown result type (might be due to invalid IL or missing references)1136 //IL_03a2: Unknown result type (might be due to invalid IL or missing references)1137 //IL_03a7: Unknown result type (might be due to invalid IL or missing references)1138 //IL_03ab: Unknown result type (might be due to invalid IL or missing references)1139 //IL_03b0: Unknown result type (might be due to invalid IL or missing references)1140 //IL_05f6: Unknown result type (might be due to invalid IL or missing references)1141 //IL_05f8: Unknown result type (might be due to invalid IL or missing references)1142 //IL_03c5: Unknown result type (might be due to invalid IL or missing references)1143 //IL_03c7: Unknown result type (might be due to invalid IL or missing references)1144 int num = _003C_003E1__state;1145 try1146 {1147 ConfiguredTaskAwaiter<IMetaTable> val2;1148 ConfiguredTaskAwaiter<IEntityCollection> val;1149 ConfiguredTaskAwaiter val3;1150 ConfiguredTaskAwaitable val5;1151 IMetaTable result2;1152 Query query;1153 IEntityCollection result3;1154 IEntityCollection result4;1155 Query query2;1156 switch (num)1157 {1158 default:1159 _003C_003E8__1 = new _003C_003Ec__DisplayClass23_0();1160 _003C_003E8__1.mnRelation = mnRelation;1161 _003C_003E8__1.eSource = eSource;1162 _003C_003E8__1.eDestination = eDestination;1163 val2 = lp.Session.MetaData().GetTableAsync(_003C_003E8__1.mnRelation.ChildTableName, lp.CancellationToken).ConfigureAwait(false)1164 .GetAwaiter();1165 if (!val2.IsCompleted)1166 {1167 num = (_003C_003E1__state = 0);1168 _003C_003Eu__1 = val2;1169 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IMetaTable>, _003CCopyMN_003Ed__23>(ref val2, ref this);1170 return;1171 }1172 goto IL_00f2;1173 case 0:1174 val2 = _003C_003Eu__1;1175 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IMetaTable>);1176 num = (_003C_003E1__state = -1);1177 goto IL_00f2;1178 case 1:1179 val = _003C_003Eu__2;1180 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<IEntityCollection>);1181 num = (_003C_003E1__state = -1);1182 goto IL_01b6;1183 case 2:1184 val = _003C_003Eu__2;1185 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<IEntityCollection>);1186 num = (_003C_003E1__state = -1);1187 goto IL_0275;1188 case 3:1189 case 4:1190 case 5:1191 try1192 {1193 ConfiguredTaskAwaiter<IEntity> val4;1194 IEntity result;1195 switch (num)1196 {1197 case 3:1198 val4 = _003C_003Eu__3;1199 _003C_003Eu__3 = default(ConfiguredTaskAwaiter<IEntity>);1200 num = (_003C_003E1__state = -1);1201 goto IL_03fc;1202 case 4:1203 val3 = _003C_003Eu__4;1204 _003C_003Eu__4 = default(ConfiguredTaskAwaiter);1205 num = (_003C_003E1__state = -1);1206 goto IL_0494;1207 case 5:1208 val3 = _003C_003Eu__4;1209 _003C_003Eu__4 = default(ConfiguredTaskAwaiter);1210 num = (_003C_003E1__state = -1);1211 goto IL_0517;1212 default:1213 {1214 if (!((System.Collections.IEnumerator)_003C_003E7__wrap4).MoveNext())1215 {1216 break;1217 }1218 IEntity current = _003C_003E7__wrap4.Current;1219 _003CdboKey_003E5__6 = DbObjectKey.GetObjectKey(_003C_003E8__1.mnRelation.ChildTableName, mnTargetColumn, current.GetValue(mnTargetColumn).String, _003C_003E8__1.mnRelation.ChildColumnName, _003CuidDestination_003E5__4);1220 if (_003CdicMNDest_003E5__3.ContainsKey(_003CdboKey_003E5__6))1221 {1222 _003CdicMNDest_003E5__3[_003CdboKey_003E5__6] = null;1223 goto IL_0525;1224 }1225 val4 = lp.Session.Source().CreateNewAsync(_003C_003E8__1.mnRelation.ChildTableName, EntityCreationType.DelayedLogic, lp.CancellationToken).ConfigureAwait(false)1226 .GetAwaiter();1227 if (!val4.IsCompleted)1228 {1229 num = (_003C_003E1__state = 3);1230 _003C_003Eu__3 = val4;1231 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CCopyMN_003Ed__23>(ref val4, ref this);1232 return;1233 }1234 goto IL_03fc;1235 }1236 IL_03fc:1237 result = val4.GetResult();1238 _003CeMN_003E5__7 = result;1239 val5 = _003CdboKey_003E5__6.FillEntityAsync(_003CeMN_003E5__7, lp.Session.MetaData(), lp.CancellationToken).ConfigureAwait(false);1240 val3 = ((ConfiguredTaskAwaitable)(ref val5)).GetAwaiter();1241 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)1242 {1243 num = (_003C_003E1__state = 4);1244 _003C_003Eu__4 = val3;1245 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyMN_003Ed__23>(ref val3, ref this);1246 return;1247 }1248 goto IL_0494;1249 IL_0525:1250 _003CdboKey_003E5__6 = null;1251 goto default;1252 IL_0494:1253 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();1254 val5 = lp.UnitOfWork.PutAsync(_003CeMN_003E5__7, lp.CancellationToken).ConfigureAwait(false);1255 val3 = ((ConfiguredTaskAwaitable)(ref val5)).GetAwaiter();1256 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)1257 {1258 num = (_003C_003E1__state = 5);1259 _003C_003Eu__4 = val3;1260 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyMN_003Ed__23>(ref val3, ref this);1261 return;1262 }1263 goto IL_0517;1264 IL_0517:1265 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();1266 _003CeMN_003E5__7 = null;1267 goto IL_0525;1268 }1269 }1270 finally1271 {1272 if (num < 0 && _003C_003E7__wrap4 != null)1273 {1274 ((System.IDisposable)_003C_003E7__wrap4).Dispose();1275 }1276 }1277 _003C_003E7__wrap4 = null;1278 _003C_003E7__wrap4 = Enumerable.Where<IEntity>((System.Collections.Generic.IEnumerable<IEntity>)_003CdicMNDest_003E5__3.Values, (Func<IEntity, bool>)((IEntity c) => c != null)).GetEnumerator();1279 break;1280 case 6:1281 break;1282 IL_00f2:1283 result2 = val2.GetResult();1284 _003C_003E8__1.mTable = result2;1285 query = (from c in Query.From(_003C_003E8__1.mnRelation.ChildTableName)1286 where c.Column(_003C_003E8__1.mnRelation.ChildColumnName) == _003C_003E8__1.eSource.GetValue<string>(_003C_003E8__1.mnRelation.ParentColumnName)1287 select c).SelectAll();1288 val = lp.Session.Source().GetCollectionAsync(query, EntityCollectionLoadType.Bulk, lp.CancellationToken).ConfigureAwait(false)1289 .GetAwaiter();1290 if (!val.IsCompleted)1291 {1292 num = (_003C_003E1__state = 1);1293 _003C_003Eu__2 = val;1294 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntityCollection>, _003CCopyMN_003Ed__23>(ref val, ref this);1295 return;1296 }1297 goto IL_01b6;1298 IL_0275:1299 result3 = val.GetResult();1300 _003CdicMNDest_003E5__3 = Enumerable.ToDictionary<IEntity, DbObjectKey>((System.Collections.Generic.IEnumerable<IEntity>)result3, (Func<IEntity, DbObjectKey>)((IEntity e) => DbObjectKey.Create(_003C_003E8__1.mTable, e)));1301 _003CuidDestination_003E5__4 = _003C_003E8__1.eDestination.GetValue(_003C_003E8__1.mnRelation.ParentColumnName).String;1302 _003C_003E7__wrap4 = ((System.Collections.Generic.IEnumerable<IEntity>)_003CcolMNSource_003E5__2).GetEnumerator();1303 goto case 3;1304 IL_01b6:1305 result4 = val.GetResult();1306 _003CcolMNSource_003E5__2 = result4;1307 query2 = (from c in Query.From(_003C_003E8__1.mnRelation.ChildTableName)1308 where c.Column(_003C_003E8__1.mnRelation.ChildColumnName) == _003C_003E8__1.eDestination.GetValue<string>(_003C_003E8__1.mnRelation.ParentColumnName)1309 select c).SelectAll();1310 val = lp.Session.Source().GetCollectionAsync(query2, EntityCollectionLoadType.Bulk, lp.CancellationToken).ConfigureAwait(false)1311 .GetAwaiter();1312 if (!val.IsCompleted)1313 {1314 num = (_003C_003E1__state = 2);1315 _003C_003Eu__2 = val;1316 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntityCollection>, _003CCopyMN_003Ed__23>(ref val, ref this);1317 return;1318 }1319 goto IL_0275;1320 }1321 try1322 {1323 if (num != 6)1324 {1325 goto IL_0634;1326 }1327 val3 = _003C_003Eu__4;1328 _003C_003Eu__4 = default(ConfiguredTaskAwaiter);1329 num = (_003C_003E1__state = -1);1330 goto IL_062d;1331 IL_062d:1332 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();1333 goto IL_0634;1334 IL_0634:1335 if (((System.Collections.IEnumerator)_003C_003E7__wrap4).MoveNext())1336 {1337 IEntity current2 = _003C_003E7__wrap4.Current;1338 current2.MarkForDeletion();1339 val5 = lp.UnitOfWork.PutAsync(current2).ConfigureAwait(false);1340 val3 = ((ConfiguredTaskAwaitable)(ref val5)).GetAwaiter();1341 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)1342 {1343 num = (_003C_003E1__state = 6);1344 _003C_003Eu__4 = val3;1345 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCopyMN_003Ed__23>(ref val3, ref this);1346 return;1347 }1348 goto IL_062d;1349 }1350 }1351 finally1352 {1353 if (num < 0 && _003C_003E7__wrap4 != null)1354 {1355 ((System.IDisposable)_003C_003E7__wrap4).Dispose();1356 }1357 }1358 _003C_003E7__wrap4 = null;1359 }1360 catch (System.Exception exception)1361 {1362 _003C_003E1__state = -2;1363 _003C_003E8__1 = null;1364 _003CcolMNSource_003E5__2 = null;1365 _003CdicMNDest_003E5__3 = null;1366 _003CuidDestination_003E5__4 = null;1367 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);1368 return;1369 }1370 _003C_003E1__state = -2;1371 _003C_003E8__1 = null;1372 _003CcolMNSource_003E5__2 = null;1373 _003CdicMNDest_003E5__3 = null;1374 _003CuidDestination_003E5__4 = null;1375 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();1376 }13771378 [DebuggerHidden]1379 private void SetStateMachine(IAsyncStateMachine stateMachine)1380 {1381 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);1382 }1383 }13841385 [StructLayout((LayoutKind)3)]1386 [CompilerGenerated]1387 private struct _003CMakeWorkingCopy_OnSaving_003Ed__4 : IAsyncStateMachine1388 {1389 public int _003C_003E1__state;13901391 public AsyncTaskMethodBuilder _003C_003Et__builder;13921393 public IEntity entity;13941395 public LogicReadWriteParameters parameter;13961397 public CancellationToken ct;13981399 public WorkingCopyEntityLogic<T> _003C_003E4__this;14001401 private LogicParameter _003Clp_003E5__2;14021403 private IEntity _003CeCopy_003E5__3;14041405 private IMetaTable _003CmTable_003E5__4;14061407 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__1;14081409 private System.IDisposable _003C_003E7__wrap4;14101411 private ConfiguredTaskAwaiter _003C_003Eu__2;14121413 private void MoveNext()1414 {1415 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)1416 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)1417 //IL_00f0: Unknown result type (might be due to invalid IL or missing references)1418 //IL_0185: Unknown result type (might be due to invalid IL or missing references)1419 //IL_018a: Unknown result type (might be due to invalid IL or missing references)1420 //IL_0192: Unknown result type (might be due to invalid IL or missing references)1421 //IL_0036: Unknown result type (might be due to invalid IL or missing references)1422 //IL_013c: Unknown result type (might be due to invalid IL or missing references)1423 //IL_0147: Unknown result type (might be due to invalid IL or missing references)1424 //IL_014c: Unknown result type (might be due to invalid IL or missing references)1425 //IL_0150: Unknown result type (might be due to invalid IL or missing references)1426 //IL_0155: Unknown result type (might be due to invalid IL or missing references)1427 //IL_009a: Unknown result type (might be due to invalid IL or missing references)1428 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)1429 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)1430 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)1431 //IL_00b3: Unknown result type (might be due to invalid IL or missing references)1432 //IL_02ae: Unknown result type (might be due to invalid IL or missing references)1433 //IL_02b3: Unknown result type (might be due to invalid IL or missing references)1434 //IL_02bb: Unknown result type (might be due to invalid IL or missing references)1435 //IL_0331: Unknown result type (might be due to invalid IL or missing references)1436 //IL_0336: Unknown result type (might be due to invalid IL or missing references)1437 //IL_033e: Unknown result type (might be due to invalid IL or missing references)1438 //IL_03a5: Unknown result type (might be due to invalid IL or missing references)1439 //IL_03aa: Unknown result type (might be due to invalid IL or missing references)1440 //IL_03b2: Unknown result type (might be due to invalid IL or missing references)1441 //IL_0270: Unknown result type (might be due to invalid IL or missing references)1442 //IL_0275: Unknown result type (might be due to invalid IL or missing references)1443 //IL_0279: Unknown result type (might be due to invalid IL or missing references)1444 //IL_027e: Unknown result type (might be due to invalid IL or missing references)1445 //IL_016a: Unknown result type (might be due to invalid IL or missing references)1446 //IL_016c: Unknown result type (might be due to invalid IL or missing references)1447 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)1448 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)1449 //IL_02e8: Unknown result type (might be due to invalid IL or missing references)1450 //IL_02f3: Unknown result type (might be due to invalid IL or missing references)1451 //IL_02f8: Unknown result type (might be due to invalid IL or missing references)1452 //IL_02fc: Unknown result type (might be due to invalid IL or missing references)1453 //IL_0301: Unknown result type (might be due to invalid IL or missing references)1454 //IL_0367: Unknown result type (might be due to invalid IL or missing references)1455 //IL_036c: Unknown result type (might be due to invalid IL or missing references)1456 //IL_0370: Unknown result type (might be due to invalid IL or missing references)1457 //IL_0375: Unknown result type (might be due to invalid IL or missing references)1458 //IL_0293: Unknown result type (might be due to invalid IL or missing references)1459 //IL_0295: Unknown result type (might be due to invalid IL or missing references)1460 //IL_0316: Unknown result type (might be due to invalid IL or missing references)1461 //IL_0318: Unknown result type (might be due to invalid IL or missing references)1462 //IL_038a: Unknown result type (might be due to invalid IL or missing references)1463 //IL_038c: Unknown result type (might be due to invalid IL or missing references)1464 int num = _003C_003E1__state;1465 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;1466 try1467 {1468 ConfiguredTaskAwaiter<IEntity> val;1469 PropertyBag propertyBag = default(PropertyBag);1470 IEntity result;1471 switch (num)1472 {1473 default:1474 {1475 _003Clp_003E5__2 = new LogicParameter(entity, parameter, ct);1476 string value = entity.GetValue<string>(workingCopyEntityLogic._wcParams.FKWorkColumn);1477 _003CmTable_003E5__4 = workingCopyEntityLogic._wcParams.Table;1478 if (string.IsNullOrEmpty(value))1479 {1480 val = _003Clp_003E5__2.Session.Source().CreateNewAsync(_003CmTable_003E5__4.Tablename, EntityCreationType.Interactive, _003Clp_003E5__2.CancellationToken).ConfigureAwait(false)1481 .GetAwaiter();1482 if (!val.IsCompleted)1483 {1484 num = (_003C_003E1__state = 0);1485 _003C_003Eu__1 = val;1486 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CMakeWorkingCopy_OnSaving_003Ed__4>(ref val, ref this);1487 return;1488 }1489 goto IL_00ff;1490 }1491 val = _003Clp_003E5__2.Session.Source().GetAsync(DbObjectKey.GetObjectKey(_003CmTable_003E5__4.Tablename, value), _003Clp_003E5__2.CancellationToken).ConfigureAwait(false)1492 .GetAwaiter();1493 if (!val.IsCompleted)1494 {1495 num = (_003C_003E1__state = 1);1496 _003C_003Eu__1 = val;1497 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CMakeWorkingCopy_OnSaving_003Ed__4>(ref val, ref this);1498 return;1499 }1500 goto IL_01a1;1501 }1502 case 0:1503 val = _003C_003Eu__1;1504 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity>);1505 num = (_003C_003E1__state = -1);1506 goto IL_00ff;1507 case 1:1508 val = _003C_003Eu__1;1509 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity>);1510 num = (_003C_003E1__state = -1);1511 goto IL_01a1;1512 case 2:1513 case 3:1514 case 4:1515 break;1516 IL_01b2:1517 propertyBag = new PropertyBag();1518 propertyBag.FillFromEntity(_003CmTable_003E5__4, entity, (System.Collections.Generic.IEnumerable<string>)workingCopyEntityLogic._wcParams.ExcludeColumns);1519 if (_003CmTable_003E5__4.Columns.Contains("IsInactive"))1520 {1521 propertyBag.PutValue("IsInactive", true);1522 }1523 propertyBag.PutValue("IsWorkingCopy", true);1524 propertyBag.PutValue(workingCopyEntityLogic._wcParams.FKWorkColumn, string.Empty);1525 _003C_003E7__wrap4 = workingCopyEntityLogic.StartInternalProcess();1526 break;1527 IL_01a1:1528 result = val.GetResult();1529 _003CeCopy_003E5__3 = result;1530 goto IL_01b2;1531 IL_00ff:1532 result = val.GetResult();1533 _003CeCopy_003E5__3 = result;1534 goto IL_01b2;1535 }1536 try1537 {1538 ConfiguredTaskAwaitable val3;1539 ConfiguredTaskAwaiter val2;1540 switch (num)1541 {1542 default:1543 propertyBag.ChangeEntity(_003Clp_003E5__2.Session, _003CeCopy_003E5__3, overwriteValues: true);1544 val3 = workingCopyEntityLogic.OnWorkingCopySaving(_003CeCopy_003E5__3, _003Clp_003E5__2).ConfigureAwait(false);1545 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();1546 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)1547 {1548 num = (_003C_003E1__state = 2);1549 _003C_003Eu__2 = val2;1550 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CMakeWorkingCopy_OnSaving_003Ed__4>(ref val2, ref this);1551 return;1552 }1553 goto IL_02ca;1554 case 2:1555 val2 = _003C_003Eu__2;1556 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);1557 num = (_003C_003E1__state = -1);1558 goto IL_02ca;1559 case 3:1560 val2 = _003C_003Eu__2;1561 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);1562 num = (_003C_003E1__state = -1);1563 goto IL_034d;1564 case 4:1565 {1566 val2 = _003C_003Eu__2;1567 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);1568 num = (_003C_003E1__state = -1);1569 break;1570 }1571 IL_034d:1572 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();1573 val3 = workingCopyEntityLogic.OnWorkingCopySaved(_003CeCopy_003E5__3, _003Clp_003E5__2).ConfigureAwait(false);1574 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();1575 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)1576 {1577 num = (_003C_003E1__state = 4);1578 _003C_003Eu__2 = val2;1579 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CMakeWorkingCopy_OnSaving_003Ed__4>(ref val2, ref this);1580 return;1581 }1582 break;1583 IL_02ca:1584 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();1585 val3 = _003Clp_003E5__2.UnitOfWork.PutAsync(_003CeCopy_003E5__3, _003Clp_003E5__2.CancellationToken).ConfigureAwait(false);1586 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();1587 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)1588 {1589 num = (_003C_003E1__state = 3);1590 _003C_003Eu__2 = val2;1591 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CMakeWorkingCopy_OnSaving_003Ed__4>(ref val2, ref this);1592 return;1593 }1594 goto IL_034d;1595 }1596 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();1597 }1598 finally1599 {1600 if (num < 0 && _003C_003E7__wrap4 != null)1601 {1602 _003C_003E7__wrap4.Dispose();1603 }1604 }1605 _003C_003E7__wrap4 = null;1606 _003Clp_003E5__2.Entity.SetValue(workingCopyEntityLogic._wcParams.FKWorkColumn, _003CeCopy_003E5__3.GetValue<string>(_003CmTable_003E5__4.PrimaryKeyColumns[0].Columnname));1607 }1608 catch (System.Exception exception)1609 {1610 _003C_003E1__state = -2;1611 _003Clp_003E5__2 = null;1612 _003CeCopy_003E5__3 = null;1613 _003CmTable_003E5__4 = null;1614 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);1615 return;1616 }1617 _003C_003E1__state = -2;1618 _003Clp_003E5__2 = null;1619 _003CeCopy_003E5__3 = null;1620 _003CmTable_003E5__4 = null;1621 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();1622 }16231624 [DebuggerHidden]1625 private void SetStateMachine(IAsyncStateMachine stateMachine)1626 {1627 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);1628 }1629 }16301631 [StructLayout((LayoutKind)3)]1632 [CompilerGenerated]1633 private struct _003COnDeleteWorkingCopy_003Ed__16 : IAsyncStateMachine1634 {1635 public int _003C_003E1__state;16361637 public AsyncTaskMethodBuilder _003C_003Et__builder;16381639 public LogicParameter lp;16401641 public WorkingCopyEntityLogic<T> _003C_003E4__this;16421643 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__1;16441645 private ConfiguredTaskAwaiter _003C_003Eu__2;16461647 private void MoveNext()1648 {1649 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)1650 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)1651 //IL_00f0: Unknown result type (might be due to invalid IL or missing references)1652 //IL_0122: Unknown result type (might be due to invalid IL or missing references)1653 //IL_012d: Unknown result type (might be due to invalid IL or missing references)1654 //IL_0132: Unknown result type (might be due to invalid IL or missing references)1655 //IL_0136: Unknown result type (might be due to invalid IL or missing references)1656 //IL_013b: Unknown result type (might be due to invalid IL or missing references)1657 //IL_0168: Unknown result type (might be due to invalid IL or missing references)1658 //IL_016d: Unknown result type (might be due to invalid IL or missing references)1659 //IL_0175: Unknown result type (might be due to invalid IL or missing references)1660 //IL_0150: Unknown result type (might be due to invalid IL or missing references)1661 //IL_0152: Unknown result type (might be due to invalid IL or missing references)1662 //IL_009a: Unknown result type (might be due to invalid IL or missing references)1663 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)1664 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)1665 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)1666 //IL_00b3: Unknown result type (might be due to invalid IL or missing references)1667 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)1668 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)1669 int num = _003C_003E1__state;1670 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;1671 try1672 {1673 ConfiguredTaskAwaiter<IEntity> val;1674 if (num == 0)1675 {1676 val = _003C_003Eu__1;1677 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity>);1678 num = (_003C_003E1__state = -1);1679 goto IL_00ff;1680 }1681 ConfiguredTaskAwaiter val2;1682 if (num == 1)1683 {1684 val2 = _003C_003Eu__2;1685 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);1686 num = (_003C_003E1__state = -1);1687 goto IL_0184;1688 }1689 string value = lp.Entity.GetValue<string>(workingCopyEntityLogic._wcParams.FKWorkColumn);1690 if (!string.IsNullOrEmpty(value))1691 {1692 string moduleOwner = lp.Session.Database().ModuleOwner;1693 string moduleOwner2 = Uid.GetModuleOwner(value);1694 if (string.Equals(moduleOwner, moduleOwner2, (StringComparison)5))1695 {1696 DbObjectKey objectKey = DbObjectKey.GetObjectKey(lp.Entity.Tablename, value);1697 val = lp.Session.Source().GetAsync(objectKey, lp.CancellationToken).ConfigureAwait(false)1698 .GetAwaiter();1699 if (!val.IsCompleted)1700 {1701 num = (_003C_003E1__state = 0);1702 _003C_003Eu__1 = val;1703 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003COnDeleteWorkingCopy_003Ed__16>(ref val, ref this);1704 return;1705 }1706 goto IL_00ff;1707 }1708 }1709 goto end_IL_000e;1710 IL_00ff:1711 IEntity result = val.GetResult();1712 result.MarkForDeletion();1713 ConfiguredTaskAwaitable val3 = lp.UnitOfWork.PutAsync(result, lp.CancellationToken).ConfigureAwait(false);1714 val2 = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();1715 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)1716 {1717 num = (_003C_003E1__state = 1);1718 _003C_003Eu__2 = val2;1719 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnDeleteWorkingCopy_003Ed__16>(ref val2, ref this);1720 return;1721 }1722 goto IL_0184;1723 IL_0184:1724 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();1725 end_IL_000e:;1726 }1727 catch (System.Exception exception)1728 {1729 _003C_003E1__state = -2;1730 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);1731 return;1732 }1733 _003C_003E1__state = -2;1734 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();1735 }17361737 [DebuggerHidden]1738 private void SetStateMachine(IAsyncStateMachine stateMachine)1739 {1740 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);1741 }1742 }17431744 [StructLayout((LayoutKind)3)]1745 [CompilerGenerated]1746 private struct _003COnSavedAsync_003Ed__2 : IAsyncStateMachine1747 {1748 public int _003C_003E1__state;17491750 public AsyncTaskMethodBuilder _003C_003Et__builder;17511752 public IEntity entity;17531754 public LogicReadWriteParameters parameters;17551756 public CancellationToken cancellationToken;17571758 public WorkingCopyEntityLogic<T> _003C_003E4__this;17591760 private ConfiguredTaskAwaiter _003C_003Eu__1;17611762 private void MoveNext()1763 {1764 //IL_0081: Unknown result type (might be due to invalid IL or missing references)1765 //IL_0086: Unknown result type (might be due to invalid IL or missing references)1766 //IL_008d: Unknown result type (might be due to invalid IL or missing references)1767 //IL_00f5: Unknown result type (might be due to invalid IL or missing references)1768 //IL_00fa: Unknown result type (might be due to invalid IL or missing references)1769 //IL_0101: Unknown result type (might be due to invalid IL or missing references)1770 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)1771 //IL_00bc: Unknown result type (might be due to invalid IL or missing references)1772 //IL_00c1: Unknown result type (might be due to invalid IL or missing references)1773 //IL_00c5: Unknown result type (might be due to invalid IL or missing references)1774 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)1775 //IL_0032: Unknown result type (might be due to invalid IL or missing references)1776 //IL_0045: Unknown result type (might be due to invalid IL or missing references)1777 //IL_004a: Unknown result type (might be due to invalid IL or missing references)1778 //IL_004e: Unknown result type (might be due to invalid IL or missing references)1779 //IL_0053: Unknown result type (might be due to invalid IL or missing references)1780 //IL_00de: Unknown result type (might be due to invalid IL or missing references)1781 //IL_00df: Unknown result type (might be due to invalid IL or missing references)1782 //IL_0067: Unknown result type (might be due to invalid IL or missing references)1783 //IL_0068: Unknown result type (might be due to invalid IL or missing references)1784 int num = _003C_003E1__state;1785 WorkingCopyEntityLogic<T> workingCopyEntityLogic = _003C_003E4__this;1786 try1787 {1788 ConfiguredTaskAwaiter val;1789 ConfiguredTaskAwaitable val2;1790 if (num != 0)1791 {1792 if (num == 1)1793 {1794 val = _003C_003Eu__1;1795 _003C_003Eu__1 = default(ConfiguredTaskAwaiter);1796 num = (_003C_003E1__state = -1);1797 goto IL_0110;1798 }1799 if (!entity.IsDeleted())1800 {1801 goto IL_00a3;1802 }1803 LogicParameter lp = new LogicParameter(entity, parameters, cancellationToken);1804 val2 = workingCopyEntityLogic.OnDeleteWorkingCopy(lp).ConfigureAwait(false);1805 val = ((ConfiguredTaskAwaitable)(ref val2)).GetAwaiter();1806 if (!((ConfiguredTaskAwaiter)(ref val)).IsCompleted)1807 {1808 num = (_003C_003E1__state = 0);1809 _003C_003Eu__1 = val;1810 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavedAsync_003Ed__2>(ref val, ref this);1811 return;1812 }1813 }1814 else1815 {1816 val = _003C_003Eu__1;1817 _003C_003Eu__1 = default(ConfiguredTaskAwaiter);1818 num = (_003C_003E1__state = -1);1819 }1820 ((ConfiguredTaskAwaiter)(ref val)).GetResult();1821 goto IL_00a3;1822 IL_0110:1823 ((ConfiguredTaskAwaiter)(ref val)).GetResult();1824 goto end_IL_000e;1825 IL_00a3:1826 val2 = ((StateBasedEntityLogic)workingCopyEntityLogic).OnSavedAsync(entity, parameters, cancellationToken).ConfigureAwait(false);1827 val = ((ConfiguredTaskAwaitable)(ref val2)).GetAwaiter();1828 if (!((ConfiguredTaskAwaiter)(ref val)).IsCompleted)1829 {1830 num = (_003C_003E1__state = 1);1831 _003C_003Eu__1 = val;1832 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavedAsync_003Ed__2>(ref val, ref this);1833 return;1834 }1835 goto IL_0110;1836 end_IL_000e:;1837 }1838 catch (System.Exception exception)1839 {1840 _003C_003E1__state = -2;1841 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);1842 return;1843 }1844 _003C_003E1__state = -2;1845 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();1846 }18471848 [DebuggerHidden]1849 private void SetStateMachine(IAsyncStateMachine stateMachine)1850 {1851 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);1852 }1853 }18541855 private readonly WorkingCopyEntityLogicParameter _wcParams;18561857 public WorkingCopyEntityLogic(EntityLogicConstructionParameters cParams, WorkingCopyEntityLogicParameter wcParams)1858 {1859 //IL_0025: Unknown result type (might be due to invalid IL or missing references)1860 WorkingCopyEntityLogic<T> workingCopyEntityLogic = this;1861 _wcParams = wcParams ?? throw new ArgumentNullException("wcParams");1862 _wcParams.Table = cParams.Table;1863 RegisterExpensive("_EditFlags").DependsOn(wcParams.Triggers).As<T>((Func<ISession, IEntity, IEntityWalker, CancellationToken, System.Threading.Tasks.Task<T>>)(object)(Func<ISession, IEntity, IEntityWalker, CancellationToken, System.Threading.Tasks.Task<ISession>>)((ISession s, IEntity e, IEntityWalker w, CancellationToken ct) => workingCopyEntityLogic.GetEditFlags(cParams.Table, e, s)));1864 Value("IsWorkingCopy").Default(value: true);1865 System.Collections.Generic.IEnumerator<IMetaColumn> enumerator = Enumerable.Where<IMetaColumn>((System.Collections.Generic.IEnumerable<IMetaColumn>)cParams.Table.Columns, (Func<IMetaColumn, bool>)((IMetaColumn c) => c.Enabled)).GetEnumerator();1866 try1867 {1868 while (((System.Collections.IEnumerator)enumerator).MoveNext())1869 {1870 IMetaColumn vColumn = enumerator.Current;1871 if (_wcParams.ColumnsDefinition != null && _wcParams.ColumnsDefinition.ContainsKey(vColumn.Columnname))1872 {1873 CanEdit(vColumn.Columnname).From("_EditFlags").As<T>((Func<T, bool>)((T f) => workingCopyEntityLogic.CheckEditFlags(f, workingCopyEntityLogic._wcParams.ColumnsDefinition[vColumn.Columnname])));1874 }1875 else1876 {1877 CanEdit(vColumn.Columnname).From("IsWorkingCopy").As<bool>((Func<bool, bool>)((bool b) => b));1878 }1879 }1880 }1881 finally1882 {1883 ((System.IDisposable)enumerator)?.Dispose();1884 }1885 RegisterExtendedMethod("MakeWorkingCopy").As<object>((Func<ISession, IEntity, CancellationToken, System.Threading.Tasks.Task<object>>)MakeWorkingCopy).OnSaving(MakeWorkingCopy_OnSaving).Enabled()1886 .From("IsWorkingCopy")1887 .As<bool>((Func<bool, bool>)((bool b) => !b))1888 .Visible()1889 .From("IsWorkingCopy")1890 .As<bool>((Func<bool, bool>)((bool b) => !b))1891 .Behavior(MethodBehavior.ChangesExternalState)1892 .Description("Method_WorkingCopyEntityLogic_MakeWorkingCopy");1893 RegisterMethod("ActivateWorkingCopy").As<bool>(ActivateWorkingCopy).Enabled().From("IsWorkingCopy")1894 .As<bool>((Func<bool, bool>)((bool b) => b))1895 .Visible()1896 .From("IsWorkingCopy")1897 .As<bool>((Func<bool, bool>)((bool b) => b))1898 .Behavior(MethodBehavior.ChangesExternalState)1899 .Description("Method_WorkingCopyEntityLogic_ActivateWorkingCopy");1900 RegisterFunction("Copy").As<Dictionary<string, object>, DbObjectKey>(Copy).Behavior(MethodBehavior.ChangesExternalState).Description("Method_WorkingCopyEntityLogic_Copy");1901 if (cParams.Table.Columns.Contains("IsInActive"))1902 {1903 Value("IsInactive").Default(value: true);1904 RegisterMethod("Enable").As(Enable).Enabled().From("IsWorkingCopy", "IsInActive")1905 .As<bool, bool>((Func<bool, bool, bool>)((bool w, bool i) => !w && i))1906 .Visible()1907 .From("IsWorkingCopy", "IsInActive")1908 .As<bool, bool>((Func<bool, bool, bool>)((bool w, bool i) => !w && i))1909 .Description("Method_WorkingCopyEntityLogic_Enable");1910 RegisterMethod("Disable").As(Disable).Enabled().From("IsWorkingCopy", "IsInActive")1911 .As<bool, bool>((Func<bool, bool, bool>)((bool w, bool i) => !w && !i))1912 .Visible()1913 .From("IsWorkingCopy", "IsInActive")1914 .As<bool, bool>((Func<bool, bool, bool>)((bool w, bool i) => !w && !i))1915 .Description("Method_WorkingCopyEntityLogic_Disable");1916 }1917 }19181919 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003COnSavedAsync_003Ed__2))]1920 public override System.Threading.Tasks.Task OnSavedAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken)1921 {1922 //IL_0002: Unknown result type (might be due to invalid IL or missing references)1923 //IL_0007: Unknown result type (might be due to invalid IL or missing references)1924 //IL_0026: Unknown result type (might be due to invalid IL or missing references)1925 //IL_0027: Unknown result type (might be due to invalid IL or missing references)1926 _003COnSavedAsync_003Ed__2 _003COnSavedAsync_003Ed__ = default(_003COnSavedAsync_003Ed__2);1927 _003COnSavedAsync_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();1928 _003COnSavedAsync_003Ed__._003C_003E4__this = this;1929 _003COnSavedAsync_003Ed__.entity = entity;1930 _003COnSavedAsync_003Ed__.parameters = parameters;1931 _003COnSavedAsync_003Ed__.cancellationToken = cancellationToken;1932 _003COnSavedAsync_003Ed__._003C_003E1__state = -1;1933 ((AsyncTaskMethodBuilder)(ref _003COnSavedAsync_003Ed__._003C_003Et__builder)).Start<_003COnSavedAsync_003Ed__2>(ref _003COnSavedAsync_003Ed__);1934 return ((AsyncTaskMethodBuilder)(ref _003COnSavedAsync_003Ed__._003C_003Et__builder)).Task;1935 }19361937 private System.Threading.Tasks.Task<object> MakeWorkingCopy(ISession session, IEntity entity, CancellationToken ct)1938 {1939 return NullTask<object>.Instance;1940 }19411942 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003CMakeWorkingCopy_OnSaving_003Ed__4))]1943 private System.Threading.Tasks.Task MakeWorkingCopy_OnSaving(IEntity entity, LogicReadWriteParameters parameter, object o, CancellationToken ct)1944 {1945 //IL_0002: Unknown result type (might be due to invalid IL or missing references)1946 //IL_0007: Unknown result type (might be due to invalid IL or missing references)1947 //IL_0026: Unknown result type (might be due to invalid IL or missing references)1948 //IL_0028: Unknown result type (might be due to invalid IL or missing references)1949 _003CMakeWorkingCopy_OnSaving_003Ed__4 _003CMakeWorkingCopy_OnSaving_003Ed__ = default(_003CMakeWorkingCopy_OnSaving_003Ed__4);1950 _003CMakeWorkingCopy_OnSaving_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();1951 _003CMakeWorkingCopy_OnSaving_003Ed__._003C_003E4__this = this;1952 _003CMakeWorkingCopy_OnSaving_003Ed__.entity = entity;1953 _003CMakeWorkingCopy_OnSaving_003Ed__.parameter = parameter;1954 _003CMakeWorkingCopy_OnSaving_003Ed__.ct = ct;1955 _003CMakeWorkingCopy_OnSaving_003Ed__._003C_003E1__state = -1;1956 ((AsyncTaskMethodBuilder)(ref _003CMakeWorkingCopy_OnSaving_003Ed__._003C_003Et__builder)).Start<_003CMakeWorkingCopy_OnSaving_003Ed__4>(ref _003CMakeWorkingCopy_OnSaving_003Ed__);1957 return ((AsyncTaskMethodBuilder)(ref _003CMakeWorkingCopy_OnSaving_003Ed__._003C_003Et__builder)).Task;1958 }19591960 protected virtual System.Threading.Tasks.Task OnWorkingCopySaving(IEntity eCopy, LogicParameter lp)1961 {1962 return NullTask.Instance;1963 }19641965 protected virtual System.Threading.Tasks.Task OnWorkingCopySaved(IEntity eCopy, LogicParameter lp)1966 {1967 return NullTask.Instance;1968 }19691970 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003CActivateWorkingCopy_003Ed__7))]1971 private System.Threading.Tasks.Task ActivateWorkingCopy(ISession session, IEntity entity, bool bEnable = false, CancellationToken ct = default(CancellationToken))1972 {1973 //IL_0002: Unknown result type (might be due to invalid IL or missing references)1974 //IL_0007: Unknown result type (might be due to invalid IL or missing references)1975 //IL_002e: Unknown result type (might be due to invalid IL or missing references)1976 //IL_0030: Unknown result type (might be due to invalid IL or missing references)1977 _003CActivateWorkingCopy_003Ed__7 _003CActivateWorkingCopy_003Ed__ = default(_003CActivateWorkingCopy_003Ed__7);1978 _003CActivateWorkingCopy_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();1979 _003CActivateWorkingCopy_003Ed__._003C_003E4__this = this;1980 _003CActivateWorkingCopy_003Ed__.session = session;1981 _003CActivateWorkingCopy_003Ed__.entity = entity;1982 _003CActivateWorkingCopy_003Ed__.bEnable = bEnable;1983 _003CActivateWorkingCopy_003Ed__.ct = ct;1984 _003CActivateWorkingCopy_003Ed__._003C_003E1__state = -1;1985 ((AsyncTaskMethodBuilder)(ref _003CActivateWorkingCopy_003Ed__._003C_003Et__builder)).Start<_003CActivateWorkingCopy_003Ed__7>(ref _003CActivateWorkingCopy_003Ed__);1986 return ((AsyncTaskMethodBuilder)(ref _003CActivateWorkingCopy_003Ed__._003C_003Et__builder)).Task;1987 }19881989 protected virtual System.Threading.Tasks.Task OnActiveCopySaved(IEntity eRule, LogicParameter lp)1990 {1991 return NullTask.Instance;1992 }19931994 protected virtual System.Threading.Tasks.Task OnActiveCopySaving(IEntity eRule, LogicParameter lp)1995 {1996 return NullTask.Instance;1997 }19981999 protected virtual System.Threading.Tasks.Task OnCopySaved(IEntity eCopy, LogicParameter lp)2000 {2001 return NullTask.Instance;2002 }20032004 protected virtual System.Threading.Tasks.Task OnCopySaving(IEntity eCopy, LogicParameter lp)2005 {2006 return NullTask.Instance;2007 }20082009 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003CCopy_003Ed__12))]2010 private async System.Threading.Tasks.Task<DbObjectKey> Copy(ISession session, IEntity entity, Dictionary<string, object>? values = null, CancellationToken ct = default(CancellationToken))2011 {2012 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2013 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2014 //IL_002e: Unknown result type (might be due to invalid IL or missing references)2015 //IL_0030: Unknown result type (might be due to invalid IL or missing references)2016 using IUnitOfWork uoWork = session.StartUnitOfWork();2017 LogicParameter lp = new LogicParameter(session, null, entity, uoWork, entity.CreateWalker(session), ct);2018 IMetaTable mTable = _wcParams.Table;2019 IEntity eCopy = await lp.Session.Source().CreateNewAsync(mTable.Tablename, EntityCreationType.Interactive, lp.CancellationToken).ConfigureAwait(false);2020 PropertyBag propertyBag = new PropertyBag();2021 if (!_wcParams.ExcludeColumns.Contains("IsWorkingCopy"))2022 {2023 _wcParams.ExcludeColumns.Add("isworkingcopy");2024 }2025 if (!_wcParams.ExcludeColumns.Contains("IsInactive"))2026 {2027 _wcParams.ExcludeColumns.Add("isinactive");2028 }2029 propertyBag.FillFromEntity(mTable, lp.Entity, (System.Collections.Generic.IEnumerable<string>)_wcParams.ExcludeColumns);2030 PropertyBag propertyBag2 = new PropertyBag();2031 if (values != null && values.Count > 0)2032 {2033 Enumerator<string, object> enumerator = values.GetEnumerator();2034 try2035 {2036 while (enumerator.MoveNext())2037 {2038 KeyValuePair<string, object> current = enumerator.Current;2039 propertyBag2.PutValue(current.Key, current.Value);2040 }2041 }2042 finally2043 {2044 ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();2045 }2046 }2047 propertyBag2.PutValue(_wcParams.FKWorkColumn, "");2048 propertyBag2.PutValue("IsWorkingCopy", true);2049 if (mTable.Columns.Contains("IsInactive"))2050 {2051 propertyBag2.PutValue("IsInactive", true);2052 }2053 using (StartInternalProcess())2054 {2055 propertyBag.ChangeEntity(lp.Session, eCopy, overwriteValues: true);2056 propertyBag2.ChangeEntity(lp.Session, eCopy, overwriteValues: true);2057 await OnCopySaving(eCopy, lp).ConfigureAwait(false);2058 await uoWork.PutAsync(eCopy, lp.CancellationToken).ConfigureAwait(false);2059 await OnCopySaved(eCopy, lp).ConfigureAwait(false);2060 await uoWork.CommitAsync(ct).ConfigureAwait(false);2061 }2062 return new DbObjectKey(mTable, eCopy);2063 }20642065 private System.Threading.Tasks.Task Enable(ISession session, IEntity entity, CancellationToken ct)2066 {2067 if (entity.GetValue("IsWorkingCopy").Bool)2068 {2069 throw new ViException(2127237, ExceptionRelevance.EndUser);2070 }2071 entity.SetValue("IsInActive", false);2072 return NullTask.Instance;2073 }20742075 private System.Threading.Tasks.Task Disable(ISession session, IEntity entity, CancellationToken ct)2076 {2077 if (entity.GetValue("IsWorkingCopy").Bool)2078 {2079 throw new ViException(2127237, ExceptionRelevance.EndUser);2080 }2081 entity.SetValue("IsInActive", true);2082 return NullTask.Instance;2083 }20842085 protected abstract System.Threading.Tasks.Task<T> GetEditFlags(IMetaTable m, IEntity e, ISession s);20862087 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003COnDeleteWorkingCopy_003Ed__16))]2088 protected virtual System.Threading.Tasks.Task OnDeleteWorkingCopy(LogicParameter lp)2089 {2090 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2091 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2092 _003COnDeleteWorkingCopy_003Ed__16 _003COnDeleteWorkingCopy_003Ed__ = default(_003COnDeleteWorkingCopy_003Ed__16);2093 _003COnDeleteWorkingCopy_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();2094 _003COnDeleteWorkingCopy_003Ed__._003C_003E4__this = this;2095 _003COnDeleteWorkingCopy_003Ed__.lp = lp;2096 _003COnDeleteWorkingCopy_003Ed__._003C_003E1__state = -1;2097 ((AsyncTaskMethodBuilder)(ref _003COnDeleteWorkingCopy_003Ed__._003C_003Et__builder)).Start<_003COnDeleteWorkingCopy_003Ed__16>(ref _003COnDeleteWorkingCopy_003Ed__);2098 return ((AsyncTaskMethodBuilder)(ref _003COnDeleteWorkingCopy_003Ed__._003C_003Et__builder)).Task;2099 }21002101 protected virtual bool CheckEditFlags(T f, string mask)2102 {2103 return new BinaryExpressionParser((string s) => CheckEditFlag(f, s)).Parse(mask);2104 }21052106 protected virtual bool CheckEditFlag(T f, string token)2107 {2108 if (string.Equals(token, "False", (StringComparison)5))2109 {2110 return false;2111 }2112 return ((System.Enum)(object)f).HasFlag((System.Enum)System.Enum.Parse(typeof(T), token));2113 }21142115 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003CCopyCR_003Ed__19))]2116 protected virtual System.Threading.Tasks.Task CopyCR(IMetaTableRelation crRelation, IEntity eSource, IEntity eDestination, LogicParameter lp)2117 {2118 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2119 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2120 _003CCopyCR_003Ed__19 _003CCopyCR_003Ed__ = default(_003CCopyCR_003Ed__19);2121 _003CCopyCR_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();2122 _003CCopyCR_003Ed__._003C_003E4__this = this;2123 _003CCopyCR_003Ed__.crRelation = crRelation;2124 _003CCopyCR_003Ed__.eSource = eSource;2125 _003CCopyCR_003Ed__.eDestination = eDestination;2126 _003CCopyCR_003Ed__.lp = lp;2127 _003CCopyCR_003Ed__._003C_003E1__state = -1;2128 ((AsyncTaskMethodBuilder)(ref _003CCopyCR_003Ed__._003C_003Et__builder)).Start<_003CCopyCR_003Ed__19>(ref _003CCopyCR_003Ed__);2129 return ((AsyncTaskMethodBuilder)(ref _003CCopyCR_003Ed__._003C_003Et__builder)).Task;2130 }21312132 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003CCopyCRObject_003Ed__20))]2133 protected virtual System.Threading.Tasks.Task CopyCRObject(IMetaTableRelation crRelation, IEntity crSource, IEntity eDestination, LogicParameter lp)2134 {2135 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2136 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2137 _003CCopyCRObject_003Ed__20 _003CCopyCRObject_003Ed__ = default(_003CCopyCRObject_003Ed__20);2138 _003CCopyCRObject_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();2139 _003CCopyCRObject_003Ed__._003C_003E4__this = this;2140 _003CCopyCRObject_003Ed__.crRelation = crRelation;2141 _003CCopyCRObject_003Ed__.crSource = crSource;2142 _003CCopyCRObject_003Ed__.eDestination = eDestination;2143 _003CCopyCRObject_003Ed__.lp = lp;2144 _003CCopyCRObject_003Ed__._003C_003E1__state = -1;2145 ((AsyncTaskMethodBuilder)(ref _003CCopyCRObject_003Ed__._003C_003Et__builder)).Start<_003CCopyCRObject_003Ed__20>(ref _003CCopyCRObject_003Ed__);2146 return ((AsyncTaskMethodBuilder)(ref _003CCopyCRObject_003Ed__._003C_003Et__builder)).Task;2147 }21482149 protected virtual System.Threading.Tasks.Task OnRelationObjectSaved(IEntity crSource, IEntity eCopy, LogicParameter lp)2150 {2151 return NullTask.Instance;2152 }21532154 protected virtual System.Threading.Tasks.Task OnRelationObjectSaving(IEntity crSource, IEntity eCopy, LogicParameter lp)2155 {2156 return NullTask.Instance;2157 }21582159 [AsyncStateMachine(typeof(WorkingCopyEntityLogic<>._003CCopyMN_003Ed__23))]2160 protected virtual System.Threading.Tasks.Task CopyMN(IMetaTableRelation mnRelation, string mnTargetColumn, IEntity eSource, IEntity eDestination, LogicParameter lp)2161 {2162 //IL_0002: Unknown result type (might be due to invalid IL or missing references)2163 //IL_0007: Unknown result type (might be due to invalid IL or missing references)2164 _003CCopyMN_003Ed__23 _003CCopyMN_003Ed__ = default(_003CCopyMN_003Ed__23);2165 _003CCopyMN_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();2166 _003CCopyMN_003Ed__.mnRelation = mnRelation;2167 _003CCopyMN_003Ed__.mnTargetColumn = mnTargetColumn;2168 _003CCopyMN_003Ed__.eSource = eSource;2169 _003CCopyMN_003Ed__.eDestination = eDestination;2170 _003CCopyMN_003Ed__.lp = lp;2171 _003CCopyMN_003Ed__._003C_003E1__state = -1;2172 ((AsyncTaskMethodBuilder)(ref _003CCopyMN_003Ed__._003C_003Et__builder)).Start<_003CCopyMN_003Ed__23>(ref _003CCopyMN_003Ed__);2173 return ((AsyncTaskMethodBuilder)(ref _003CCopyMN_003Ed__._003C_003Et__builder)).Task;2174 }2175}2176