Otis wrote:
I think this line is not completely correct:
OrderEntity order = new ArticuloEntity(pkey);
Shouldn't that be:
OrderEntity order = new OrderEntity(pkey);
?
Yes it should be. It was a mistake I made translating the name entity to a new one that I thought that better explain the relation of the objects.
But with the same test you have show me, translating the entity names.
I have the same error
[Test]
public void DereferenceTest()
{
using(DataAccessAdapter adapter = new DataAccessAdapter())
{
ArticuloEntity o = new ArticuloEntity(5);
adapter.FetchEntity(o);
o.Formato = (FormatoArticuloEntity)adapter.FetchNewEntity(new FormatoArticuloEntityFactory(), o.GetRelationInfoFormato());
FormatoArticuloEntity c = new FormatoArticuloEntity(2);
adapter.FetchEntity(c);
o.Formato = c;
}
}
Between Articulo and FormatoArticulo there is a (M:1) relation
The error is
ArticulosPublicitariosTest.Class1.DereferenceTest : System.NullReferenceException : Object reference not set to an instance of an object.
and the stack
at ArticulosPublicitarios.DAL.EntityClasses.ArticuloEntity.DesetupSyncFormato(Boolean signalRelatedEntity) in C:\PROYECTOS\ArticulosPublicitarios\DAL\DatabaseGeneric\EntityClasses\ArticuloEntity.cs:line 863
at ArticulosPublicitarios.DAL.EntityClasses.ArticuloEntity.SetupSyncFormato(IEntity2 relatedEntity) in C:\PROYECTOS\ArticulosPublicitarios\DAL\DatabaseGeneric\EntityClasses\ArticuloEntity.cs:line 876
at ArticulosPublicitarios.DAL.EntityClasses.ArticuloEntity.SetRelatedEntity(IEntity2 relatedEntity, String fieldName) in C:\PROYECTOS\ArticulosPublicitarios\DAL\DatabaseGeneric\EntityClasses\ArticuloEntity.cs:line 300
at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2.Add(IEntity2 entityToAdd)
at ArticulosPublicitarios.DAL.EntityClasses.FormatoArticuloEntity.SetRelatedEntity(IEntity2 relatedEntity, String fieldName) in C:\PROYECTOS\ArticulosPublicitarios\DAL\DatabaseGeneric\EntityClasses\FormatoArticuloEntity.cs:line 232
at ArticulosPublicitarios.DAL.EntityClasses.ArticuloEntity.set_Formato(FormatoArticuloEntity value) in C:\PROYECTOS\ArticulosPublicitarios\DAL\DatabaseGeneric\EntityClasses\ArticuloEntity.cs:line 1483
at ArticulosPublicitariosTest.Class1.DereferenceTest() in c:\proyectos\articulospublicitarios\articulospublicitariostest\class1.cs:line 54
¿Maybe is it something I have bad designed in the llblgen project file?