Step 3: Solution with Entity Framework

by sunil ravulapalli /24. June 2013 22:08 /software-design /Comments (0)

Create wishlist item class in the Core project.

public class WishListItem
   public int Id { get; set; } 
   public string Description { get; set; } 
   public int Quantity { get; set; }

Add Entity framework using nuget to Data project.
Add reference to Core project in the Data project.
Create a context class in the Data project.

public class CompanyDbContext : DbContext
   public DbSet<WishListItem> WishListItems { get; set; }

Using the nuget console run "enable-migratons" for the Data project.
Also, using the nuget console run "update-database" for the Data project.

This will create the database in SQL express or LocalDb if the machine does not have SQL express. 

You can find the solution on GitHub.


blog comments powered by Disqus