if I have a class like this :
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>, IDbContext
how can I get some properties of ApplicationUser
inside ApplicationDbContext
?
if I have a class like this :
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>, IDbContext
how can I get some properties of ApplicationUser
inside ApplicationDbContext
?
Think of the following program:
class Program
{
static void Main(string[] args)
{
var calc = new Calculator<string>();
Console.WriteLine(calc.Add(1,1));
}
}
class Calculator<T>
{
public int Add(int a, int b)
{
return a + b;
}
}
There is no way to get any string-like properties from the calculator.
The reason is that string
is a type parameter, not an object. Whether or not the class makes properties accessible depends on many other factors. A List<T>
allows to get objects of type T back, but other classes needn't do that.