-
Notifications
You must be signed in to change notification settings - Fork 1
/
Model.cs
25 lines (22 loc) · 1004 Bytes
/
Model.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
namespace EF.Models {
public class Order {
[Key]
public int OrderID { get; set; }
public string CustomerID { get; set; }
public string ShipName { get; set; }
public string ShipAddress { get; set; }
}
public class NorthwindContext : DbContext {
public NorthwindContext() : base("SQLCompact_Northwind_Connection") { }
public DbSet<Order> Orders { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
modelBuilder.Entity<Order>().Property(p => p.OrderID).HasColumnName("Order ID");
modelBuilder.Entity<Order>().Property(p => p.CustomerID).HasColumnName("Customer ID");
modelBuilder.Entity<Order>().Property(p => p.ShipName).HasColumnName("Ship Name");
modelBuilder.Entity<Order>().Property(p => p.ShipAddress).HasColumnName("Ship Address");
}
}
}