Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Entity Framework Code First

Posted on 2011-09-08
1
Medium Priority
?
345 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 2000 total points
ID: 36503644
The property has to be public, try this


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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project

705 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