Thanks Walaa!
I am afraid I lack the knowledge required to finish this using your hint.
As you can see from the code below I pass into the proc a string representation of the EntityType. To get the terminology right I mean to say that for me the EntityType is tablename followed by the word Entity. So in my example I have a table by the name of BizEntity and this follows that my EntityType becomes BizEntityEntity.
private SD.LLBLGen.Pro.ORMSupportClasses.IEntity getEntity(string type, object id, object id2)
{
SD.LLBLGen.Pro.ORMSupportClasses.IEntity entity;
switch(type)
{
case "BizEntityEntity":
BizEntityEntity bizEntity = new BizEntityEntity();
if(id != null)
bizEntity.FetchUsingPK((int)id);
return bizEntity;
case "Person_OfficeEntity":
Person_OfficeEntity person_Office = new Person_OfficeEntity;
if(id != null && id2 != null)
person_Office.FetchUsingPK((int)id, (int)id2);
return person_Office;
default:
throw new Exception("Unsupported Type: The procedure getEntity has been passed a type it does not support.");
}
}
So if I use your code example I could perhaps do this:
private SD.LLBLGen.Pro.ORMSupportClasses.IEntity getEntity(string type, object id, object id2)
{
EntityType myEntityType = (EntityType)Enum.Parse(typeof(EntityType), type, false);
}
But inthe next step, how do I use:
GeneralEntityFactory.Create(myEntityType);
to instantiate an object of my entity type?
GeneralEntityFactory.Create appears to return an IEntity. I need the type described in the EntityType enum.
A simple example would probably explain the whole thing to me.
best regards,
!Rob