Guest User

Untitled

a guest
Oct 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public class MyThing
  2. {
  3. public int MyThingId { get; set; }
  4.  
  5. public int UserId { get; set; }
  6. public string Title { get; set; }
  7. public string Address { get; set; }
  8. public string Description { get; set; }
  9. public DateTime Date { get; set; }
  10. }
  11.  
  12. public class MyThingDb : DbContext
  13. {
  14. // If I comment this constructor out the scaffolding works
  15. public MyThingDb()
  16. : base("DefaultConnection")
  17. {
  18. }
  19.  
  20. public DbSet<MyThing> Things{ get; set; }
  21. }
  22.  
  23. <connectionStrings>
  24. <add name="DefaultConnection" ... />
  25. </connectionStrings>
  26.  
  27. <add name="MyContext" connectionString="Data Source=|DataDirectory|MyDatabase.sdf" providerName="System.Data.SqlServerCe.4.0" />
  28.  
  29. public class MyContext : DbContext
  30. {
  31. public MyContext() : base("MyDatabase") { }...
  32.  
  33. public MyThingDb()
  34. : base("name=MyContext")
  35. {
  36. }
  37.  
  38. [Display(Name="Logo")]
  39. [DataType(DataType.Upload)]
  40. [NotMapped]
  41. public HttpPostedFileBase Logo { set; get; }
  42.  
  43. public
  44. DbSet<MyThing> Things
  45. { get; set; }
  46. }
  47.  
  48. //[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
  49. public class NameDbContext
  50. {}
Add Comment
Please, Sign In to add comment