We are using SelfServicing with version 5.11.3.
Consider this code:
var doc = new DocumentEntity();
var bestanden = doc.Bestanden;
In the 2nd line the property 'doc.Bestanden' is called and executes a query caused by the Self Servicing framework to the database:
exec sp_executesql N'SELECT [dbo].[Bestanden].[BestandID] AS [ID], <<...and many other fields... >>
FROM [dbo].[Bestanden] WHERE ( [dbo].[Bestanden].[BestandDocID] = @p1)',N'@p1 uniqueidentifier',@p1='00000000-0000-0000-0000-000000000000'
This unnecessary in our opinion because the document entity is not saved yet, so there could be no record in the Bestanden table. Even the ID of the DocumentEntity is not set, which is the foreign key in the Bestanden table.
We think the execution of the query would only be useful if the DocumentEntity instance 'doc' has a given 'ID' or maybe simpeler, to check if property IsNew is false. Thus if an entity is still new, then there is no reason to query the database for related entities.
What is your opinion on this issue?