Back to OIM Explorer

ADS.Customizer/ADS.Customizer/ADSMachine.cs

Decompiler Source FileADS.Customizer.ADSMachineDecompiled Source

1 extracted method/event/call references in ADSMachine.

Source: F:\Claude\.tmp\oim-decompiled-full\0013_One_Identity_Manager_ADS.Customizer.dll\ADS.Customizer\ADSMachine.cs

Source size: 27.332 characters

Interpretation

  • Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.

Relations

  • CustomGenerated event: OverLimit at line 440

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 references DB/Dialog objects

Summary: classes ADSMachine; methods MoveNext, SetStateMachine, OnSavingAsync, OnSavedAsync, _CheckUidADSDomain, _CheckADSPrimaryGroup; references ADSContainer, ADSDomain, ADSGroup, ADSMachine, ADSMachineInADSGroup; markers reads entity values, references DB/Dialog objects

Classes

ADSMachine

OIM key/entity markers

UID_ADSDomain UID_ADSContainer XObjectKey UID_ADSGroupPrimary UID_ADSMachine UID_ADSGroup

API/entity calls

GetValue ExistsAsync IsFullSync IsDeleted AddPreCommitHook SqlFormatter GetValue Source

Registrations / handlers

None extracted.

Complete Source

C#562 lines
1using System;2using System.Diagnostics;3using System.Runtime.CompilerServices;4using System.Runtime.InteropServices;5using System.Threading;6using System.Threading.Tasks;7using TSB.Customizer;8using VI.Base;9using VI.DB;10using VI.DB.Entities;1112namespace ADS.Customizer;1314public class ADSMachine : DirectoryObjectEntityLogic15{16	[StructLayout((LayoutKind)3)]17	[CompilerGenerated]18	private struct _003COnSavedAsync_003Ed__3 : IAsyncStateMachine19	{20		public int _003C_003E1__state;2122		public AsyncTaskMethodBuilder _003C_003Et__builder;2324		public IEntity entity;2526		public LogicReadWriteParameters parameters;2728		public CancellationToken cancellationToken;2930		public ADSMachine _003C_003E4__this;3132		private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;3334		private ConfiguredTaskAwaiter _003C_003Eu__2;3536		private void MoveNext()37		{38			//IL_006b: Unknown result type (might be due to invalid IL or missing references)39			//IL_0070: Unknown result type (might be due to invalid IL or missing references)40			//IL_0077: Unknown result type (might be due to invalid IL or missing references)41			//IL_009c: Unknown result type (might be due to invalid IL or missing references)42			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)43			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)44			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)45			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)46			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)47			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)48			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)49			//IL_0025: Unknown result type (might be due to invalid IL or missing references)50			//IL_0030: Unknown result type (might be due to invalid IL or missing references)51			//IL_0035: Unknown result type (might be due to invalid IL or missing references)52			//IL_0038: Unknown result type (might be due to invalid IL or missing references)53			//IL_003d: Unknown result type (might be due to invalid IL or missing references)54			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)55			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)56			//IL_0051: Unknown result type (might be due to invalid IL or missing references)57			//IL_0052: Unknown result type (might be due to invalid IL or missing references)58			int num = _003C_003E1__state;59			ADSMachine aDSMachine = _003C_003E4__this;60			try61			{62				ConfiguredTaskAwaiter val;63				ConfiguredTaskAwaiter<bool> val2;64				if (num != 0)65				{66					if (num == 1)67					{68						val = _003C_003Eu__2;69						_003C_003Eu__2 = default(ConfiguredTaskAwaiter);70						num = (_003C_003E1__state = -1);71						goto IL_00fe;72					}73					val2 = ADSHelper.CheckObjectKeyManager(entity, parameters, cancellationToken).ConfigureAwait(false).GetAwaiter();74					if (!val2.IsCompleted)75					{76						num = (_003C_003E1__state = 0);77						_003C_003Eu__1 = val2;78						((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003COnSavedAsync_003Ed__3>(ref val2, ref this);79						return;80					}81				}82				else83				{84					val2 = _003C_003Eu__1;85					_003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);86					num = (_003C_003E1__state = -1);87				}88				val2.GetResult();89				ConfiguredTaskAwaitable val3 = ((StateBasedEntityLogic)aDSMachine).OnSavedAsync(entity, parameters, cancellationToken).ConfigureAwait(false);90				val = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();91				if (!((ConfiguredTaskAwaiter)(ref val)).IsCompleted)92				{93					num = (_003C_003E1__state = 1);94					_003C_003Eu__2 = val;95					((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavedAsync_003Ed__3>(ref val, ref this);96					return;97				}98				goto IL_00fe;99				IL_00fe:100				((ConfiguredTaskAwaiter)(ref val)).GetResult();101			}102			catch (System.Exception exception)103			{104				_003C_003E1__state = -2;105				((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);106				return;107			}108			_003C_003E1__state = -2;109			((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();110		}111112		[DebuggerHidden]113		private void SetStateMachine(IAsyncStateMachine stateMachine)114		{115			((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);116		}117	}118119	[StructLayout((LayoutKind)3)]120	[CompilerGenerated]121	private struct _003COnSavingAsync_003Ed__2 : IAsyncStateMachine122	{123		public int _003C_003E1__state;124125		public AsyncTaskMethodBuilder<Diff> _003C_003Et__builder;126127		public LogicReadWriteParameters parameters;128129		public IEntity entity;130131		public CancellationToken ct;132133		public ADSMachine _003C_003E4__this;134135		private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;136137		private ConfiguredTaskAwaiter _003C_003Eu__2;138139		private ConfiguredTaskAwaiter<Diff> _003C_003Eu__3;140141		private void MoveNext()142		{143			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)144			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)145			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)146			//IL_0380: Unknown result type (might be due to invalid IL or missing references)147			//IL_0385: Unknown result type (might be due to invalid IL or missing references)148			//IL_038d: Unknown result type (might be due to invalid IL or missing references)149			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)150			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)151			//IL_0404: Unknown result type (might be due to invalid IL or missing references)152			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)153			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)154			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)155			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)156			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)157			//IL_03df: Unknown result type (might be due to invalid IL or missing references)158			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)159			//IL_0337: Unknown result type (might be due to invalid IL or missing references)160			//IL_0342: Unknown result type (might be due to invalid IL or missing references)161			//IL_0347: Unknown result type (might be due to invalid IL or missing references)162			//IL_034b: Unknown result type (might be due to invalid IL or missing references)163			//IL_0350: Unknown result type (might be due to invalid IL or missing references)164			//IL_0365: Unknown result type (might be due to invalid IL or missing references)165			//IL_0367: Unknown result type (might be due to invalid IL or missing references)166			//IL_027e: Unknown result type (might be due to invalid IL or missing references)167			//IL_0289: Unknown result type (might be due to invalid IL or missing references)168			//IL_028e: Unknown result type (might be due to invalid IL or missing references)169			//IL_0292: Unknown result type (might be due to invalid IL or missing references)170			//IL_0297: Unknown result type (might be due to invalid IL or missing references)171			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)172			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)173			int num = _003C_003E1__state;174			ADSMachine aDSMachine = _003C_003E4__this;175			Diff result;176			try177			{178				ConfiguredTaskAwaiter<bool> val3;179				ConfiguredTaskAwaiter val2;180				ConfiguredTaskAwaiter<Diff> val;181				switch (num)182				{183				default:184				{185					ISession session = parameters.Session;186					string value = entity.GetValue<string>("UID_ADSDomain");187					if (!parameters.Session.IsFullSync() && entity.GetValue<bool>("IsProtectedFromAccidentalDel") && (entity.GetValue<int>("xmarkedfordeletion") & 2) == 0 && (entity.IsDeleted() || (entity.IsLoaded && entity.Columns["UID_ADSContainer"].IsChanged)))188					{189						throw new ViException(2105410, ExceptionRelevance.EndUser);190					}191					if (!session.IsFullSync() && !entity.IsDeleted() && !string.IsNullOrEmpty(value))192					{193						if (entity.Columns.ChangedAny("UID_ADSDomain", "UID_ADSContainer", "cn"))194						{195							ISqlFormatter sqlFormatter = session.Resolve<ISqlFormatter>();196							global::_003C_003Ey__InlineArray9<string> buffer = default(global::_003C_003Ey__InlineArray9<string>);197							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 0) = "(";198							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 1) = sqlFormatter.FormatValue(entity.Columns["cn"].GetValue<string>(), ValType.String, forUpdate: true);199							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 2) = ", ";200							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 3) = sqlFormatter.FormatUidValue(entity.Columns["UID_ADSContainer"].GetValue<string>());201							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 4) = ", ";202							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 5) = sqlFormatter.FormatUidValue(entity.Columns["UID_ADSDomain"].GetValue<string>());203							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 6) = ", ";204							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 7) = sqlFormatter.FormatUidValue(entity.Columns["XObjectKey"].GetValue<string>());205							global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 8) = ")";206							string data = string.Concat(global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<global::_003C_003Ey__InlineArray9<string>, string>(in buffer, 9));207							parameters.Session.AddPreCommitHook("ADS_UniqueCnCheck", data, ADSHelper.IsUniqueCnInAdsBulk);208						}209						if (!entity.IsLoaded)210						{211							val3 = _CheckADSPrimaryGroup(session, entity, entity.GetValue<string>("UID_ADSGroupPrimary"), value, ct).ConfigureAwait(false).GetAwaiter();212							if (!val3.IsCompleted)213							{214								num = (_003C_003E1__state = 0);215								_003C_003Eu__1 = val3;216								_003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003COnSavingAsync_003Ed__2>(ref val3, ref this);217								return;218							}219							goto IL_02e3;220						}221					}222					goto IL_02eb;223				}224				case 0:225					val3 = _003C_003Eu__1;226					_003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);227					num = (_003C_003E1__state = -1);228					goto IL_02e3;229				case 1:230					val2 = _003C_003Eu__2;231					_003C_003Eu__2 = default(ConfiguredTaskAwaiter);232					num = (_003C_003E1__state = -1);233					goto IL_039c;234				case 2:235					{236						val = _003C_003Eu__3;237						_003C_003Eu__3 = default(ConfiguredTaskAwaiter<Diff>);238						num = (_003C_003E1__state = -1);239						break;240					}241					IL_02e3:242					val3.GetResult();243					goto IL_02eb;244					IL_039c:245					((ConfiguredTaskAwaiter)(ref val2)).GetResult();246					goto IL_03a3;247					IL_02eb:248					if (entity.Columns["UID_ADSContainer"].IsDifferent && !entity.IsDeleted())249					{250						ConfiguredTaskAwaitable val4 = ADSHelper.CheckContainerLimit(parameters.Session, entity, parameters.UnitOfWork, ct).ConfigureAwait(false);251						val2 = ((ConfiguredTaskAwaitable)(ref val4)).GetAwaiter();252						if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)253						{254							num = (_003C_003E1__state = 1);255							_003C_003Eu__2 = val2;256							_003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavingAsync_003Ed__2>(ref val2, ref this);257							return;258						}259						goto IL_039c;260					}261					goto IL_03a3;262					IL_03a3:263					val = ((DirectoryObjectEntityLogic)aDSMachine).OnSavingAsync(entity, parameters, ct).ConfigureAwait(false).GetAwaiter();264					if (!val.IsCompleted)265					{266						num = (_003C_003E1__state = 2);267						_003C_003Eu__3 = val;268						_003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Diff>, _003COnSavingAsync_003Ed__2>(ref val, ref this);269						return;270					}271					break;272				}273				result = val.GetResult();274			}275			catch (System.Exception exception)276			{277				_003C_003E1__state = -2;278				_003C_003Et__builder.SetException(exception);279				return;280			}281			_003C_003E1__state = -2;282			_003C_003Et__builder.SetResult(result);283		}284285		[DebuggerHidden]286		private void SetStateMachine(IAsyncStateMachine stateMachine)287		{288			_003C_003Et__builder.SetStateMachine(stateMachine);289		}290	}291292	[StructLayout((LayoutKind)3)]293	[CompilerGenerated]294	private struct _003C_CheckADSPrimaryGroup_003Ed__5 : IAsyncStateMachine295	{296		public int _003C_003E1__state;297298		public AsyncTaskMethodBuilder<bool> _003C_003Et__builder;299300		public ISession session;301302		public string uidAdsGroupPrimary;303304		public IEntity entity;305306		public CancellationToken ct;307308		public string uidAdsDomain;309310		private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;311312		private void MoveNext()313		{314			//IL_0104: Unknown result type (might be due to invalid IL or missing references)315			//IL_0109: Unknown result type (might be due to invalid IL or missing references)316			//IL_0111: Unknown result type (might be due to invalid IL or missing references)317			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)318			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)319			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)320			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)321			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)322			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)323			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)324			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)325			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)326			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)327			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)328			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)329			//IL_01be: Unknown result type (might be due to invalid IL or missing references)330			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)331			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)332			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)333			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)334			int num = _003C_003E1__state;335			bool result;336			try337			{338				ConfiguredTaskAwaiter<bool> val;339				if (num != 0)340				{341					if (num != 1)342					{343						ISqlFormatter sqlFormatter = session.SqlFormatter();344						if (string.IsNullOrEmpty(uidAdsGroupPrimary))345						{346							if (!string.IsNullOrEmpty((string)entity.GetValue("UID_ADSGroupPrimary")))347							{348								throw new ViException(2105197, ExceptionRelevance.EndUser);349							}350						}351						else352						{353							if (entity.IsLoaded)354							{355								string whereclause = sqlFormatter.AndRelation(sqlFormatter.UidComparison("UID_ADSMachine", entity.GetValue<string>("UID_ADSMachine")), sqlFormatter.UidComparison("UID_ADSGroup", uidAdsGroupPrimary));356								val = session.Source().ExistsAsync("ADSMachineInADSGroup", whereclause, ct).ConfigureAwait(false)357									.GetAwaiter();358								if (!val.IsCompleted)359								{360									num = (_003C_003E1__state = 0);361									_003C_003Eu__1 = val;362									_003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003C_CheckADSPrimaryGroup_003Ed__5>(ref val, ref this);363									return;364								}365								goto IL_0120;366							}367							if (!string.IsNullOrEmpty(uidAdsDomain))368							{369								string whereclause = sqlFormatter.AndRelation(sqlFormatter.UidComparison("UID_ADSDomain", uidAdsDomain), sqlFormatter.UidComparison("UID_ADSGroup", uidAdsGroupPrimary), sqlFormatter.Comparison("PrimaryGroupToken", "515", ValType.String));370								val = session.Source().ExistsAsync("ADSGroup", whereclause, ct).ConfigureAwait(false)371									.GetAwaiter();372								if (!val.IsCompleted)373								{374									num = (_003C_003E1__state = 1);375									_003C_003Eu__1 = val;376									_003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003C_CheckADSPrimaryGroup_003Ed__5>(ref val, ref this);377									return;378								}379								goto IL_0207;380							}381						}382						goto IL_022a;383					}384					val = _003C_003Eu__1;385					_003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);386					num = (_003C_003E1__state = -1);387					goto IL_0207;388				}389				val = _003C_003Eu__1;390				_003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);391				num = (_003C_003E1__state = -1);392				goto IL_0120;393				IL_022a:394				result = true;395				goto end_IL_0007;396				IL_0120:397				if (!val.GetResult())398				{399					throw new ViException(2105198, ExceptionRelevance.EndUser);400				}401				goto IL_022a;402				IL_0207:403				if (!val.GetResult())404				{405					throw new ViException(2105413, ExceptionRelevance.EndUser, "Domain Computers");406				}407				goto IL_022a;408				end_IL_0007:;409			}410			catch (System.Exception exception)411			{412				_003C_003E1__state = -2;413				_003C_003Et__builder.SetException(exception);414				return;415			}416			_003C_003E1__state = -2;417			_003C_003Et__builder.SetResult(result);418		}419420		[DebuggerHidden]421		private void SetStateMachine(IAsyncStateMachine stateMachine)422		{423			_003C_003Et__builder.SetStateMachine(stateMachine);424		}425	}426427	private static DirectoryObjectEntityLogicParameter p = new DirectoryObjectEntityLogicParameter428	{429		Container = "UID_ADSContainer",430		Domain = "UID_ADSDomain"431	};432433	public ADSMachine(EntityLogicConstructionParameters ep)434		: base(ep, p)435	{436		using (base.Section.From("_NamespaceManagedBy").As<NameSpaceManagedBy>((Func<NameSpaceManagedBy, bool>)((NameSpaceManagedBy m) => m == NameSpaceManagedBy.VISYNC || m == NameSpaceManagedBy.ILM)))437		{438			MinLen("CanonicalName").Default(1);439		}440		Event("OverLimit").CustomGenerated();441		using (base.Section.From("_NamespaceManagedBy").As<NameSpaceManagedBy>((Func<NameSpaceManagedBy, bool>)((NameSpaceManagedBy m) => m == NameSpaceManagedBy.VISYNC)))442		{443			MinLen("UID_ADSDomain").Default(1);444			using (base.Section.Except("SPECIAL(IsFullSync)"))445			{446				Check("UID_ADSDomain").With("[IsLoaded]", "UID_ADSDomain[o]").As<string, bool, string>((Func<string, bool, string, bool>)_CheckUidADSDomain);447				Check("UID_ADSGroupPrimary").AsExpensive<string>((Func<ISession, IEntity, string, CancellationToken, System.Threading.Tasks.Task<bool>>)((ISession s, IEntity e, string v, CancellationToken ct) => _CheckADSPrimaryGroup(s, e, v, null, ct)));448				CanEdit("UID_ADSGroupPrimary").From("[IsLoaded]").As<bool>((Func<bool, bool>)((bool isLoaded) => isLoaded));449				MinLen("UID_ADSGroupPrimary").From("UID_ADSGroupPrimary[o]", "[IsLoaded]").As<string, bool>((Func<string, bool, int>)((string uid, bool isLoaded) => (!string.IsNullOrEmpty(uid) && isLoaded) ? 1 : 0));450			}451		}452	}453454	[AsyncStateMachine(typeof(_003COnSavingAsync_003Ed__2))]455	public override async System.Threading.Tasks.Task<Diff> OnSavingAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken ct)456	{457		//IL_0002: Unknown result type (might be due to invalid IL or missing references)458		//IL_0007: Unknown result type (might be due to invalid IL or missing references)459		//IL_0026: Unknown result type (might be due to invalid IL or missing references)460		//IL_0027: Unknown result type (might be due to invalid IL or missing references)461		ISession session = parameters.Session;462		string value = entity.GetValue<string>("UID_ADSDomain");463		if (!parameters.Session.IsFullSync() && entity.GetValue<bool>("IsProtectedFromAccidentalDel") && (entity.GetValue<int>("xmarkedfordeletion") & 2) == 0 && (entity.IsDeleted() || (entity.IsLoaded && entity.Columns["UID_ADSContainer"].IsChanged)))464		{465			throw new ViException(2105410, ExceptionRelevance.EndUser);466		}467		if (!session.IsFullSync() && !entity.IsDeleted() && !string.IsNullOrEmpty(value))468		{469			if (entity.Columns.ChangedAny("UID_ADSDomain", "UID_ADSContainer", "cn"))470			{471				ISqlFormatter sqlFormatter = session.Resolve<ISqlFormatter>();472				global::_003C_003Ey__InlineArray9<string> buffer = default(global::_003C_003Ey__InlineArray9<string>);473				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 0) = "(";474				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 1) = sqlFormatter.FormatValue(entity.Columns["cn"].GetValue<string>(), ValType.String, forUpdate: true);475				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 2) = ", ";476				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 3) = sqlFormatter.FormatUidValue(entity.Columns["UID_ADSContainer"].GetValue<string>());477				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 4) = ", ";478				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 5) = sqlFormatter.FormatUidValue(entity.Columns["UID_ADSDomain"].GetValue<string>());479				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 6) = ", ";480				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 7) = sqlFormatter.FormatUidValue(entity.Columns["XObjectKey"].GetValue<string>());481				global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray9<string>, string>(ref buffer, 8) = ")";482				string data = string.Concat(global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<global::_003C_003Ey__InlineArray9<string>, string>(in buffer, 9));483				parameters.Session.AddPreCommitHook("ADS_UniqueCnCheck", data, ADSHelper.IsUniqueCnInAdsBulk);484			}485			if (!entity.IsLoaded)486			{487				await _CheckADSPrimaryGroup(session, entity, entity.GetValue<string>("UID_ADSGroupPrimary"), value, ct).ConfigureAwait(false);488			}489		}490		if (entity.Columns["UID_ADSContainer"].IsDifferent && !entity.IsDeleted())491		{492			await ADSHelper.CheckContainerLimit(parameters.Session, entity, parameters.UnitOfWork, ct).ConfigureAwait(false);493		}494		return await base.OnSavingAsync(entity, parameters, ct).ConfigureAwait(false);495	}496497	[AsyncStateMachine(typeof(_003COnSavedAsync_003Ed__3))]498	public override System.Threading.Tasks.Task OnSavedAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken)499	{500		//IL_0002: Unknown result type (might be due to invalid IL or missing references)501		//IL_0007: Unknown result type (might be due to invalid IL or missing references)502		//IL_0026: Unknown result type (might be due to invalid IL or missing references)503		//IL_0027: Unknown result type (might be due to invalid IL or missing references)504		_003COnSavedAsync_003Ed__3 _003COnSavedAsync_003Ed__ = default(_003COnSavedAsync_003Ed__3);505		_003COnSavedAsync_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();506		_003COnSavedAsync_003Ed__._003C_003E4__this = this;507		_003COnSavedAsync_003Ed__.entity = entity;508		_003COnSavedAsync_003Ed__.parameters = parameters;509		_003COnSavedAsync_003Ed__.cancellationToken = cancellationToken;510		_003COnSavedAsync_003Ed__._003C_003E1__state = -1;511		((AsyncTaskMethodBuilder)(ref _003COnSavedAsync_003Ed__._003C_003Et__builder)).Start<_003COnSavedAsync_003Ed__3>(ref _003COnSavedAsync_003Ed__);512		return ((AsyncTaskMethodBuilder)(ref _003COnSavedAsync_003Ed__._003C_003Et__builder)).Task;513	}514515	private static bool _CheckUidADSDomain(string uidDomain, bool isLoaded, string oldDomain)516	{517		if (!isLoaded)518		{519			return true;520		}521		if (!string.Equals(uidDomain, oldDomain))522		{523			throw new ViException(2105097, ExceptionRelevance.EndUser);524		}525		return true;526	}527528	[AsyncStateMachine(typeof(_003C_CheckADSPrimaryGroup_003Ed__5))]529	private static async System.Threading.Tasks.Task<bool> _CheckADSPrimaryGroup(ISession session, IEntity entity, string uidAdsGroupPrimary, string? uidAdsDomain, CancellationToken ct)530	{531		//IL_0002: Unknown result type (might be due to invalid IL or missing references)532		//IL_0007: Unknown result type (might be due to invalid IL or missing references)533		//IL_002e: Unknown result type (might be due to invalid IL or missing references)534		//IL_0030: Unknown result type (might be due to invalid IL or missing references)535		ISqlFormatter sqlFormatter = session.SqlFormatter();536		if (string.IsNullOrEmpty(uidAdsGroupPrimary))537		{538			if (!string.IsNullOrEmpty((string)entity.GetValue("UID_ADSGroupPrimary")))539			{540				throw new ViException(2105197, ExceptionRelevance.EndUser);541			}542		}543		else if (entity.IsLoaded)544		{545			string whereclause = sqlFormatter.AndRelation(sqlFormatter.UidComparison("UID_ADSMachine", entity.GetValue<string>("UID_ADSMachine")), sqlFormatter.UidComparison("UID_ADSGroup", uidAdsGroupPrimary));546			if (!(await session.Source().ExistsAsync("ADSMachineInADSGroup", whereclause, ct).ConfigureAwait(false)))547			{548				throw new ViException(2105198, ExceptionRelevance.EndUser);549			}550		}551		else if (!string.IsNullOrEmpty(uidAdsDomain))552		{553			string whereclause = sqlFormatter.AndRelation(sqlFormatter.UidComparison("UID_ADSDomain", uidAdsDomain), sqlFormatter.UidComparison("UID_ADSGroup", uidAdsGroupPrimary), sqlFormatter.Comparison("PrimaryGroupToken", "515", ValType.String));554			if (!(await session.Source().ExistsAsync("ADSGroup", whereclause, ct).ConfigureAwait(false)))555			{556				throw new ViException(2105413, ExceptionRelevance.EndUser, "Domain Computers");557			}558		}559		return true;560	}561}562