none
Entity Framework and SQL Server Impersonation( Execute As ) RRS feed

  • Question

  • One of our application need to use Window Authentication for database access. Additionally it requires impersonation (Execute As User=@User).  The Application back-end is already coded in Entity Framework (4.5) with SQL user as connection to Database. 

    In order to make the application to work in Window Authentication with Impersonation, I have to disable the connection Pool and add event when Database Connection State is changed to Execute the sql Command "Execute As User=@User".  

    This approach definitely cause performance issue since every sql query requires to make a new sql connection. 

    Is there any better approach?

    Thursday, October 30, 2014 11:32 AM

Answers

  • Is there any better approach?

    What, you got some kind of mandate stating that you can only use Windows Authentication to connnect to a MS SQL server DB?

    You got trouble here if connection pooling cannot be used. Maybe, you should consider using a generic user-id and psw on the connectionstring so the credentials are the same so connection pooling will be used.

    Thursday, October 30, 2014 1:52 PM

All replies

  • Is there any better approach?

    What, you got some kind of mandate stating that you can only use Windows Authentication to connnect to a MS SQL server DB?

    You got trouble here if connection pooling cannot be used. Maybe, you should consider using a generic user-id and psw on the connectionstring so the credentials are the same so connection pooling will be used.

    Thursday, October 30, 2014 1:52 PM
  • Did you get a solution for this?
    Friday, April 17, 2015 6:19 PM