0

Anyone have any idea why the auto-implemented version of the class does not come through on a Post to the Web API?

namespace N_EWA
{
    public class testMe
    {
        public bool Pending { get; set; }
    }
}

However.... if I define the class and property as below.... it recognizes the incoming object and it works....

namespace N_EWA
{
    public class testMe
    {
        private bool pending { get; set; }

        public bool Pending
        {
            get { return pending; }
            set { pending = value; }
        }
    }
}
1
  • What you are saying makes no sense. It is very unlikely to be the cause of your issue Commented May 29, 2014 at 4:09

3 Answers 3

1

Not possible. The two are identical in function. Show more context of your code - I assure you there's a problem elsewhere.

Sign up to request clarification or add additional context in comments.

Comments

0

I was going to put this in comments but I think it warrents its own answer entry.

I thought about this overnight.... since auto-implemented properties are created by the compiler itslef could it be that since I am running this as a standard website and not a web application that Web API is not able to work with the auto-implemented class/properties since the generated private fields used to manage the get/set of the property exist only in compiled code like you get when you have a web application?

Comments

0

The offical answer is user error on my part.... :-)

For some unknown reason the complex object that I was trying to post had the booleans set to True and False (capital T and F)..... simply changing the values to true and false (all lowers) corrected the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.