Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class Database
  2. {
  3. public int ID { get; set; }
  4. public string name { get; set; }
  5. public virtual List<ElementBase> elements { get; set; }
  6. private string XMLpath;
  7. }
  8.  
  9. public abstract class ElementBase : ObservableObject
  10. {
  11. [Key]
  12. public int ID { get; set; }
  13.  
  14. public string name { get; set; }
  15.  
  16. public ElementBase() { }
  17. public ElementBase(String name)
  18. {
  19. this.name = name;
  20. }
  21.  
  22. }
  23.  
  24. public class Element : ElementBase
  25. {
  26. protected string type;
  27. public virtual List<ElementBase> elements { get; set;}
  28. }
  29. public class Attribute : ElementBase
  30. {
  31. private string value;
  32. private byte editable;
  33. }
  34.  
  35. public DbSet<NWViewer.Model.Database> Databases { get; set; }
  36.  
  37. public static void add(NW.Database db)
  38. {
  39. using (var dbContext = new DatabaseContext())
  40. {
  41. dbContext.Databases.Add(db);
  42. dbContext.SaveChanges();
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement