Skip to content

Commit

Permalink
Non-generic versions of IConverters
Browse files Browse the repository at this point in the history
  • Loading branch information
o.nadymov committed Apr 24, 2024
1 parent 714e1b6 commit cd3d798
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 33 deletions.
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
<PackageTags>DataBus; ШинаДанных</PackageTags>
<Copyright>Copyright © $([System.DateTime]::Now.Year.ToString())</Copyright>
<PackageReleaseNotes></PackageReleaseNotes>
<Version>0.1.0</Version>
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<FileVersion>0.1.0.0</FileVersion>
<Version>0.1.1</Version>
<AssemblyVersion>0.1.1.0</AssemblyVersion>
<FileVersion>0.1.1.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
2 changes: 0 additions & 2 deletions src/Spoleto.DataBus.Interfaces/Converters/ConverterInBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ public abstract class ConverterInBase<TInput, TOutput> : IConverterIn<TInput, TO

public abstract TOutput Convert(TInput source);

#if !NET5_0_OR_GREATER
public Type InputType => typeof(TInput);

public Type OutputType => typeof(TOutput);
#endif
}
}
2 changes: 0 additions & 2 deletions src/Spoleto.DataBus.Interfaces/Converters/ConverterOutBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ public abstract class ConverterOutBase<TInput, TOutput> : IConverterOut<TInput,

public abstract TOutput Convert(TInput source);

#if !NET5_0_OR_GREATER
public Type InputType => typeof(TInput);

public Type OutputType => typeof(TOutput);
#endif
}
}
41 changes: 17 additions & 24 deletions src/Spoleto.DataBus.Interfaces/Converters/IConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@ namespace Spoleto.DataBus.Interfaces.Converters
/// <summary>
/// The base converter.
/// </summary>
public interface IConverter
{
/// <summary>
/// Gets the input data type.
/// </summary>
Type InputType { get; }

/// <summary>
/// Gets the output data type.
/// </summary>
Type OutputType { get; }
}

/// <summary>
/// The base converter with generic input and output data types..
/// </summary>
/// <typeparam name="TInput">The input data.</typeparam>
/// <typeparam name="TOutput">The ouput data.</typeparam>
public interface IConverter<TInput, TOutput>
public interface IConverter<TInput, TOutput> : IConverter
where TInput : IConverterData
where TOutput : IConverterData
{
Expand All @@ -30,28 +46,5 @@ public interface IConverter<TInput, TOutput>
/// <param name="source">The input data.</param>
/// <returns>The output data.</returns>
TOutput Convert(TInput source);

#if NET5_0_OR_GREATER
/// <summary>
/// Gets the input data type.
/// </summary>
Type InputType => typeof(TInput);

/// <summary>
/// Gets the output data type.
/// </summary>
Type OutputType => typeof(TOutput);
#else
/// <summary>
/// Gets the input data type.
/// </summary>
Type InputType { get; }

/// <summary>
/// Gets the output data type.
/// </summary>
Type OutputType { get; }
#endif

}
}
9 changes: 8 additions & 1 deletion src/Spoleto.DataBus.Interfaces/Converters/IConverterIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ namespace Spoleto.DataBus.Interfaces.Converters
/// <summary>
/// The input converter.
/// </summary>
public interface IConverterIn : IConverter
{
}

/// <summary>
/// The input converter with generic input and output data types.
/// </summary>
/// <typeparam name="TInput">The input data.</typeparam>
/// <typeparam name="TOutput">The ouput data.</typeparam>
public interface IConverterIn<TInput, TOutput> : IConverter<TInput, TOutput>
public interface IConverterIn<TInput, TOutput> : IConverterIn, IConverter<TInput, TOutput>
where TInput : IConverterData
where TOutput : IConverterData
{
Expand Down
9 changes: 8 additions & 1 deletion src/Spoleto.DataBus.Interfaces/Converters/IConverterOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ namespace Spoleto.DataBus.Interfaces.Converters
/// <summary>
/// The output converter.
/// </summary>
public interface IConverterOut : IConverter
{
}

/// <summary>
/// The output converter with generic input and output data types.
/// </summary>
/// <typeparam name="TInput">The input data.</typeparam>
/// <typeparam name="TOutput">The ouput data.</typeparam>
public interface IConverterOut<TInput, TOutput> : IConverter<TInput, TOutput>
public interface IConverterOut<TInput, TOutput> : IConverterOut, IConverter<TInput, TOutput>
where TInput : IConverterData
where TOutput : IConverterData
{
Expand Down

0 comments on commit cd3d798

Please sign in to comment.