locked
Invalid object name RRS feed

  • Question

  • Hi all,

    I'm using EF4, DB first and I added some udpateable views that I like to use as tables. So I removed the defining query, etc. Mapping is also ok and the whole model is validated.

    When I try to retrieve a record using:

    object = context.PostCodes.Where(o => o.ID == ID).AsEnumerable().FirstOrDefault();

    I get the following error:System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'MyModelStoreContainer.postcodes'.

    Note: I use the same loading technique for all entities and it works fine for normal tables.

    What could be wrong?

    Thanks,

    Ivan


    • Edited by Cryo75 Wednesday, June 6, 2012 5:06 PM
    Wednesday, June 6, 2012 5:06 PM

Answers

  • Hi Cryo75,

    Welcome to MSDN Forum. I think it caused by you didn't modify the SSDL correctly. I assume there's an attribute named 'store:schema="dbo"' in the view section, please delete 'store:', change it as 'schema="dbo"'.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Cryo75 Friday, June 8, 2012 11:07 AM
    Thursday, June 7, 2012 8:22 AM