Is LazyLoading error?

Jun 28, 2012 at 7:33 AM

public partial class SysBillType
{
        public SysBillType()
        {
        }
    
        public int id { get; set; }
        public string type_code { get; set; }
        public string type_name { get; set; }
        public string type_des { get; set; }
        public string system { get; set; }
        public bool iocode { get; set; }
        public Nullable<bool> istrans { get; set; }
        public Nullable<int> sys_bill_no { get; set; }
    
        public virtual SysBillNo SysBillNo { get; set; }
}

my class like this,lazyload property set true.

when I get SysBillType the SysBillNo is null,if I use includestring is ok

SysBillType sbt = _sysBillTypeDal.Single(bt => bt.id == typeId).Entity;
SysBillNo sbn = sbt.SysBillNo;

it's not well

need help!thanks

Jun 28, 2012 at 7:55 AM

I change ctx.Configuration.ProxyCreationEnabled = true;

this is ok

can set this in appconfig file?

Jun 28, 2012 at 9:11 AM

with problem

if set  ctx.Configuration.ProxyCreationEnabled = true;

PianoArea pianoArea = _pianoAreaDal.Single(p => p.id == newPianoArea.id).Entity;
pianoArea.area_code = newPianoArea.area_code;
pianoArea.area_name = newPianoArea.area_name;
_unitOfWork.AddAction(pianoArea, DataActions.Update);
 _unitOfWork.Save();

update is error

set false
update is ok

why?

Jun 29, 2012 at 10:02 AM

test more get some info

use the dll 1.0.3 update is ok but lazy loading error

if I change the source code 

lazy loading is ok but update is error 

helps!