In my scenario, I have three entities: Project, Contact, and ProjectContact (a many-to-many relationship).
I would like to create a new ContactEntity class to provide such things as formatted names, etc. I think have done this and created the necessary factory class successfully as shown below.
public class MyContactEntityFactory : ContactEntityFactory
{
public override SD.LLBLGen.Pro.ORMSupportClasses.IEntity Create()
{
return new MyContactEntity();
}
}
public class MyContactEntity : ContactEntity
{
public string ContactName_SalFirstNickLastTitle{}
public string ContactName_SalFirstNickLast{}
public string ContactPhone{}
}
In my code I am receiving a ProjectEntity and using it to lookup the ProjectContactCollection. Then I iterate through that collection and want to receive a MyContactEntity through the ProjectContactEntity.Contact property.
What do I need to do to make this work?
I see that the ProjectContactEntity has a EntityFactoryToUse property, but there is no indication of which entity it is referring to (ProjectContactEntity also has a Project property that returns a different entity). Is this used when I request a Contact entity?
As a short term solution, I have been instantiating a new MyContactEntity and then fetching the needed record by the ProjectContactEntity.ContactId, but this is highly undesirable since I can't do any prefetching this way.
I am using C# and the SelfServicing template. I haven't really taken the time to investigate the Adapter template, but understood SelfServicing to be simpler and didn't feel I needed anything complicated. I hope this is possible with SelfServicing because I would not want to switch at this point.