Skip to content

Commit e311fdc

Browse files
committed
Ditch optional name argument. Make Name property not throw, but default empty.
1 parent 54423e3 commit e311fdc

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

src/ProgressOnderwijsUtils/Data/SiteBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ public virtual IContainer? Container
1616
public virtual bool DesignMode
1717
=> throw new NotSupportedException();
1818

19-
public virtual string? Name { get; set; }
19+
public string? Name { get; set; }
2020
}

src/ProgressOnderwijsUtils/Data/SqlCommandCreationContext.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,8 @@ public interface IHasDefaultCommandTimeout
1010
CommandTimeoutDefaults TimeoutDefaults { get; }
1111
}
1212

13-
public sealed class SqlConnectionContext : SiteBase, IAttachedToTracer, IHasDefaultCommandTimeout
13+
public sealed class SqlConnectionContext(ISqlCommandTracer tracer, CommandTimeoutDefaults timeoutDefaults) : SiteBase, IAttachedToTracer, IHasDefaultCommandTimeout
1414
{
15-
public SqlConnectionContext(ISqlCommandTracer tracer, CommandTimeoutDefaults timeoutDefaults, string? name = null)
16-
{
17-
Tracer = tracer;
18-
TimeoutDefaults = timeoutDefaults;
19-
Name = name;
20-
}
21-
22-
public ISqlCommandTracer Tracer { get; }
23-
public CommandTimeoutDefaults TimeoutDefaults { get; set; }
15+
public ISqlCommandTracer Tracer { get; } = tracer;
16+
public CommandTimeoutDefaults TimeoutDefaults { get; set; } = timeoutDefaults;
2417
}

src/ProgressOnderwijsUtils/ProgressOnderwijsUtils.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="..\NugetPackagesCommon.props" />
33
<PropertyGroup Label="Configuration">
44
<Version>110.3.0</Version>
5-
<PackageReleaseNotes>Give the possibility to optionally set a name for your SqlConnectionContext.</PackageReleaseNotes>
5+
<PackageReleaseNotes>Do not throw on accessing the Name of SqlConnectionContext to prevent errors on disposing.</PackageReleaseNotes>
66
<Title>ProgressOnderwijsUtils</Title>
77
<Description>Collection of utilities developed by ProgressOnderwijs</Description>
88
<PackageTags>ProgressOnderwijs</PackageTags>

0 commit comments

Comments
 (0)