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
Post a Comment