Forum:  LLBLGen Pro Runtime Framework

Thread:  Inheritance mapping to the same type


Brandt (User)   Posted on: 13-Mar-2008 20:23:12.
Otis, It looks like there is a problem of the same type that i reported in this help desk query http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=12645. Instead of throwing an exception it returns no rows. The query it generates is this.

Quote:

exec sp_executesql N'SELECT DISTINCT
[ICDEV].[PointOfContact].[Contact].[ContactGuid] AS [F13_0],
[ICDEV].[PointOfContact].[Contact].[Name] AS [F13_1],
[ICDEV].[PointOfContact].[Contact].[Email] AS [F13_2],
[ICDEV].[PointOfContact].[Contact].[WebPage] AS [F13_3],
[ICDEV].[PointOfContact].[Contact].[Deleted] AS [F13_4],
[ICDEV].[PointOfContact].[Contact].[UpdatedOn] AS [F13_5],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[ContactGuid] AS [F2_6],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[DomainName] AS [F2_7],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[ManagedByUserId] AS [F2_8],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[DistinguishedName] AS [F2_9],
[ICDEV].[PointOfContact].[IndividualContact].[ContactGuid] AS [F17_6],
[ICDEV].[PointOfContact].[IndividualContact].[FirstName] AS [F17_7],
[ICDEV].[PointOfContact].[IndividualContact].[MiddleName] AS [F17_8],
[ICDEV].[PointOfContact].[IndividualContact].[LastName] AS [F17_9],
[ICDEV].[PointOfContact].[IndividualContact].[PrimaryPhone] AS [F17_10],
[ICDEV].[PointOfContact].[IndividualContact].[SecondaryPhone] AS [F17_11],
[ICDEV].[PointOfContact].[IndividualContact].[CellPhone] AS [F17_12],
[ICDEV].[PointOfContact].[IndividualContact].[Pager] AS [F17_13],
[ICDEV].[PointOfContact].[IndividualContact].[Fax] AS [F17_14],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[ContactGuid] AS [F1_15],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[DomainName] AS [F1_16],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[ManagedBy] AS [F1_17],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[DistinguishedName] AS [F1_18],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ContactGuid] AS [F3_15],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ShortUserId] AS [F3_16],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[UserId] AS [F3_17],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[Title] AS [F3_18],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[Department] AS [F3_19],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[Office] AS [F3_20],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ManagerUserId] AS [F3_21],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[AssistantUserId] AS [F3_22],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[DomainName] AS [F3_23],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[DistinguishedName] AS [F3_24],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[SipPrimaryUserEmailAddress] AS [F3_25],
[ICDEV].[PointOfContact].[UserDefinedContact].[ContactGuid] AS [F36_15],
[ICDEV].[PointOfContact].[UserDefinedContact].[Company] AS [F36_16],
[ICDEV].[PointOfContact].[UserDefinedContact].[UserDefinedContactType] AS [F36_17],
[ICDEV].[PointOfContact].[UserDefinedContact].[Description] AS [F36_18],
[ICDEV].[PointOfContact].[UserDefinedContact].[CreatedBy] AS [F36_19],
[ICDEV].[PointOfContact].[UserDefinedContact].[UpdatedBy] AS [F36_20],
[ICDEV].[PointOfContact].[SupportGroup].[ContactGuid] AS [F35_6] FROM
((((((((( [ICDEV].[PointOfContact].[Contact] [LPA_S1] INNER JOIN
[ICDEV].[PointOfContact].[SupportGroup] [LPA_S2] ON [LPA_S1].[ContactGuid]=[LPA_S2].[ContactGuid])
INNER JOIN [ICDEV].[Support].[SupportGroupMember] [LPA_S3] ON [LPA_S2].[ContactGuid]=[LPA_S3].[SupportGroupGuid]) INNER JOIN
[ICDEV].[PointOfContact].[Contact] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[LPA_S3].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[ActiveDirectoryDistributionList] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[IndividualContact] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[ICDEV].[PointOfContact].[IndividualContact].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[ActiveDirectoryContact] ON [ICDEV].[PointOfContact].[IndividualContact].[ContactGuid]=[ICDEV].[PointOfContact].[ActiveDirectoryContact].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[ActiveDirectoryUser] ON [ICDEV].[PointOfContact].[IndividualContact].[ContactGuid]=[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[UserDefinedContact] ON [ICDEV].[PointOfContact].[IndividualContact].[ContactGuid]=[ICDEV].[PointOfContact].[UserDefinedContact].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[SupportGroup] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[ICDEV].[PointOfContact].[SupportGroup].[ContactGuid])
WHERE ( ( [ICDEV].[PointOfContact].[SupportGroup].[ContactGuid] = @ContactGuid1))',N'@ContactGuid1 uniqueidentifier',@ContactGuid1='3613BB7D-4BF0-DC11-93C5-001641982829'




The query it is suppose to generate is this. The alias it should use is bolded.

Quote:

exec sp_executesql N'SELECT DISTINCT
[ICDEV].[PointOfContact].[Contact].[ContactGuid] AS [F13_0],
[ICDEV].[PointOfContact].[Contact].[Name] AS [F13_1],
[ICDEV].[PointOfContact].[Contact].[Email] AS [F13_2],
[ICDEV].[PointOfContact].[Contact].[WebPage] AS [F13_3],
[ICDEV].[PointOfContact].[Contact].[Deleted] AS [F13_4],
[ICDEV].[PointOfContact].[Contact].[UpdatedOn] AS [F13_5],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[ContactGuid] AS [F2_6],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[DomainName] AS [F2_7],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[ManagedByUserId] AS [F2_8],
[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[DistinguishedName] AS [F2_9],
[ICDEV].[PointOfContact].[IndividualContact].[ContactGuid] AS [F17_6],
[ICDEV].[PointOfContact].[IndividualContact].[FirstName] AS [F17_7],
[ICDEV].[PointOfContact].[IndividualContact].[MiddleName] AS [F17_8],
[ICDEV].[PointOfContact].[IndividualContact].[LastName] AS [F17_9],
[ICDEV].[PointOfContact].[IndividualContact].[PrimaryPhone] AS [F17_10],
[ICDEV].[PointOfContact].[IndividualContact].[SecondaryPhone] AS [F17_11],
[ICDEV].[PointOfContact].[IndividualContact].[CellPhone] AS [F17_12],
[ICDEV].[PointOfContact].[IndividualContact].[Pager] AS [F17_13],
[ICDEV].[PointOfContact].[IndividualContact].[Fax] AS [F17_14],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[ContactGuid] AS [F1_15],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[DomainName] AS [F1_16],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[ManagedBy] AS [F1_17],
[ICDEV].[PointOfContact].[ActiveDirectoryContact].[DistinguishedName] AS [F1_18],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ContactGuid] AS [F3_15],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ShortUserId] AS [F3_16],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[UserId] AS [F3_17],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[Title] AS [F3_18],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[Department] AS [F3_19],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[Office] AS [F3_20],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ManagerUserId] AS [F3_21],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[AssistantUserId] AS [F3_22],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[DomainName] AS [F3_23],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[DistinguishedName] AS [F3_24],
[ICDEV].[PointOfContact].[ActiveDirectoryUser].[SipPrimaryUserEmailAddress] AS [F3_25],
[ICDEV].[PointOfContact].[UserDefinedContact].[ContactGuid] AS [F36_15],
[ICDEV].[PointOfContact].[UserDefinedContact].[Company] AS [F36_16],
[ICDEV].[PointOfContact].[UserDefinedContact].[UserDefinedContactType] AS [F36_17],
[ICDEV].[PointOfContact].[UserDefinedContact].[Description] AS [F36_18],
[ICDEV].[PointOfContact].[UserDefinedContact].[CreatedBy] AS [F36_19],
[ICDEV].[PointOfContact].[UserDefinedContact].[UpdatedBy] AS [F36_20],
[ICDEV].[PointOfContact].[SupportGroup].[ContactGuid] AS [F35_6] FROM
((((((((( [ICDEV].[PointOfContact].[Contact] [LPA_S1] INNER JOIN
[ICDEV].[PointOfContact].[SupportGroup] [LPA_S2] ON [LPA_S1].[ContactGuid]=[LPA_S2].[ContactGuid])
INNER JOIN [ICDEV].[Support].[SupportGroupMember] [LPA_S3] ON [LPA_S2].[ContactGuid]=[LPA_S3].[SupportGroupGuid]) INNER JOIN
[ICDEV].[PointOfContact].[Contact] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[LPA_S3].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[ActiveDirectoryDistributionList] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[ICDEV].[PointOfContact].[ActiveDirectoryDistributionList].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[IndividualContact] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[ICDEV].[PointOfContact].[IndividualContact].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[ActiveDirectoryContact] ON [ICDEV].[PointOfContact].[IndividualContact].[ContactGuid]=[ICDEV].[PointOfContact].[ActiveDirectoryContact].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[ActiveDirectoryUser] ON [ICDEV].[PointOfContact].[IndividualContact].[ContactGuid]=[ICDEV].[PointOfContact].[ActiveDirectoryUser].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[UserDefinedContact] ON [ICDEV].[PointOfContact].[IndividualContact].[ContactGuid]=[ICDEV].[PointOfContact].[UserDefinedContact].[ContactGuid])
LEFT JOIN [ICDEV].[PointOfContact].[SupportGroup] ON [ICDEV].[PointOfContact].[Contact].[ContactGuid]=[ICDEV].[PointOfContact].[SupportGroup].[ContactGuid])
WHERE ( ( [LPA_S2].[ContactGuid] = @ContactGuid1))',N'@ContactGuid1 uniqueidentifier',@ContactGuid1='3613BB7D-4BF0-DC11-93C5-001641982829'



Code:


        private SupportGroupEntity _supportGroup;
        private EntityCollection<ContactEntity> _supportGroupMembers = new EntityCollection<ContactEntity>();


.......

            using (IDataAccessAdapter adapter = BLServices.Adapters.InfrastructureCentral)
            {
                adapter.FetchEntityCollection(this._supportGroupMembers, this._supportGroup.GetRelationInfoContactCollectionViaSupportGroupMember());
            }


This was working in the last build of 2.5 that you fixed.


Otis (LLBLGen Pro Team)   Posted on: 13-Mar-2008 20:38:35.
The code was ported to v2.6, but perhaps a bug was introduced there. The regular unittest suit of 2.5 hasn't been ported to 2.6 yet (planned for tomorrow (friday)), so I'll then check with the v2.6 runtime (we have a couple of unittests now thanks to your reports which should fail due to this if this bug is still present).



Brandt (User)   Posted on: 13-Mar-2008 20:43:01.
Otis wrote:
The code was ported to v2.6, but perhaps a bug was introduced there. The regular unittest suit of 2.5 hasn't been ported to 2.6 yet (planned for tomorrow (friday)), so I'll then check with the v2.6 runtime (we have a couple of unittests now thanks to your reports which should fail due to this if this bug is still present).



Sounds good. Thanks.
Otis (LLBLGen Pro Team)   Posted on: 17-Mar-2008 14:59:07.
Ok, I've ported over the 2.5 unittests to v2.6 and 2 tests in the inheritance project indeed fail. I'll look into this, which is very likely caused by the bug which causes your project to fail too.

Brandt (User)   Posted on: 17-Mar-2008 15:13:22.
Otis wrote:
Ok, I've ported over the 2.5 unittests to v2.6 and 2 tests in the inheritance project indeed fail. I'll look into this, which is very likely caused by the bug which causes your project to fail too.


Thanks, Have you created a new build yet. The 2.6 folder still only shows the first build number from the 13th I believe.
Otis (LLBLGen Pro Team)   Posted on: 17-Mar-2008 15:50:53.
Brandt wrote:
Otis wrote:
Ok, I've ported over the 2.5 unittests to v2.6 and 2 tests in the inheritance project indeed fail. I'll look into this, which is very likely caused by the bug which causes your project to fail too.


Thanks, Have you created a new build yet. The 2.6 folder still only shows the first build number from the 13th I believe.

I've attached a preliminairy build to this post:
http://www.llblgen.com/tinyforum/GotoMessage.aspx?ThreadID=12782&MessageID=71086

I'll upload a new build later today, with a fix for the inheritance issue.


Otis (LLBLGen Pro Team)   Posted on: 17-Mar-2008 17:06:54.
- A forgotten alias in the predicate specification of the GetRelationInfo... for m:n relations in the entity templates
- Some fuzzy code which could be removed in the runtime, was causing also 1 test to fail. (before you wonder: WTF is fuzzy code and what is it doing in the runtime Wink -> relations now implement an interface IRelation, which produces inheritance info objects for start/end of the relation regardless of the fact if the start is the pk side or not, so code is simpler, however there was still a test on pk side, and it picked the wrong side (as it was already preselected)

Will be fixed in build later today.
Otis (LLBLGen Pro Team)   Posted on: 17-Mar-2008 18:01:51.
It's available Regular Smiley

Brandt (User)   Posted on: 17-Mar-2008 18:05:42.
Otis wrote:
It's available Regular Smiley



Great thanks, I will download it now and try it out.
Otis (LLBLGen Pro Team)   Posted on: 17-Mar-2008 18:14:56.
Brandt wrote:
Otis wrote:
It's available Regular Smiley



Great thanks, I will download it now and try it out.

Be sure to regenerate the code, as one of the errors was in the templates. Regular Smiley


Brandt (User)   Posted on: 17-Mar-2008 18:15:45.
Otis wrote:
Brandt wrote:
Otis wrote:
It's available Regular Smiley



Great thanks, I will download it now and try it out.

Be sure to regenerate the code, as one of the errors was in the templates. Regular Smiley



I remembered that from last time. I just finished regenerating