0

I am using EF5.x Code First

namespace DAO.Models { public partial class Person { public int UserId { get; set; } } } 

i created another partial class to add custom properties.

namespace DAO.Models { public partial class Person { public string customName { get; set; } } } 

I have a Mapping that has been generated for my by EF 5.x power tools

 public PersonMap() { // Primary Key this.HasKey(t => new { t.PersonId }); // Table & Column Mappings this.ToTable("Person", "TableX"); this.Property(t => t.PersonId).HasColumnName("PersonId"); } 

when i try to add a new person to db

 XContext db = new XContext(); Person per= new Person(); db.Persons.Add(per); 

I get unknown column customName in Field List error

1 Answer 1

1

You can use the [NotMapped] annotation/attribute

[NotMapped] public string customName { get; set; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.