I have a general understanding of the Lambda operator =>, but I simply don't understand where the properties of variables z, c, s come from (as in z.Name). There's some object type inference magic happening that I don't understand.
public class DbReadService : IDbReadService
{
private VODContext _db;
public DbReadService(VODContext db)
{
_db = db;
}
private (IEnumerable<string> collections, IEnumerable<string> references) GetEntityNames<TEntity>() where TEntity : class
{
var dbsets = typeof(VODContext).GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Where(z => z.PropertyType.Name.Contains("DbSet"))
.Select(z => z.Name);
var properties = typeof(TEntity).GetProperties(BindingFlags.Public | BindingFlags.Instance);
var collections = properties.Where(l => dbsets.Contains(l.Name)).Select(s => s.Name);
var classes = properties.Where(c => dbsets.Contains(c.Name + "s")).Select(s => s.Name);
return (collections: collections, references: classes);
}
}