Hi, I have a question that I use for my WSCF website in vs2010, which use the MVP model (model, view, presenter) and for my model level (data access layer) IAM using EF
that seguimiento tables are an intermediate table between be cliente and gventa tables, so I have my Insert in seguimiento table with L2E in my (DAL LAYER) like this
public void InsertarSeguimiento(Seguimiento Seg) { using (var cont = new CelumarketingEntities()) { cont.AddToSeguimiento(Seg); cont.SaveChanges(); } }
and at my presentation level I am writing a field for seguimiento for my web form from a text box. And I get these errors when I try to put the object client in (seguimiento) objProxy.ClienteReference.Value.
The relationship between two objects cannot be determined because they are attached to different ObjectContext objects. and I donβt understand why, since the Gventa object does not have this error
protected void BtnInsertar_Click(object sender, EventArgs e) { string nombreGVentas = TbxVendedor.Text; char[] delimit = new char[] { ' ' }; string[] arreglo = nombreGVentas.Split(delimit); GVenta IdGVentas = _presenter.getventas(arreglo[0], arreglo[1]); string nombrecliente = TbxCliente.Text; Project.CAD.Cliente idCliente = _presenter.getCliente(nombrecliente); string hora = DdlHora.SelectedValue; string minutos = DdlMinutos.SelectedValue; string HorMin = hora + ":" + minutos; Project.CAD.Seguimiento objProxy = new Project.CAD.Seguimiento(); objProxy.GVentaReference.Value = IdGVentas; objProxy.ClienteReference.Value = idCliente; *
source share