Lets say, I have this code:
var auftragErledigt = new AuftraegeErledigtPositionEntity();
using (DataAccessAdapter daa = DataAccessAdapter.GetCUPnew())
{
daa.FetchEntityCollection(auftragErledigt.FlexStoxes, auftragErledigt.GetRelationInfoFlexStoxes());
}
AuftraegeErledigtPositionEntity can have multiple Flexstoxes. The primary key of the positions is int. But there are also Flexstoxes, which have no position and its ForeignKeyColumn is null.
In v4.2 when the query is executed for a new Entity, the query is (simplified):
exec sp_executesql N'SELECT [DEV_CUPNEW_HEUTE].[dbo].[tblFlexstox].* WHERE ( [DEV_CUPNEW_HEUTE].[dbo].[tblFlexstox].[AuftragErledigtPositionsID] = @p1)',N'@p1 int',@p1=0
In v5.6 it executes:
SELECT [DEV_CUPNEW_HEUTE].[dbo].[tblFlexstox].* WHERE ( [DEV_CUPNEW_HEUTE].[dbo].[tblFlexstox].[AuftragErledigtPositionsID] IS NULL)
Is it possible to get the old behaviour back, so, if it is a non nullable value/primary key, the value to load the flexes is 0?
Background:
We are using such queries a lot and in v4.2 we fetched then no entry. In v5.6 it fetches all entries, where foreign key is null and these are the wrong ones.
I know, we should not execute the query, if the entity is new, but it's not possible to find and change every line of code, this is done.