Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.EntityFrameworkCore.Migrations.Design
/// services using the 'With...' methods. Do not call the constructor at any point in this process.
/// </para>
/// </summary>
public sealed class CSharpMigrationOperationGeneratorDependencies
public sealed record CSharpMigrationOperationGeneratorDependencies
{
/// <summary>
/// <para>
Expand Down Expand Up @@ -58,14 +58,6 @@ public CSharpMigrationOperationGeneratorDependencies([NotNull] ICSharpHelper csh
/// <summary>
/// The C# helper.
/// </summary>
public ICSharpHelper CSharpHelper { get; }

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="csharpHelper"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpMigrationOperationGeneratorDependencies With([NotNull] ICSharpHelper csharpHelper)
=> new CSharpMigrationOperationGeneratorDependencies(csharpHelper);
public ICSharpHelper CSharpHelper { get; [param: NotNull] init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Microsoft.EntityFrameworkCore.Migrations.Design
/// services using the 'With...' methods. Do not call the constructor at any point in this process.
/// </para>
/// </summary>
public sealed class CSharpMigrationsGeneratorDependencies
public sealed record CSharpMigrationsGeneratorDependencies
{
/// <summary>
/// <para>
Expand Down Expand Up @@ -59,49 +59,16 @@ public CSharpMigrationsGeneratorDependencies(
/// <summary>
/// The C# helper.
/// </summary>
public ICSharpHelper CSharpHelper { get; }
public ICSharpHelper CSharpHelper { get; [param: NotNull] init; }

/// <summary>
/// The C# migration operation generator.
/// </summary>
public ICSharpMigrationOperationGenerator CSharpMigrationOperationGenerator { get; }
public ICSharpMigrationOperationGenerator CSharpMigrationOperationGenerator { get; [param: NotNull] init; }

/// <summary>
/// The C# model snapshot generator.
/// </summary>
public ICSharpSnapshotGenerator CSharpSnapshotGenerator { get; }

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="csharpHelper"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpMigrationsGeneratorDependencies With([NotNull] ICSharpHelper csharpHelper)
=> new CSharpMigrationsGeneratorDependencies(
csharpHelper,
CSharpMigrationOperationGenerator,
CSharpSnapshotGenerator);

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="csharpMigrationOperationGenerator"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpMigrationsGeneratorDependencies With([NotNull] ICSharpMigrationOperationGenerator csharpMigrationOperationGenerator)
=> new CSharpMigrationsGeneratorDependencies(
CSharpHelper,
csharpMigrationOperationGenerator,
CSharpSnapshotGenerator);

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="csharpSnapshotGenerator"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpMigrationsGeneratorDependencies With([NotNull] ICSharpSnapshotGenerator csharpSnapshotGenerator)
=> new CSharpMigrationsGeneratorDependencies(
CSharpHelper,
CSharpMigrationOperationGenerator,
csharpSnapshotGenerator);
public ICSharpSnapshotGenerator CSharpSnapshotGenerator { get; [param: NotNull] init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Microsoft.EntityFrameworkCore.Migrations.Design
/// services using the 'With...' methods. Do not call the constructor at any point in this process.
/// </para>
/// </summary>
public sealed class CSharpSnapshotGeneratorDependencies
public sealed record CSharpSnapshotGeneratorDependencies
{
/// <summary>
/// <para>
Expand Down Expand Up @@ -63,40 +63,16 @@ public CSharpSnapshotGeneratorDependencies(
/// <summary>
/// The C# helper.
/// </summary>
public ICSharpHelper CSharpHelper { get; }
public ICSharpHelper CSharpHelper { get; [param: NotNull] init; }

/// <summary>
/// The type mapper.
/// </summary>
public IRelationalTypeMappingSource RelationalTypeMappingSource { get; }
public IRelationalTypeMappingSource RelationalTypeMappingSource { get; [param: NotNull] init; }

/// <summary>
/// The annotation code generator.
/// </summary>
public IAnnotationCodeGenerator AnnotationCodeGenerator { get; }

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="csharpHelper"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpSnapshotGeneratorDependencies With([NotNull] ICSharpHelper csharpHelper)
=> new CSharpSnapshotGeneratorDependencies(csharpHelper, RelationalTypeMappingSource, AnnotationCodeGenerator);

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="relationalTypeMappingSource"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpSnapshotGeneratorDependencies With([NotNull] IRelationalTypeMappingSource relationalTypeMappingSource)
=> new CSharpSnapshotGeneratorDependencies(CSharpHelper, relationalTypeMappingSource, AnnotationCodeGenerator);

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="annotationCodeGenerator"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public CSharpSnapshotGeneratorDependencies With([NotNull] IAnnotationCodeGenerator annotationCodeGenerator)
=> new CSharpSnapshotGeneratorDependencies(CSharpHelper, RelationalTypeMappingSource, annotationCodeGenerator);
public IAnnotationCodeGenerator AnnotationCodeGenerator { get; [param: NotNull] init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.EntityFrameworkCore.Migrations.Design
/// services using the 'With...' methods. Do not call the constructor at any point in this process.
/// </para>
/// </summary>
public sealed class MigrationsCodeGeneratorDependencies
public sealed record MigrationsCodeGeneratorDependencies
{
/// <summary>
/// <para>
Expand Down Expand Up @@ -58,27 +58,11 @@ public MigrationsCodeGeneratorDependencies(
/// <summary>
/// The type mapper.
/// </summary>
public IRelationalTypeMappingSource RelationalTypeMappingSource { get; }
public IRelationalTypeMappingSource RelationalTypeMappingSource { get; [param: NotNull] init; }

/// <summary>
/// The annotation code generator.
/// </summary>
public IAnnotationCodeGenerator AnnotationCodeGenerator { get; }

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="relationalTypeMappingSource"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public MigrationsCodeGeneratorDependencies With([NotNull] IRelationalTypeMappingSource relationalTypeMappingSource)
=> new MigrationsCodeGeneratorDependencies(relationalTypeMappingSource, AnnotationCodeGenerator);

/// <summary>
/// Clones this dependency parameter object with one service replaced.
/// </summary>
/// <param name="annotationCodeGenerator"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public MigrationsCodeGeneratorDependencies With([NotNull] IAnnotationCodeGenerator annotationCodeGenerator)
=> new MigrationsCodeGeneratorDependencies(RelationalTypeMappingSource, annotationCodeGenerator);
public IAnnotationCodeGenerator AnnotationCodeGenerator { get; [param: NotNull] init; }
}
}
Loading