Skip to content

Commit

Permalink
ВерсияДанных меняется на апдейт и инсерт в InMemoryDataContext. Пара …
Browse files Browse the repository at this point in the history
…тестов
  • Loading branch information
Vasiliy Chernoivan committed Jun 9, 2018
1 parent 4ac502a commit 13a27ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
10 changes: 7 additions & 3 deletions Simple1C/Impl/InMemoryDataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down
6 changes: 2 additions & 4 deletions Tests/Sql/LiteralsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
27 changes: 9 additions & 18 deletions Tests/Sql/SubqueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down

0 comments on commit 13a27ae

Please sign in to comment.