"The container 'XXXX' supplied for the FunctionImport could not be located in the current workspace," says an Entity Framework error.

entity-framework stored-procedures

Question

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."
1
5
10/5/2009 3:51:25 PM

Accepted Answer

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

3
10/8/2009 7:36:01 PM

Popular Answer

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



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow