Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# Entity Framework Basics Entity Framework and Databases Where's Our Data?

Anders Lund
Anders Lund
4,155 Points

Dont get any tables or any thing up in my Console window

When i hit f5 the console window shows, but the data does not write to the console. When i run the program by hitting ctrl shift B its says that 0 succeds and 0 errors so there is something wrong here.

Could it have anything to do with where I save the file pn my PC?

using FilmGalleryModel.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FilmGalleryModel
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var context = new Context())
            {
                context.Films.Add(new Film()
                {
                    MovieTitle = "Inception"
                });
                context.SaveChanges();

                var films = context.Films.ToList();
                foreach (var film in films)
                {
                    Console.WriteLine(film.MovieTitle);
                }
                Console.ReadLine();
            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FilmGalleryModel.Models
{
    public class Film
    {
        public int Id { get; set; }
        public string MovieTitle { get; set; }
    }
}
using FilmGalleryModel.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FilmGalleryModel
{
    public class Context : DbContext
    {
        public DbSet<Film> Films { get; set; }
    }
}

1 Answer

James Churchill
STAFF
James Churchill
Treehouse Teacher

Anders,

Pressing CTRL+SHIFT+B will build your project, but if the project was previously successfully built and there haven't been any changes to the project since that build, then you'll see the message Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped.

Are you seeing the same message when building multiple times (and making no changes)?

Have you tried setting a break point inside of the Main method and debugging your app by pressing F5?

Thanks ~James