0
My context is not bringing the database data.
Error messages.
Value cannot be null.
"Value cannot be null. r nName of parameter: Connection"
Value cannot be null. Name of parameter: Connection
Cód conection string Business Entity
<connectionStrings>
<add name="ASCSEntities" connectionString="" providerName="System.Data.EntityClient" />
Cód conection string WPF
<connectionStrings>
<add name="ASCSEntities" connectionString="" providerName="System.Data.EntityClient" />
Creation of Context:
public partial class ASCSEntities : DbContext
{
public ASCSEntities()
: base("name=ASCSEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
}
Looking at the pictures you can perfectly see the error... Put the code of your conection string, to see if at least it is possible to help in something...
– CesarMiguel
Hello. Do not insert images, enter code or error description. When to swap I remove the -1.
– Omni
Note: The connection string I am passing dynamically.
– Jhonas
@Jhonas would be a good idea, at the entrance of the method that will create the
context
, check theconnection string
. Investigate the method you are calling the method where the exception occurs.– Omni
I check the connection every time I log in, so much so that if the connection is in error I am forwarded to a configuration screen.
– Jhonas
@Jhonas I think we need more context. Put the code that creates the context and the code that calls the method that creates the context for example. When I said check, I meant check if it’s not null, empty or blank.
– Omni
I’m finding this very strange, had already happened not to load the context and then come back, now returned to load without me finding what really caused this failure.. It’s all working right now, but I still don’t know what caused it!
– Jhonas
Could it be some configuration? I didn’t change practically anything and now it’s not loading the context again, I changed a store Previous, could it be something related to updates?
– Jhonas