Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> EntityCollection from two related EntityBases (+generics)
 

Pages: 1
LLBLGen Pro Runtime Framework
EntityCollection from two related EntityBases (+generics)
Page:1/1 

  Print all messages in this thread  
Poster Message
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 19-Oct-2006 06:51:42.  
Is it possible to get a parent object's collection if you only have a parent entity the EntityBase of the collection? Hopefully this bit of code will make sense..

Code:

Imports System
Imports System.Text
Imports System.Collections.Generic
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports SD.LLBLGen.Pro.ORMSupportClasses

Public Class EntityBaseJoiner(Of parentEntityType As EntityBase, collectionEntityType As EntityBase)
    Public Function JoinBases(ByVal parentEntity As parentEntityType) As EntityCollectionBase(Of collectionEntityType)
        ' Fill in the blanks
        Return Nothing
    End Function

End Class

<TestClass()> Public Class EntityBaseJoinerTests
    <TestMethod()> Public Sub EntitiesCanBeJoined()
        Dim joiner As New EntityBaseJoiner(Of UserEntity, EmailAddressEntity)
        Dim user As New UserEntity()

        Assert.IsTrue(joiner.JoinBases(user) = user.EmailAddresss)
    End Sub

End Class


Obviously I'm having trouble at the part where it says "Fill in the blank"... Maybe there's an easier way..
I'm not a player, I just code a lot.   Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14464 posts
# Posted on: 19-Oct-2006 07:00:55.  
I'm afraid your question is not clear enough
Please elaborate more.


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37375 posts
# Posted on: 19-Oct-2006 09:32:40.  
Isn't it better to use interfaces for this? (If I understand the question correctly) i.e IEntity and IEntityCollection
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 19-Oct-2006 18:20:15.  
The test above explains exactly what I'm trying to do. It would take too long to explain further, and interfaces won't work. I'll trudge ahead with my workaround.

I'm not a player, I just code a lot.   Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37375 posts
# Posted on: 19-Oct-2006 19:09:16.  
If you join the entities inside a EntityCollection<IEntity> it doesn't need any effort. Otherwise you run into co-variance problems. (or I miss something in your example, which is possible, I didn't fully grasp what you're trying to do Embarassed)
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.