Skip to content

Commit 862ef20

Browse files
Merge pull request #466 from bilal-fazlani/release-notes
2 parents 3a916b3 + a0f0600 commit 862ef20

16 files changed

+77
-50
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
- name: Setup .NET
1818
uses: actions/setup-dotnet@v1
1919
with:
20-
dotnet-version: 6.0.x
20+
dotnet-version: |
21+
6.0.x
22+
7.0.x
2123
- name: Restore dependencies
2224
run: dotnet restore
2325
- name: Deploy

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
- name: Setup .NET
1919
uses: actions/setup-dotnet@v1
2020
with:
21-
dotnet-version: 6.0.x
21+
dotnet-version: |
22+
6.0.x
23+
7.0.x
2224
- name: Restore dependencies
2325
run: dotnet restore
2426
- name: Build

CommandDotNet/Extensions/TypeExtensions.cs

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal static IEnumerable<MethodInfo> GetCommandMethods(this Type type, bool i
2121
.Where(m => !typeof(IDisposable).IsAssignableFrom(type) || m.Name != nameof(IDisposable.Dispose));
2222
}
2323

24-
internal static bool IsNullableType(this Type type) => Nullable.GetUnderlyingType(type) != null;
24+
private static bool IsNullableType(this Type type) => Nullable.GetUnderlyingType(type) != null;
2525

2626
internal static bool IsNullableProperty(this PropertyInfo propertyInfo) =>
2727
propertyInfo.PropertyType.IsNullableType()
@@ -31,84 +31,63 @@ internal static bool IsNullableParameter(this ParameterInfo parameterInfo) =>
3131
parameterInfo.ParameterType.IsNullableType()
3232
|| (parameterInfo.GetNullability() == NullabilityState.Nullable);
3333

34-
internal static Type GetUnderlyingType(this Type type)
35-
{
36-
return Nullable.GetUnderlyingType(type)
37-
?? type.GetListUnderlyingType()
38-
?? type;
39-
}
34+
internal static Type GetUnderlyingType(this Type type) =>
35+
Nullable.GetUnderlyingType(type)
36+
?? type.GetListUnderlyingType()
37+
?? type;
4038

41-
internal static Type? GetListUnderlyingType(this Type type)
42-
{
43-
return type.IsArray
39+
private static Type? GetListUnderlyingType(this Type type) =>
40+
type.IsArray
4441
? type.GetElementType()
4542
: typeof(IEnumerable).IsAssignableFrom(type) && type.IsGenericType
4643
? type.GetGenericArguments().FirstOrDefault()
4744
: null;
48-
}
4945

5046
internal static bool IsNonStringEnumerable(this Type type) =>
5147
type != typeof(string) && type.IsEnumerable();
5248

53-
internal static bool IsEnumerable(this Type type)
54-
{
55-
return type.GetInterfaces()
49+
private static bool IsEnumerable(this Type type) =>
50+
type.GetInterfaces()
5651
.Concat(type.ToEnumerable())
5752
.Any(x => x == typeof(IEnumerable));
58-
}
5953

6054
internal static bool IsNonStringCollection(this Type type) =>
6155
type != typeof(string) && type.IsCollection();
6256

63-
internal static bool IsCollection(this Type type)
64-
{
65-
return type.GetInterfaces()
57+
internal static bool IsCollection(this Type type) =>
58+
type.GetInterfaces()
6659
.Concat(type.ToEnumerable())
6760
.Any(x => x.IsGenericType
6861
? x.GetGenericTypeDefinition() == typeof(ICollection<>)
6962
: x == typeof(ICollection));
70-
}
7163

7264
internal static bool IsStaticClass(this Type type) => type.IsAbstract && type.IsSealed;
7365

7466
private static readonly Dictionary<Type, MethodInfo> DefaultMethodByType = new();
7567

