C#错误CS7036实体框架和存储过程

时间:2020-06-07 03:29:35

标签: c# asp.net-mvc entity-framework stored-procedures crud

我正在尝试使用SQL Server中的Entity Framework和存储过程,在save方法和Modify方法方面遇到困难。

尝试为存储过程分配要修改的数据模型时,出现以下错误

CS7036 C#没有给出与所需的形式参数相对应的参数

这是我在实体框架中的模型:

enter image description here

这是我的数据模型

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的法律,我必须创建一个空的构造函数,但我不知道如何或在何处

0 个答案:

没有答案
相关问题