P,
I'm not sure if I understood you correctly, but asuming I am, I do the same thing constantly. For example when I have a user entity that eather needs to get inherited in a next tier because it needs extending or needs some extra, non db related functionality, I just inherit from the generated entityclass and create a new factory class for this newly inherited entity.
I do this as alot of times where the generated entity class needs some extra properties/methods wothever that arent db related, like when you have a usertype enum mapped with a typeconvertor in your generated entity but would like the consumer of your code to have a property 'IsPhysicalPerson'. This new property woudn't be db related as that data is already available in the generated class but as an enumeration due to the typeconvertor use. The new property would then just return a bool based on the base entitie's usertype field.
The following is an inherited class from a generated base entity + its own factory class
namespace C4.Epm.Core.Energy.EntityClasses
{
public class UserEntity : UserEnergyEntity, IEnergyUser
{
#region Constructors
public UserEntity()
{
}
public UserEntity(Guid id) : base(id)
{
}
public UserEntity(IEntityFields2 fields) : base(fields)
{
}
#endregion
/// <summary>Creates a new instance of the factory related to this entity</summary>
protected override IEntityFactory2 CreateEntityFactory()
{
return new UserEnergyFactory();
}
#region Extended properties
/// <summary>
/// The sector type of the user.
/// </summary>
/// <remarks>
/// Will return a textual representation of the <see cref="UserSectorTypeEnum"/>.
/// </remarks>
public string SectorName
{
get { return (Enum.GetName(typeof (UserSectorTypeEnum), Sector)); }
}
#endregion
}
}
The factory class:
using C4.Epm.Llbl.EntityClasses;
using C4.Epm.Llbl.FactoryClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace C4.Epm.Core.Energy.FactoryClasses
{
internal class UserEnergyFactory : UserEntityFactory
{
/// <summary>returns the name of the entity this factory is for, "UserEnergy"</summary>
public override string ForEntityName
{
get { return "UserEntity"; }
}
public override IEntity2 Create(IEntityFields2 fields)
{
return new UserEnergyEntity(fields);
}
}
}
Hope its wot your looking for.
Regards,
Carl