tags:

views:

47

answers:

1
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.

A: 

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.

Tim Robinson
I can not modify the code inside the method, it is impossible to insert log.GetType (). In addition, if multiple ILogManager implement how match?
Dreampuf
If you can't modify the code then my second suggestion might help. What are you trying to do?
Tim Robinson
yes...reflecting all the interfaces, and then look for its implementation class
Dreampuf
You have to do it in reverse: (1) Find all application assemblies; (2) Find all classes in those assemblies; (3) Look at the classes that implement `ILogManager`
Tim Robinson