Solved

Entity Framework Code First

Posted on 2011-09-08
1
338 Views
Last Modified: 2012-06-27
Hi,

I'm trying to write my first project for Entity Data Model with Code First approach.

My project is composed in 3 part:

EFDemo a console project
Demo.data a class library about my object model
Demo.dataAccess a class library  about my DbContext

The error viewable in the image attached, is not understandable for me.
Please  suggest me where to find the trouble

Thanks




namespace Demo.Data
{
    public class Attendee
    {
        [Key]
        private int AttendeeID { get; set; }
       
        [StringLength(50)]
        private string LastName { get; set; }

        private DateTime DateAddeted { get; set; }


    }
}

namespace Demo.DataAccess
{
    public class CodeContext : DbContext
    {
        public CodeContext() :
            base("Server=.;Database=CodeStock;Trusted_Connection=true")
        {      
   
        }    

        public DbSet<Attendee> Attendees { get; set; }
    }
} My error
0
Comment
Question by:vgruppo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
Irzana earned 500 total points
ID: 36503644
The property has to be public, try this


[Key]
        public int AttendeeID { get; set; }
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Part One of the two-part Q&A series with MalwareTech.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question