Esempio n. 1
0
        public override string ToString()
        {
            var buffer = new StringBuilder(_classInfo.FullClassName).Append("(").Append(GetOid()).Append(")=");

            if (_attributeValues == null)
            {
                buffer.Append("null attribute values");
                return(buffer.ToString());
            }

            for (var i = 0; i < _attributeValues.Length; i++)
            {
                if (i != 0)
                {
                    buffer.Append(",");
                }

                var attributeName = (_classInfo != null
                                         ? (_classInfo.GetAttributeInfo(i)).GetName()
                                         : "?");

                buffer.Append(attributeName).Append("=");
                object @object = _attributeValues[i];

                if (@object == null)
                {
                    buffer.Append(" null object - should not happen , ");
                }
                else
                {
                    var type = OdbType.GetFromClass(_attributeValues[i].GetType());
                    if (@object is NonNativeNullObjectInfo)
                    {
                        buffer.Append("null");
                        continue;
                    }
                    if (@object is NonNativeDeletedObjectInfo)
                    {
                        buffer.Append("deleted object");
                        continue;
                    }
                    var noi = @object as NativeObjectInfo;
                    if (noi != null)
                    {
                        buffer.Append(noi);
                        continue;
                    }
                    var nnoi = @object as NonNativeObjectInfo;
                    if (nnoi != null)
                    {
                        buffer.Append("@").Append(nnoi.GetClassInfo().FullClassName).Append("(id=").Append(
                            nnoi.GetOid()).Append(")");
                        continue;
                    }
                    if (@object is ObjectReference)
                    {
                        buffer.Append(@object);
                        continue;
                    }
                    buffer.Append("@").Append(OdbClassNameResolver.GetClassName(type.Name));
                }
            }

            return(buffer.ToString());
        }