-
Notifications
You must be signed in to change notification settings - Fork 0
CodeFirst
Marcin Sulecki edited this page Mar 15, 2017
·
4 revisions
- Na podstawie klas generowana jest baza danych
- Obsługuje klasy POCO (Plain Old CLR Objects)
public class Artist : Base
{
public int ArtistId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
public enum AlbumType
{
LP,
SG
}
public class Album : Base
{
public int AlbumId { get; set; }
public string Title { get; set; }
public decimal Price { get; set; }
public Artist Artist { get; set; }
public AlbumType AlbumType { get; set; }
}
public class MusicStoreContext : DbContext
{
public DbSet<Artist> Artists { get; set; }
public DbSet<Album> Albums { get; set; }
public MusicStoreContext()
: base("MusicStoreConnection")
{
}
}