Unable to Query DB with EF6 Code First RRS feed

  • Question

  • Hi Guys,

    Ok, so I've been bashing my head against this for a couple of days now, and cannot seem to get to the bottom of the issue. I'm writing an application using Prism and EF6 (code First). But I cannot make it perform even the most basic query into a single table, and I don't know why. 

    The exception I'm getting back states the "Sequence contains no matching entities", but there is definitely an entry in the table. Annoyingly I duplicated my code elsewhere and had it working, but when I tried to bring this solution into line with it, it wouldn't work.

    I've included the solution Here - I'd appreciated it if anyone can tell me what I've done wrong.

    To Repro the issue is pretty easy

    -Deploy the DB (I've included the DB Project)

    -Change the Orokis.API web.config connection string to point at your DB

    -Debug the application

    -enter any details on the login

    -click ok.

    -You should automatically break on the block of code that isn't working.

    NB - I know there are issues with the UI and with the logic for the login, thats not what I'm asking for here - I just need to work out why I cannot query the Database in any form.



    Wednesday, July 3, 2013 5:02 PM

All replies

  • Hi Fergal,

    I'll try to involve other senior engineers in this thread. It will take some time to get the response. Your patience will be appreciated.

    Thanks for your understanding and have a nice day.

    Best regards,

    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, July 5, 2013 10:24 AM
  • Thanks Chester.

    I'm sure I'm doing something wrong, but I have absolutely no idea what it is.

    Friday, July 5, 2013 12:37 PM
  • Hi, any word back from the Engineers about this one?



    Friday, July 12, 2013 4:08 PM
  • I'm still having this issue, I'm guessing that you haven't got anything back yet?
    Thursday, July 25, 2013 8:58 PM
  • Hmm. Actually, I've narrowed down the issue.

    I'm implementing IDataErrorInfo in the ModelBase class that my models inherit from. Part of the Interface has this property:

            public virtual string this[string columnName]
                        return null;

    Even though I have the NotMapped attribute on this Property, it still causes the sequence does not contain matching elements exception.

    Removing this property seems to stop the exception.

    This is a bit of a shame, since I'd like to have those features present, but I could probably do without it. Or, alternatively, move some of these methods into a partial class somewhere the DA cannot see it...

    Thursday, July 25, 2013 11:14 PM