Jedi Master Spooky
Jedi Master Spooky

Reputation: 5819

Entity Framework Error: "The container 'XXXX' specified for the FunctionImport could not be found in the current workspace."

I am executing this

            EntityConnection entityConnection = (EntityConnection)context.Connection;
        EntityCommand command = entityConnection.CreateCommand();
        command.CommandText = "Genesis.AL_Insert";
        command.CommandType = CommandType.StoredProcedure;

        //Parametro de NombrePlantilla
        EntityParameter nombrePlantillaParameter = new EntityParameter("NombrePlantilla", DbType.String);
        nombrePlantillaParameter.Value = lote.Plantilla.Nombre;
        command.Parameters.Add(nombrePlantillaParameter);

        //Parametro de LoteId
        EntityParameter loteIdParameter = new EntityParameter("LoteId", DbType.Guid);
        loteIdParameter.Value = lote.LoteId;
         command.Parameters.Add(loteIdParameter);


       // Parametro de Secuencia
        EntityParameter secuenciaParameter = new EntityParameter("Secuencia", DbType.Int32);
        if (secuencia > 0) {
            secuenciaParameter.Value = secuencia;
        }
        else {
            secuenciaParameter.Value = 0;
        }
         command.Parameters.Add(secuenciaParameter);


        //Parametro de UsuarioId
        EntityParameter usuarioIdParameter = new EntityParameter("UsuarioId", DbType.Guid);
        usuarioIdParameter.Value = usuario.UsuarioId;
         command.Parameters.Add(usuarioIdParameter);

        //Parametro de Estacion
        EntityParameter estacionParameter = new EntityParameter("Estacion", DbType.String);
        estacionParameter.Value = estacion;
         command.Parameters.Add(estacionParameter);

        //Parametro de ActividadId
        EntityParameter actividadIdParameter = new EntityParameter("ActividadId", DbType.Guid);
        actividadIdParameter.Value = actividad.ActividadId;
         command.Parameters.Add(actividadIdParameter);

        //Parametro de Descripcion
        EntityParameter descripcionParameter = new EntityParameter("Descripcion", DbType.String);
        descripcionParameter.Value = descripcion;
         command.Parameters.Add(descripcionParameter);

        //Parametro de ValoresAnteriores
        EntityParameter valoresAnterioresParameter = new EntityParameter("ValoresAnteriores", DbType.String);
        valoresAnterioresParameter.Value = valoresAnteriores;
         command.Parameters.Add(valoresAnterioresParameter);

        //Parametro de ValoresNuevos
        EntityParameter valoresNuevosParameter = new EntityParameter("ValoresNuevos", DbType.String);
        valoresNuevosParameter.Value = valoresNuevos;
         command.Parameters.Add(valoresNuevosParameter);

        command.ExecuteNonQuery();

and I get this error:

 "The container 'XXXX' specified for the FunctionImport could not be found in the current workspace."

Upvotes: 5

Views: 11474

Answers (2)

Shir
Shir

Reputation: 11

I had the same problem - what fixed it for me was the connection string. I used the wrong model path.

Upvotes: 0

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65441

This error indicates that there is something wrong with your entity framework model.

It may also be that it does not like the "." in the stored procedure name.

For information on function imports see:

http://msdn.microsoft.com/en-us/library/bb896231.aspx

Upvotes: 3

Related Questions