Error Message :"The type 'TEntity' must be a reference type in order to use it as parameter 'T' in the generic type or method 'XXXXX' (CS0452) -"
I got a line of code like this:
Code
public class HibnerateRepository<TEntity, TId> : IRepository<TEntity, TId> | |
...... | |
public IList<TEntity> GetAll() |
That sounds alright, but I got an Error Message :"The type 'TEntity' must be a reference type in order to use it as parameter 'T' in the generic type or method 'XXXXX' (CS0452) -".
Well, that is a common mistake and easy to fix.
Code
public class HibnerateRepository<TEntity, TId> : IRepository<TEntity, TId> where TEntity:class | |
...... | |
public IList<TEntity> GetAll() |
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 8 feedbacks awaiting moderation...
Form is loading...