Advertisement
Guest User

configmigration

a guest
Dec 14th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.07 KB | None | 0 0
  1. namespace concept_sharing_sem1.Migrations
  2. {
  3. using concept_sharing_sem1.Models;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data.Entity;
  7. using System.Data.Entity.Migrations;
  8. using System.Linq;
  9.  
  10. internal sealed class Configuration : DbMigrationsConfiguration<concept_sharing_sem1.Models.Connection>
  11. {
  12. public Configuration()
  13. {
  14. AutomaticMigrationsEnabled = false;
  15. }
  16.  
  17. // use Enable-Migrations in package manager if migrations dont exist
  18. // use Add-Migration to add a migration and remember a name. Example = Add-Migration ""Initial" <-- Name
  19. // Use Update-Database to update with the new migration you just have added
  20.  
  21.  
  22.  
  23. protected override void Seed(concept_sharing_sem1.Models.Connection context)
  24. {
  25. // This method will be called after migrating to the latest version.
  26.  
  27. // You can use the DbSet<T>.AddOrUpdate() helper extension method
  28. // to avoid creating duplicate seed data.
  29.  
  30.  
  31. //This is test data
  32. context.Users.AddOrUpdate(x => x.UserID, new User() { UserID = 1, Email = "rd@mail.dk", Username = "RD", Password = "123" });
  33.  
  34. context.Users.AddOrUpdate(x => x.UserID, new User() { UserID = 2, Email = "sb@mail.dk", Username = "SB", Password = "123" });
  35.  
  36. context.Users.AddOrUpdate(x => x.UserID, new User() { UserID = 3, Email = "pr@mail.dk", Username = "PR", Password = "123" });
  37.  
  38. context.Roles.AddOrUpdate(x => x.RoleID, new Role()
  39. {
  40. RoleID = 1,
  41. RoleName = "Admin"
  42. }
  43. );
  44.  
  45. context.Roles.AddOrUpdate(x => x.RoleID, new Role()
  46. {
  47. RoleID = 2,
  48. RoleName = "Teacher"
  49. }
  50. );
  51.  
  52. context.Roles.AddOrUpdate(x => x.RoleID, new Role()
  53. {
  54. RoleID = 3,
  55. RoleName = "Student"
  56. }
  57. );
  58.  
  59. // Admin rights
  60.  
  61. context.Rights.AddOrUpdate(x => x.RightID, new Right
  62. {
  63. RightID = 1,
  64. RightName = "Create"
  65. });
  66.  
  67. context.Rights.AddOrUpdate(x => x.RightID, new Right
  68. {
  69. RightID = 2,
  70. RightName = "Read"
  71. });
  72.  
  73. context.Rights.AddOrUpdate(x => x.RightID, new Right
  74. {
  75. RightID = 3,
  76. RightName = "Update"
  77. });
  78.  
  79. context.Rights.AddOrUpdate(x => x.RightID, new Right
  80. {
  81. RightID = 4,
  82. RightName = "Delete"
  83. });
  84.  
  85. //context.Concepts.AddOrUpdate(new Concept { ConceptID = 1, Title = "Signifier", Courses = new List<Course>() { new Course { CourseID = 1, CourseName = "Interface Design" } } });
  86. ////context.Concepts.AddOrUpdate(new Concept { ConceptID = 2, Title = "Feedback", Sources = new List<Source>() { new Source { Arthor = "Allan cooper", SourceName = "Aboutface" } } });
  87.  
  88. //context.Subjects.AddOrUpdate(new Subject { SubjectID = 1, Content = "dd" });
  89.  
  90.  
  91. context.Courses.AddOrUpdate(new Course { CourseID = 1, CourseName = "Interface Design" });
  92. context.Courses.AddOrUpdate(new Course { CourseID = 2, CourseName = "Backend" });
  93. context.Courses.AddOrUpdate(new Course { CourseID = 3, CourseName = "Frontend" });
  94. context.Courses.AddOrUpdate(new Course { CourseID = 4, CourseName = "Database" });
  95. context.Courses.AddOrUpdate(new Course { CourseID = 5, CourseName = "Communication" });
  96. context.Courses.AddOrUpdate(new Course { CourseID = 6, CourseName = "Interaction" });
  97. context.Courses.AddOrUpdate(new Course { CourseID = 7, CourseName = "Business" });
  98. context.Courses.AddOrUpdate(new Course { CourseID = 8, CourseName = "Design" });
  99. context.Courses.AddOrUpdate(new Course { CourseID = 9, CourseName = "Mobile Concept" });
  100. context.Courses.AddOrUpdate(new Course { CourseID = 10, CourseName = "Systemdesign" });
  101. context.Courses.AddOrUpdate(new Course { CourseID = 11, CourseName = "Android" });
  102. context.Courses.AddOrUpdate(new Course { CourseID = 12, CourseName = "Frameworks" });
  103. context.Courses.AddOrUpdate(new Course { CourseID = 13, CourseName = "IOS" });
  104. context.Courses.AddOrUpdate(new Course { CourseID = 14, CourseName = "Augmented Reality" });
  105. context.Courses.AddOrUpdate(new Course { CourseID = 15, CourseName = "Workenvironments" });
  106.  
  107.  
  108. //context.Sources.AddOrUpdate(new Source { SourceID = 1, Arthor = "Alan Cooper", SourceName = "Aboutface" });
  109. //context.Sources.AddOrUpdate(new Source { SourceID = 2, Arthor = "Sarah D", SourceName = "Ux personas" });
  110. //context.Sources.AddOrUpdate(new Source { SourceID = 3, Arthor = "Jose Torre", SourceName = "10 basic rules of UX" });
  111.  
  112.  
  113. context.SourceTypes.AddOrUpdate(new SourceType { SourceTypeID = 1, SourceTypeName = "Bog" });
  114. context.SourceTypes.AddOrUpdate(new SourceType { SourceTypeID = 2, SourceTypeName = "Url" });
  115. context.SourceTypes.AddOrUpdate(new SourceType { SourceTypeID = 3, SourceTypeName = "Link" });
  116.  
  117. context.SourceTypeAttributes.AddOrUpdate(new SourceTypeAttribute { SourceTypeAttributeID = 1, SourceTypeAttributeName = "Side start", SourceTypeAttributeCatID = 1 });
  118. context.SourceTypeAttributes.AddOrUpdate(new SourceTypeAttribute { SourceTypeAttributeID = 2, SourceTypeAttributeName = "Side slut", SourceTypeAttributeCatID = 1 });
  119. context.SourceTypeAttributes.AddOrUpdate(new SourceTypeAttribute { SourceTypeAttributeID = 3, SourceTypeAttributeName = "URL", SourceTypeAttributeCatID = 2 });
  120. context.SourceTypeAttributes.AddOrUpdate(new SourceTypeAttribute { SourceTypeAttributeID = 4, SourceTypeAttributeName = "Time Stamp", SourceTypeAttributeCatID = 3 });
  121.  
  122.  
  123.  
  124.  
  125.  
  126. context.SaveChanges();
  127.  
  128. }
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement