c# - Test connection string within Entity Framework for incorrect password -



c# - Test connection string within Entity Framework for incorrect password -

i'm beginner entity framework (code first) , have modify application.

i have context class inherits dbcontext. in constructor, pass connectionstring.

code sample (not mine) :

public partial class myentities : dbcontext { public myentities(string paramtype, string connectionstring) : base(connectionstring) { database.connection.connectionstring = connectionstring; } }

but don't understand connection done. grab error if password given in connectionstring wrong, seek connect password, , grab event when connected database.

how can ?

i believe asking, how can observe if connection string valid.

the dbcontext.database has property called connection can utilize retrieve connection entity framework use. can phone call open() test connection itself.

c# entity-framework database-connection

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -