none
Context.Database.CreateIfNotExists and admin identities RRS feed

  • Question

  • Hello,

    I am somewhat new to EF (6.1.x), but not to ORMs and definitely not databases, per se.

    I discovered a handy-dandy method CreateIfNotExists that I found would work for most support, migrations, etc.

    However, I've run into a case that has me wanting to add an administrative Principal / Identity to the database.

    If I create the database manually all is well, all migrations run. However, when I run CreateIfNotExists, the configured user through the connection string is not reflected in the database security.

    The connection string as as follows:

    Server=localhost;Database=mydb;Integrated Security=true

    I would think that the current logged in user (that's me), could be end user, developer (me), service user, etc, would be reflected in the database when created.

    Is there a way to add such an animal through Context and/or Database? Possibly a manual script I need to run?

    Thank you...


    Saturday, November 15, 2014 9:01 PM

Answers

  • Solved it. Actually had nothing to do with the CreateIfNotExists. That works beautifully. It turned out to be one of my migration scripts that was the issue.
    • Marked as answer by mwpowellhtx Sunday, November 16, 2014 2:39 AM
    Sunday, November 16, 2014 2:39 AM