示例#1
0
 public override string ToString()
 {
     try
     {
         int    id  = GetID();
         string str = "ObjectReference\nID=" + id;
         object obj = GetObject();
         if (obj == null && _class != null)
         {
             ObjectContainerBase container = _class.Container();
             if (container != null && id > 0)
             {
                 obj = container.PeekPersisted(container.Transaction, id, container.DefaultActivationDepth
                                                   (ClassMetadata()), true).ToString();
             }
         }
         if (obj == null)
         {
             str += "\nfor [null]";
         }
         else
         {
             string objToString = string.Empty;
             try
             {
                 objToString = obj.ToString();
             }
             catch (Exception)
             {
             }
             if (ClassMetadata() != null)
             {
                 IReflectClass claxx = ClassMetadata().Reflector().ForObject(obj);
                 str += "\n" + claxx.GetName();
             }
             str += "\n" + objToString;
         }
         return(str);
     }
     catch (Exception)
     {
     }
     return("ObjectReference " + GetID());
 }