VS.2005 Pro Edition
LLBLGen 2.5 Build 09.24.2007
Firebird 2.0.1
FirebirdClient 2.0.1.0
I have the SomeEntity generated by LLBLGen.
This is the SomeEntityFactory Extended
using SomeDAL.FactoryClasses;
using SomeDAL.HelperClasses;
namespace SomeDAL.FactoryClasses
{
[Serializable]
public class SomeEntityFactoryExt : SomeEntityFactory
{
private readonly SomeEnum enumValue;
public SomeEntityFactoryExt()
{
enumValue = SomeEnum.Default;
}
public SomeEntityFactoryExt(SomeEnum pmrEnumValue)
{
enumValue = pmrEnumValue;
}
public override IEntity2 Create(IEntityFields2 fields)
{
return new SomeEntityInherited(fields);
}
public override string ForEntityName
{
get
{
return "SomeEntityInherited";
}
}
public override IEntityFields2 CreateFields()
{
Add new fields..........which calculation is based on the enumValue.......
}
}
}
This is the inherited Entity
namespace SomeDAL.EntityClasses
{
[Serializable]
public class SomeEntityInherited : SomeEntity
{
public SomeEntityInherited(string someValue) : base(sameValue) {}
public SomeEntityInherited(IEntityFields2 fields) : base(fields) {}
public SomeEntityInherited() {}
protected override IEntityFactory2 CreateEntityFactory()
{
return new SomeEntityFactoryExt();
}
Public Properties for the new Fields..........................
}
}
This is how I fetch the inherited Entity and the only way I can fetch it.
IRelationPredicateBucket relPredBucket = new RelationPredicateBucket(SomeFields.Year == "2007");
DataAccessAdapter adapter = new DataAccessAdapter();
SomeEntityInherited entSomeInherited = adapter.FetchNewEntity<SomeEntityInherited> (relPredBucket);
Because these don't work, there aren't exceptions but don't fetch the new Fields.
SomeEntityInherited entSomeInherited = new SomeEntityInherited("2007");
adapter.FetchEntity(entSomeInherited)
nor
IRelationPredicateBucket relPredBucket = new RelationPredicateBucket(SomeFields.Year == "2007");
SomeEntityInherited entSomeInherited = new SomeEntityInherited();
adapter.FetchEntityUsingUniqueConstraint(entSomeInherited, relPredBucket);
I'm not sure if this is the correct way to do it or if I'm missing something or I'm doing something wrong.
Any help will be much appreciated.
Kind Regards
Gianfranco