I, know this is a thrilled subject, but i have tried every post i
found in the web about the subject.

I'm trying to configure Lazy load of relations, here is my test, am I
doing something wrong?

        [Test]
        public void GuardaPolizaGeneral()
        {
            var repo = new RepositoryBase<PolizaIndividual>();
            var poliza = PolizaIndividualFactory.CreatePolizaIndividual
("POL-TEST");
            poliza.Movimiento.Inciso = "Test-1";
            poliza.Comisiones = new List<ComisionAsociado>
                                    {
 
PolizaFactory.CrearComisionDirectorAsociado(25,
 
ActiveRecordMediator<Usuario>.
 
FindByPrimaryKey(1))
                                    };
            repo.Save(poliza);

            FlushAndRecreateScope();

            var guardada = repo.Get(poliza.Id);
            Assert.IsNotNull(guardada);
            Assert.AreEqual("POL-TEST", guardada.Folio);

            guardada.Endosos = new List<Endoso>
                                   {
                                       EndosoFactory.CrearEndoso
(guardada, "endoso test 1"),
                                       EndosoFactory.CrearEndoso
(guardada, "endoso test 2"),
                                       EndosoFactory.CrearEndoso
(guardada, "endoso test 3")
                                   };
            guardada.Siniestros = new List<Siniestro>
                                      {
 
SiniestroFactory.CreaSiniestro("Sin-1", EstatusSiniestroEnum.Abierto,
guardada),
 
SiniestroFactory.CreaSiniestro("Sin-2", EstatusSiniestroEnum.Cerrado,
guardada),
 
SiniestroFactory.CreaSiniestro("Sin-3", EstatusSiniestroEnum.Cerrado,
guardada)
                                      };
            repo.Update(guardada);
            DisposeScope();

            using (new SessionScope())
            {
                var actualizada = repo.Get(poliza.Id);
                Assert.IsNotNull(actualizada);

                //Verificando Agregados
                Assert.IsNotNull(actualizada.Endosos);
                Assert.AreEqual(3, actualizada.Endosos.Count); //
<<<<< Here throws the LazyInitializationException
                Assert.AreEqual("endoso test 1", actualizada.Endosos
[0].Folio);
            }
        }

by the way i am using ActiveRecordMediator in mi RepositoryBase


Thanks in advance for your help.

TrentCioran

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to