Skip to content

Commit

Permalink
Update language version and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-B- committed Apr 10, 2024
1 parent 6913274 commit 1a270e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Ef6.Core.LINQPadDriver/Ef6.Core.LINQPadDriver.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6-windows</TargetFramework>
<LangVersion>10.0</LangVersion>
<LangVersion>12.0</LangVersion>

<UseWpf>true</UseWpf>
<AssemblyName>Ef6.Core.LINQPadDriver</AssemblyName>
Expand Down
14 changes: 7 additions & 7 deletions Ef6.Core.LINQPadDriver/EfContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ public static IEnumerable<PropertyInfo> GetDbSetProperties(this Type dbContextTy
.OrderBy(p => p.Name);
}

public static IEnumerable<Type> GetDbSetTypes(this Type dbContextType)
{
return dbContextType.GetDbSetProperties()
.Select(p => p.PropertyType.GetGenericArguments().First());
}

/// <summary>
/// Returns TEntity for a DbSet&lt;TEntity&gt; type
/// Returns TEntity for a DbSet&lt;TEntity&gt; type
/// </summary>
/// <param name="dbSetType"></param>
/// <returns></returns>
public static Type GetDbSetType(this Type dbSetType)
{
return dbSetType.GetGenericArguments().FirstOrDefault();
}

public static IEnumerable<Type> GetDbSetTypes(this Type dbContextType)
{
return dbContextType.GetDbSetProperties()
.Select(p => p.PropertyType.GetGenericArguments().First());
}
}

0 comments on commit 1a270e0

Please sign in to comment.