entity framework – Why Cant I Use TEntity?

entity framework – Why Cant I Use TEntity?

TEntity is a generic type parameter, not a concrete type.


I guess my question is why I cant use it, why do I get Unknown type.

Because its not a concrete type.

Say you have a generic list implementation, declared as List<T>. T is a type parameter, which means that it does not represent a specific type. As the programmer, you have to instruct the compiler to use a specific type to use, rather than the generic type T, by providing a type argument. You could create a list of integers like so:

List<int> myInts = new List<int>();

In this example, the type argument is int. All the generic methods (or properties) of List that accept or return a T will instead use int.

Further reading

entity framework – Why Cant I Use TEntity?

Leave a Reply

Your email address will not be published.