Quantcast
Viewing all articles
Browse latest Browse all 18858

WPF on EF6 cannot setup sp_setapprole

I'm trying to set sql app role for a wpf app. I make the following call before each EF6 db operation

I previously tried to set to app role on event "ctx.Database.Connection.StateChange" but EF pathological need to continuously open & close the connection made that unworkable.

this.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, "exec dbo.sp_setapprole

the context throws the following err on the very next call after the set approle call.

"A severe error occurred on the current command.  The results, if any, should be discarded."

Sql 2005 profiler is showing EventLog msg => "The connection has been dropped because the principal that opened it subsequently assumed a new security context, and then tried to reset the connection under its impersonated security context"

What is the recommended approach to get consistent results using sql application roles with EF6.

Thanks in advance

 


Viewing all articles
Browse latest Browse all 18858

Trending Articles