VI.ConsistencyChecks.Common/VI.ConsistencyChecks.Common/TemplateCheck.cs
Decompiler Source FileVI.ConsistencyChecks.Common.TemplateCheckDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- Generate: ExecuteTemplates at line 109
- UnitOfWork.Generate: ExecuteTemplates at line 109
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.
references DB/Dialog objects
Summary: classes TemplateCheck; methods Execute, _GetObjectKey, OnRepair, GetSupportedTables; references DialogTable; markers references DB/Dialog objects
Classes
TemplateCheckDB/Dialog object references
OIM key/entity markers
XObjectKeyAPI/entity calls
CreateSingle CreateSingleRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Linq;5using System.Text;6using VI.Base;7using VI.ConsistencyChecks.Base;8using VI.DB;9using VI.DB.JobGeneration;1011namespace VI.ConsistencyChecks.Common;1213public class TemplateCheck : FilterConsistencyCheckBase14{15 private readonly TemplateCheckConfigurator m_Configurator = new TemplateCheckConfigurator();1617 public override IConsistencyCheckConfigurator Configurator => m_Configurator;1819 public TemplateCheck()20 : base(LanguageManager.Instance["CC_TemplateCheck_Caption"], LanguageManager.Instance["CC_TemplateCheck_Description"], LanguageManager.Instance["CC_ObjectCategory"], ConsistencyType.Object, "QBM-AE974E461D194B0F8C71554B1D5E4754")21 {22 }2324 public override TestResult? Execute(TestObject testObject)25 {26 //IL_001d: Unknown result type (might be due to invalid IL or missing references)27 //IL_0024: Expected O, but got Unknown28 TestResult testResult = null;29 try30 {31 ISingleDbObject dBObject = testObject.DBObject;32 dBObject.ExecuteTemplates();33 if (dBObject.IsChanged)34 {35 StringBuilder val = new StringBuilder();36 LanguageManager instance = LanguageManager.Instance;37 System.Collections.Generic.IEnumerator<IDbColumn> enumerator = ((System.Collections.Generic.IEnumerable<IDbColumn>)dBObject.Columns).GetEnumerator();38 try39 {40 while (((System.Collections.IEnumerator)enumerator).MoveNext())41 {42 IDbColumn current = enumerator.Current;43 if (current.IsChanged && current.CanSee)44 {45 if (val.Length > 0)46 {47 val.Append(Environment.NewLine);48 }49 if (testResult == null)50 {51 LanguageManager instance2 = LanguageManager.Instance;52 global::_003C_003Ey__InlineArray3<object> buffer = default(global::_003C_003Ey__InlineArray3<object>);53 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 0) = dBObject.Display;54 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 1) = _GetObjectKey(dBObject);55 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 2) = dBObject.Tablename;56 testResult = new TestResult(this, testObject, instance2.FormatString("CC_TemplateCheck_ErrorObject", global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<global::_003C_003Ey__InlineArray3<object>, object>(in buffer, 3)), bRepairable: true);57 }58 List<ConsistencyError> errors = testResult.Errors;59 global::_003C_003Ey__InlineArray3<object> buffer2 = default(global::_003C_003Ey__InlineArray3<object>);60 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer2, 0) = current.Columnname;61 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer2, 1) = current.Old.String;62 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer2, 2) = current.New.String;63 errors.Add(new ConsistencyError(instance.FormatString("CC_TemplateCheck_ChangedColumn", global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<global::_003C_003Ey__InlineArray3<object>, object>(in buffer2, 3))));64 }65 }66 }67 finally68 {69 ((System.IDisposable)enumerator)?.Dispose();70 }71 }72 }73 catch (System.Exception ex)74 {75 if (testResult == null)76 {77 LanguageManager instance3 = LanguageManager.Instance;78 object obj = ((object)ex).ToString();79 testResult = new TestResult(this, testObject, instance3.FormatString("CC_TemplateCheck_Error", new System.ReadOnlySpan<object>(ref obj)), bRepairable: false);80 }81 testResult.Errors.Add(new ConsistencyError(ViException.ErrorString(ex)));82 }83 return testResult;84 }8586 private object _GetObjectKey(ISingleDbObject dbObject)87 {88 if (dbObject.Columns.Contains("XObjectKey"))89 {90 return dbObject["XObjectKey"].GetDisplayValue();91 }92 return string.Join(", ", Enumerable.Select<IColDef, string>((System.Collections.Generic.IEnumerable<IColDef>)dbObject.TableDef.PrimaryKeyColumns, (Func<IColDef, string>)((IColDef pk) => pk.Columnname + "=" + dbObject[pk.Columnname].New.String)));93 }9495 protected override void OnRepair(TestResult tResult)96 {97 //IL_0050: Unknown result type (might be due to invalid IL or missing references)98 //IL_0056: Expected O, but got Unknown99 CheckInitialized();100 base.OnRepair(tResult);101 ISingleDbObject dBObject = tResult.TestObject.DBObject;102 if (Configurator.Variables.Contains("PerformAsync"))103 {104 ISingleDbObject baseObject = base.ConnectData.Connection.CreateSingle("DialogTable", dBObject.Tablename);105 Hashtable val = new Hashtable((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase);106 val.Add((object)"UpdateAll", (object)true);107 val.Add((object)"WhereClause", (object)dBObject.PKWhereClause);108 val.Add((object)"UpdateColumns", (object)"*");109 JobGen.Generate(baseObject, "ExecuteTemplates", (IDictionary)(object)val);110 }111 else112 {113 dBObject.ExecuteTemplates();114 dBObject.Save();115 dBObject.Load();116 }117 }118119 protected override void GetSupportedTables(HashSet<string> hTableNames)120 {121 base.GetSupportedTables(hTableNames);122 AddSupportedTablesLimitedSql("ConsistencyCheck_TemplateCheck", hTableNames);123 }124}125