Inject To the EntityObject

Mar 1, 2011 at 8:20 AM

i use silverlight RIA,my class code like this

    public class BM_AdItem
        public BM_AdItem()
            MediaType = AdItem_MediaType.Image;
            EffectType = AdItem_ChangeEffectType.Fade;

        public int AdID { setget; }

        public int ShopID { setget; }

        public int Index { setget; }

        public string GotoUrl { setget; }

        public AdItem_MediaType MediaType { setget; }

        public string MediaUrl { setget; }

        public AdItem_ChangeEffectType EffectType { setget; }


then when i build the project the vs 2010 Generated a new class code to silverlight client 

i see the client class is inhert from EntityObject 

when i use


 var btn = (Button)sender;

 var tempModel = new BM_AdItem();

 tempModel.InjectFrom((BM_AdItem)btn.DataContext); //this code throw a System.MethodAccessException ,like this:


method “Omu.ValueInjecter.Silverlight.Extensions.SetValue(System.Reflection.PropertyInfo, System.Object, System.Object)” access method “System.ServiceModel.DomainServices.Client.Entity.set_EntityConflict(System.ServiceModel.DomainServices.Client.EntityConflict)” faild

Mar 2, 2011 at 7:24 AM

it looks like a property with the same name and type as in DataContext was found in tempModel, but when it tried to set it's value it failed because of some conflict