76-
internal static object? GetDefaultValue(this Type type)
77-
{
78-
return DefaultMethodByType.GetOrAdd(type, _ =>
68+
private static object? GetDefaultValue(this Type type) =>
69+
DefaultMethodByType.GetOrAdd(type, _ =>
7970
{
8071
Func<object?> f = GetDefaultValue<object>;
8172
return f.Method.GetGenericMethodDefinition().MakeGenericMethod(type);
8273
}).Invoke(null, null);
83-
}
8474

85-
internal static bool IsDefaultFor(this object defaultValue, Type type)
86-
{
87-
return Equals(defaultValue, type.GetDefaultValue());
88-
}
75+
internal static bool IsDefaultFor(this object defaultValue, Type type) =>
76+
Equals(defaultValue, type.GetDefaultValue());
8977

90-
private static T? GetDefaultValue<T>()
91-
{
92-
return Box<T>.CreateDefault().Value;
93-
}
78+
private static T? GetDefaultValue<T>() => default;
9479

95-
internal static bool IsCompilerGenerated(this Type? t)
96-
{
97-
return t is not null
98-
&& (t.IsDefined(typeof(CompilerGeneratedAttribute), false)
99-
|| IsCompilerGenerated(t.DeclaringType));
100-
}
80+
internal static bool IsCompilerGenerated(this Type? t) =>
81+
t is not null
82+
&& (t.IsDefined(typeof(CompilerGeneratedAttribute), false)
83+
|| IsCompilerGenerated(t.DeclaringType));
10184

102-
internal static IEnumerable<PropertyInfo> GetDeclaredProperties(this Type type)
103-
{
104-
return type
85+
internal static IEnumerable<PropertyInfo> GetDeclaredProperties(this Type type) =>
86+
type
10587
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
10688
.Where(x => !x.PropertyType.IsCompilerGenerated());
107-
}
10889

109-
internal static bool InheritsFrom<T>(this Type type)
110-
{
111-
return typeof(T).IsAssignableFrom(type);
112-
}
90+
internal static bool InheritsFrom<T>(this Type type) =>
91+
typeof(T).IsAssignableFrom(type);
11392
}
11493
}

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
3-
<LangVersion>10.0</LangVersion>
4-
<TargetFramework>net6.0</TargetFramework>
3+
<LangVersion>11.0</LangVersion>
4+
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77
<PropertyGroup>

docs/OtherFeatures/name-casing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ With `Case.KebabCase`, the command is executed as `migrate-user --dry-run`
3636

3737
With `Case.LowerCase`, the command is executed as `migrateuser --dryrun`
3838

39+
With `Case.SnakeCase`, the command is executed as `migrate_user --dry_run`
40+
3941
## Overridden names
4042

4143
By default, the case is only applied where the name has not been overridden in an attribute.

docs/ReleaseNotes/CommandDotNet.DataAnnotations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 3.0.2
44

5+
* support dotnet 7
56
* support move of AppSettings.Localize to AppSettings.Localization
67
* ResourceProxy with memberNameAsKey, to better support resx files.
78

docs/ReleaseNotes/CommandDotNet.FluentValidation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 6.0.2
44

5+
* support dotnet 7
56
* support move of AppSettings.Localize to AppSettings.Localization
67
* ResourceProxy with memberNameAsKey, to better support resx files.
78

docs/ReleaseNotes/CommandDotNet.IoC.Autofac.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CommandDotNet.IoC.AutoFac
22

3+
## 5.0.2
4+
5+
* support dotnet 7
6+
37
## 5.0.1
48

59
* update to dotnet 6

docs/ReleaseNotes/CommandDotNet.IoC.MicrosoftDependencyInjection.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CommandDotNet.IoC.MicrosoftDependencyInjection
22

3+
## 5.0.2
4+
5+
* support dotnet 7
6+
37
## 5.0.1
48

59
* update to dotnet 6

docs/ReleaseNotes/CommandDotNet.IoC.SimpleInjector.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CommandDotNet.IoC.SimpleInjector
22

3+
## 5.0.2
4+
5+
* support dotnet 7
6+
37
## 5.0.1
48

59
* update to dotnet 6

0 commit comments

Comments
 (0)