Skip to content

Commit 5f229bb

Browse files
committed
Add Pure Attributes
1 parent 0559d02 commit 5f229bb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CompositionRoot/CompositionRoot.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<IncludeSymbols>true</IncludeSymbols>
2424
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2525
</PropertyGroup>
26+
<PropertyGroup>
27+
<DefineConstants>$(DefineConstants);CONTRACTS_FULL</DefineConstants>
28+
</PropertyGroup>
2629
<ItemGroup>
2730
<PackageReference Include="Autofac" />
2831
<PackageReference Include="System.Collections.Immutable" Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard2.1'" />

CompositionRoot/ModuleBuilder.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Immutable;
2+
using System.Diagnostics.Contracts;
23
using Autofac;
34
using Autofac.Core;
45

@@ -13,23 +14,27 @@ public ModuleBuilder()
1314

1415
private ModuleBuilder(ImmutableList<Register> registrations)
1516
=> _registrations = registrations;
16-
}
1717

18+
[Pure]
1819
public ModuleBuilder RegisterInstance<T>(T instance)
1920
where T : class
2021
=> Register(builder => builder.RegisterInstance(instance));
2122

23+
[Pure]
2224
public ModuleBuilder RegisterModule<TModule>()
2325
where TModule : IModule, new()
2426
=> Register(builder => builder.RegisterModule<TModule>());
2527

28+
[Pure]
2629
public ModuleBuilder RegisterModule<TModule>(TModule module)
2730
where TModule : IModule
2831
=> Register(builder => builder.RegisterModule(module));
2932

33+
[Pure]
3034
public ModuleBuilder Register(Register registrationFunction)
3135
=> ShallowClone(_registrations.Add(registrationFunction));
3236

37+
[Pure]
3338
public IModule Build()
3439
=> new ModuleRegistrar(_registrations);
3540

0 commit comments

Comments
 (0)