0

How can i extend the entity class in EF 3.5 for example below. As i know, it work on EF 4 and above, but not in EF 3.5.

partial class car
{
    public car(string carName)
    {
        this.name = carName;
        /* does not contain a definition for 'name' and no 
         * extension method 'name' accepting a first argument
         * of type 'xxx.car' could be found (are you missing 
         * a using directive or an assembly reference?) 
         */
    }
}
5
  • Why would you want to use EF3.5? Also I don't understand your question, you try to give a field that doesn't exist a value in a constructor, why would you expect not to get an error? Commented Dec 3, 2015 at 9:34
  • @AlexanderDerck partial class Commented Dec 3, 2015 at 9:52
  • This technically has nothing to do with EF, but i get what you mean. Commented Dec 3, 2015 at 9:53
  • Yes I saw it's a partial class, but if it gives that error, it means you don't have a field named name Commented Dec 3, 2015 at 9:56
  • The reason i use EF3.5 it's because the IIS .net framework is 3.5. And the team don't wish to upgrade the .net framework. Thanks for help. Commented Dec 3, 2015 at 10:22

1 Answer 1

1
  1. Make sure both classes are public.
  2. Make sure the Property has a public setter.
  3. Make sure they are in the same namespace.
Sign up to request clarification or add additional context in comments.

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.