我正在尝试使用SQL Server中的Entity Framework和存储过程,在save方法和Modify方法方面遇到困难。
尝试为存储过程分配要修改的数据模型时,出现以下错误
CS7036 C#没有给出与所需的形式参数相对应的参数
这是我在实体框架中的模型:
这是我的数据模型
namespace TiendaStoredProceduresEF.Models
{
using System;
using System.Collections.Generic;
public partial class RegistroAlmacen
{
public decimal IdRegistro { get; set; }
public decimal IdSucursal { get; set; }
public decimal IdProducto { get; set; }
public decimal Cantidad { get; set; }
public virtual Producto Producto { get; set; }
public virtual Sucursal Sucursal { get; set; }
}
}
这是对SQL Server中存储过程的访问:
namespace TiendaStoredProceduresEF.Datos
{
public class RegistroAlmacenAdmin
{
public void GuardarRegistro(RegistroAlmacen modelo)
{
using (TiendaRealEntities contexto = new TiendaRealEntities())
{
contexto.GuardarRegistroAlmacen(modelo);
contexto.SaveChanges();
}
}
}
}
错误出现在行
contexto.GuardarRegistroAlmacen(modelo);
没有给出与所需的TiendaRealEntities.GuardarRegistroAlmacen形式参数IProducto对应的参数
根据关于错误CS7036的法律,我必须创建一个空的构造函数,但我不知道如何或在何处