Q:

new() in method

Having these classes:
public interface IDbContextFactory
{
    DbContext GetContext();
}

public class Repo<T> : IRepo<T> where T : Entity, new()
{
    protected readonly DbContext c;
}

public Repo(IDbContextFactory f)
{
    c = f.GetContext();
}

What does the keyword new() (in class Repo<T>) do?

A:

It means that the type T must expose a public, default (i.e. parameterless) constructor. That is, you will be able to construct an instance of T with new T(). It can expose other constructors as well, but this generic constraint makes the default one mandatory.

A:

it means, the entity should have a parameterless public constructor.
see this.

