Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Inheritance #4

Open
GoogleCodeExporter opened this issue Jun 30, 2015 · 3 comments
Open

Problems with Inheritance #4

GoogleCodeExporter opened this issue Jun 30, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

I have a base class and derived class and can't seam to use the reflection
tool with this calss.  It works fine for some things, but this example
breaks it.

class timeoffReport : Report
{
  public string date;
}

class Report
{
  public string title;
}

When trying to convert the timeoffReport class to json the system errors
out saying it can't find title in timeoffReport.

Original issue reported on code.google.com by jeremy.p...@gmail.com on 7 Aug 2009 at 7:00

@GoogleCodeExporter
Copy link
Author

Jeremy,

Can you post your code?  An error stack for reflection is usually quite robust. 
 It
would help to see your full implementation.

Original comment by jeff.rod...@gmail.com on 11 Aug 2009 at 8:49

@GoogleCodeExporter
Copy link
Author

Ok, the problem i am having specifically is running the following method to 
convert
the auto-generated user profile data into a json object to pass to javascript. 

<%= new JSONSharp.JSONReflector(WebProfile.Current).ToString() %>

I added a fix to JSONReflector.cs to get past an error with array objects and 
another
to deal with null values:
 public override object this[string propertyName]

+
                if (pi.ToString().EndsWith("[System.String]"))
                    continue;

----

I can't seam to get the reflection error anymore but I am still having problems
getting recursion to work. Ie: that is, I can see ll the properties of 
ProfileCommon
but neither ProfileGroupDisplay of ProfileDisplayMail come through.  



----
From web.config

    <profile enabled="true">
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
      <properties>
        <clear />
        <add name="DebugMode" type="Boolean" defaultValue="false" />
        <add name="EnableShortcuts" type="Boolean" defaultValue="true" />
        <add name="EnableControlShortcuts" type="Boolean" defaultValue="true" />
        <group name="Display">
          <add name="NameFormat" type="Boolean" defaultValue="true" />
        </group>
        <group name="Mail">
          <add name="TestJobCC" type="String" defaultValue="" />
        </group>
      </properties>
    </profile>

Original comment by jeremy.p...@gmail.com on 12 Aug 2009 at 8:04

Attachments:

@GoogleCodeExporter
Copy link
Author

Ok, while I got recursion to work with the following addition to 
JSONReflector.cs

Adding the following to the end of GetJSONValue()

            else
            {
                jsonValue = new JSONObjectValue(new JSONReflector(objValue).ToString());
            }
            return jsonValue;
        }


And adding the included file tot eh project.

Original comment by jeremy.p...@gmail.com on 12 Aug 2009 at 8:27

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant