diff --git a/Simple1C/Impl/InMemoryDataContext.cs b/Simple1C/Impl/InMemoryDataContext.cs index 75a62fa..e998f7b 100644 --- a/Simple1C/Impl/InMemoryDataContext.cs +++ b/Simple1C/Impl/InMemoryDataContext.cs @@ -98,11 +98,15 @@ private InMemoryEntity Save(Abstract1CEntity entity, bool isTableSection) inMemoryEntity = inmemoryEntityRevision.inMemoryEntity; if (changed != null) { - var configurationName = ConfigurationName.Get(entity.GetType()); - if (configurationName.Scope == ConfigurationScope.Документы) + if (!isTableSection) { - AssignNewGuid(entity, changed, "ВерсияДанных"); + var configurationName = ConfigurationName.Get(entity.GetType()); + if (configurationName.Scope == ConfigurationScope.Документы) + { + AssignNewGuid(entity, changed, "ВерсияДанных"); + } } + inMemoryEntity.revision = new InMemoryEntityRevision(inMemoryEntity, inmemoryEntityRevision, changed); Collection(entity.GetType()).revision++; } diff --git a/Tests/Sql/LiteralsTest.cs b/Tests/Sql/LiteralsTest.cs index 0110a10..b9e1bbb 100644 --- a/Tests/Sql/LiteralsTest.cs +++ b/Tests/Sql/LiteralsTest.cs @@ -75,10 +75,8 @@ public void LiteralQueryFieldWithSubquery() ОбластьДанныхОсновныеДанные Single c2"; const string expectedResult = @"select 1 -from (select - * -from t1 as __nested_table0 -where __nested_table0.c2 in (100, 200)) as __subquery0 +from t1 +where c2 in (100, 200) limit 10"; CheckTranslate(mappings, sourceSql, expectedResult, 100,200); } diff --git a/Tests/Sql/SubqueryTest.cs b/Tests/Sql/SubqueryTest.cs index 2651cd9..892f535 100644 --- a/Tests/Sql/SubqueryTest.cs +++ b/Tests/Sql/SubqueryTest.cs @@ -63,7 +63,7 @@ left join (select contractorsInner.id as contractorId from contractors2 as contractorsInner left join contracts1 as contracts on contractorsInner.mainData = contracts.mainData and contractorsInner.id = contracts.contractorId) as subquery on subquery.contractorId = contractorsOuter.id -left join docs3 as docs on docs.contractorId = subquery.contractorId"; +left join docs3 as docs on contractorsOuter.mainData = docs.mainData and docs.contractorId = subquery.contractorId"; CheckTranslate(mappings, source, expected); } @@ -96,16 +96,10 @@ contractor.name as Наименование_2 from (select contractors.name, contractors.id -from (select - __nested_table0.name, - __nested_table0.id -from contractorsTable2 as __nested_table0 -where __nested_table0.mainData in (10, 200)) as contractors) as contractor -left join (select - __nested_table1.name, - __nested_table1.contractorId -from contractsTable1 as __nested_table1 -where __nested_table1.mainData in (10, 200)) as contracts on contracts.contractorId = contractor.id"; +from contractorsTable2 as contractors +where contractors.mainData in (10, 200)) as contractor +left join contractsTable1 as contracts on contracts.contractorId = contractor.id +where contracts.mainData in (10, 200)"; CheckTranslate(mappings, source, expected, 10, 200); } @@ -126,13 +120,10 @@ Наименование Single name t.inn as ИНН, t.Наименование_Alias as Наименование_Alias from (select - __subquery0.inn, - __subquery0.name as Наименование_Alias -from (select - __nested_table0.inn, - __nested_table0.name -from contractors0 as __nested_table0 -where __nested_table0.mainData in (10, 20, 30)) as __subquery0) as t"; + inn, + name as Наименование_Alias +from contractors0 +where mainData in (10, 20, 30)) as t"; CheckTranslate(mappings, source, expected, 10, 20, 30); }