嗨,我有一个问题在vs2010中用于我的网站wscf,该网站使用de model MVP(模型、视图、演示者),而我的模型层(数据访问层)则使用EF
that seguimiento s tables is an intermediate table between be cliente and gventa tables so I have my Insert in seguimiento s 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 in my presentation S layer, I capture for my web form, from textbox the field for seguimiento And I get these error when I try to put the object cliente to (seguimiento) objProxy.ClienteReference.Value
The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects.
and I don t understand why since gventa object have no that 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; *// here i get the errors*
objProxy.Descripccion = TbxDescripccion.Text;
objProxy.Fecha = Calendar1.SelectedDate;
objProxy.Hora = HorMin;
_presenter.insertarseg(objProxy);
}