Dreampuf
Dreampuf

Reputation: 1181

Obtained by reflection method of implementation class

public void Express(Expression<Func<User, bool>> express)
{
    BLL.Manager.ILogManager logs = BLL.Container.ObjectContainer.getObject<BLL.Manager.ILogManager>();
    logs.GetAll(1);
    var total = logs.LastPageTotal;
}

As the above code, I need to know ILogManager the implementation class, I only know that the information reflected the way, but in the method defined type is the type of interface

I've been through the IL reflecting some call information, call the information I need to get in the end these by which class to call.

Upvotes: 1

Views: 215

Answers (1)

Tim Robinson
Tim Robinson

Reputation: 54734

I need to know ILogManager the implementation class

If I understand correctly:

  • You've got some code that uses an ILogManager variable
  • You want to find out which class implements ILogManager

You could insert a call to logs.GetType() in the code; this will tell you the class type that implements ILogManager.

Alternatively, you can tell you which classes implement a given interface the same way that Reflector does: by loading every possible assembly, looking at the types in those assemblies, and recording which ones implement ILogManager.

Upvotes: 0

Related Questions