Skip to content

Instantly share code, notes, and snippets.

@lukemcgregor
Created May 16, 2012 08:37
Show Gist options
  • Save lukemcgregor/2708741 to your computer and use it in GitHub Desktop.
Save lukemcgregor/2708741 to your computer and use it in GitHub Desktop.
Shows that EF by default uses _ in fk names
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
using (var ctx = new MyContext())
{
ctx.Status.ToList();
}
}
}
public class MyContext : DbContext
{
public DbSet<Podcast> Podcasts { get; set; }
public DbSet<Status> Status { get; set; }
}
public class Status
{
public int Id { get; set; }
}
public class Podcast
{
public int Id { get; set; }
public virtual Status Status { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment