63 lines
1.5 KiB
Plaintext
63 lines
1.5 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,csharp]
|
|
----
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseSqlServer("Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password="); // Noncompliant
|
|
}
|
|
----
|
|
|
|
In https://docs.microsoft.com/en-us/troubleshoot/aspnet/create-web-config[Web.config]
|
|
|
|
[source,csharp]
|
|
----
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<configuration>
|
|
<connectionStrings>
|
|
<add name="myConnection" connectionString="Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=" /> <!-- Noncompliant -->
|
|
</connectionStrings>
|
|
</configuration>
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,csharp]
|
|
----
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseSqlServer("Server=myServerAddress;Database=myDataBase;Integrated Security=True");
|
|
}
|
|
----
|
|
|
|
In https://docs.microsoft.com/en-us/troubleshoot/aspnet/create-web-config[Web.config]
|
|
|
|
[source,csharp]
|
|
----
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<configuration>
|
|
<connectionStrings>
|
|
<add name="myConnection" connectionString="Server=myServerAddress;Database=myDataBase;Integrated Security=True" />
|
|
</connectionStrings>
|
|
</configuration>
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|