Hi,
I think we've found an issue with LinqMetaData.
On some queries, when we perform the same query twice, de second query doesn't return results:
// snip: set up test data
adapter.SaveEntity(td.Functie1, true, true);
// the first time the correct results are returned:
var sns = linqMetaData.Functie
.Where(f => f.Id == td.Functie1.Id)
.Select(f => f.Salarisniveauschaal)
.FirstOrDefault();
Assert.IsTrue(sns != null, "no Salarisniveauschaal returned");
// the second time there is no result:
sns = linqMetaData.Functie
.Where(f => f.Id == td.Functie1.Id)
.Select(f => f.Salarisniveauschaal)
.FirstOrDefault();
// fails
Assert.IsTrue(sns != null, "second time no Salarisniveauschaal returned");
last bit of the output:
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: CreateInsertDQ
Method Enter: CreateSingleTargetInsertDQ
Generated Sql query:
Query: INSERT INTO [dbo].[tb_ECDGenie_Medewerker_Functie] ([id], [medewerker_guid], [functie_id], [creator_account_id], [versie_startdatum], [versie_nummer], [versie_object_id]) VALUES (@Id, @MedewerkerGuid, @FunctieId, @CreatorAccountId, @VersieStartdatum, @VersieNummer, @VersieObjectId)
Parameter: @Id : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 67a976d1-bbe6-4bb1-afce-fd8ebb8c0500.
Parameter: @MedewerkerGuid : AnsiStringFixedLength. Length: 36. Precision: 0. Scale: 0. Direction: Input. Value: "7784328c-9c3b-4669-8095-dfe070901da9".
Parameter: @FunctieId : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 6104edff-4f55-49f4-81c8-34f59c95bc7e.
Parameter: @CreatorAccountId : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2.
Parameter: @VersieStartdatum : DateTime. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 23-9-2008 10:02:53.
Parameter: @VersieNummer : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 1.
Parameter: @VersieObjectId : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 306670f6-8501-444a-8626-d98e2d66996a.
Method Exit: CreateSingleTargetInsertDQ
Method Exit: CreateInsertDQ
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT [dbo].[tb_ECDGenie_Medewerker_Functie].[id] AS [Id], [dbo].[tb_ECDGenie_Medewerker_Functie].[medewerker_guid] AS [MedewerkerGuid], [dbo].[tb_ECDGenie_Medewerker_Functie].[functie_id] AS [FunctieId], [dbo].[tb_ECDGenie_Medewerker_Functie].[creator_account_id] AS [CreatorAccountId], [dbo].[tb_ECDGenie_Medewerker_Functie].[versie_startdatum] AS [VersieStartdatum], [dbo].[tb_ECDGenie_Medewerker_Functie].[versie_einddatum] AS [VersieEinddatum], [dbo].[tb_ECDGenie_Medewerker_Functie].[versie_nummer] AS [VersieNummer], [dbo].[tb_ECDGenie_Medewerker_Functie].[versie_object_id] AS [VersieObjectId] FROM [dbo].[tb_ECDGenie_Medewerker_Functie] (nolock) WHERE ( ( [dbo].[tb_ECDGenie_Medewerker_Functie].[id] = @Id1))
Parameter: @Id1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 67a976d1-bbe6-4bb1-afce-fd8ebb8c0500.
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
: Initial expression to process:
value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[CC.ECDGenie.Dal.EntityClasses.FunctieEntity]).Where(f => (f.Id = value(CC.ECDGenie.Dal.UnitTests.LlblgenTests+<>c__DisplayClass0).td.Functie1.Id)).Select(f => f.Salarisniveauschaal).FirstOrDefault()
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT TOP(@top1) @LO11 AS [LPFA_2], [LPLA_1].[salarisniveauschaal_id] AS [SalarisniveauschaalId] FROM [dbo].[tb_ECDGenie_Functie] [LPLA_1] (nolock) WHERE ( ( ( ( ( ( [LPLA_1].[id] = @Id3))))))
Parameter: @LO11 : Int32. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1.
Parameter: @top1 : Int64. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1.
Parameter: @Id3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 6104edff-4f55-49f4-81c8-34f59c95bc7e.
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT [LPLA_2].[id] AS [Id], [LPLA_2].[salarisschaal_id] AS [SalarisschaalId], [LPLA_2].[functiejaar_id] AS [FunctiejaarId], [LPLA_2].[kostprijs] AS [Kostprijs], [LPLA_2].[creator_account_id] AS [CreatorAccountId], [LPLA_2].[versie_startdatum] AS [VersieStartdatum], [LPLA_2].[versie_einddatum] AS [VersieEinddatum], [LPLA_2].[versie_nummer] AS [VersieNummer], [LPLA_2].[versie_object_id] AS [VersieObjectId] FROM [dbo].[tb_ECDGenie_Salarisniveauschaal] [LPLA_2] (nolock) WHERE ( ( ( ( [LPLA_2].[id] = @Id1))))
Parameter: @Id1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 4374e80d-a519-430a-a411-bc8ef1cb6c26.
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
: Initial expression to process:
value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[CC.ECDGenie.Dal.EntityClasses.FunctieEntity]).Where(f => (f.Id = value(CC.ECDGenie.Dal.UnitTests.LlblgenTests+<>c__DisplayClass0).td.Functie1.Id)).Select(f => f.Salarisniveauschaal).FirstOrDefault()
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT TOP(@top1) @LO11 AS [LPFA_2], [LPLA_1].[salarisniveauschaal_id] AS [SalarisniveauschaalId] FROM [dbo].[tb_ECDGenie_Functie] [LPLA_1] (nolock) WHERE ( ( ( ( ( ( [LPLA_1].[id] = @Id3))))))
Parameter: @LO11 : Int32. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1.
Parameter: @top1 : Int64. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1.
Parameter: @Id3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 6104edff-4f55-49f4-81c8-34f59c95bc7e.
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT [LPLA_2].[id] AS [Id], [LPLA_2].[salarisschaal_id] AS [SalarisschaalId], [LPLA_2].[functiejaar_id] AS [FunctiejaarId], [LPLA_2].[kostprijs] AS [Kostprijs], [LPLA_2].[creator_account_id] AS [CreatorAccountId], [LPLA_2].[versie_startdatum] AS [VersieStartdatum], [LPLA_2].[versie_einddatum] AS [VersieEinddatum], [LPLA_2].[versie_nummer] AS [VersieNummer], [LPLA_2].[versie_object_id] AS [VersieObjectId] FROM [dbo].[tb_ECDGenie_Salarisniveauschaal] [LPLA_2] (nolock)
Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
TestCase 'CC.ECDGenie.Dal.UnitTests.LlblgenTests.TestSelectingRelatedEntity'
failed: Assert.IsTrue failed. second time no Salarisniveauschaal returned.