nassss

Untitled

Apr 11th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. using BeerOverflowAV.Data.Entities;
  2. using Microsoft.EntityFrameworkCore;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6.  
  7. namespace BeerOverflowAV.Data.Seeder
  8. {
  9. public static class ModelBuilderExtension
  10. {
  11. public static void Seeder(this ModelBuilder builder)
  12. {
  13. //Country
  14. builder.Entity<Country>().HasData(
  15. new Country
  16. {
  17. Id = Guid.Parse("253ad297-7da0-4302-a211-6d8b80cabfa0"),
  18. Name = "Bulgaria",
  19. },
  20. new Country
  21. {
  22. Id = Guid.Parse("889a4666-7cd4-4733-946c-3960d8826b5d"),
  23. Name = "Serbia",
  24. },
  25. new Country
  26. {
  27. Id = Guid.Parse("59e77aef-0550-4eeb-864a-7c17b3696e77"),
  28. Name = "Romania",
  29. });
  30.  
  31. //Brewery
  32. builder.Entity<Brewery>().HasData(
  33. new Brewery
  34. {
  35. Id = Guid.Parse("993d7431-0be5-4479-b8c2-9e1c53ca7e67"),
  36. Name = "KamenitzaAD",
  37. CountryId = Guid.Parse("253ad297-7da0-4302-a211-6d8b80cabfa0"), // the same as Bulgaria Guid
  38. },
  39. new Brewery
  40. {
  41. Id = Guid.Parse("839d494c-840c-432b-be31-9765750bad14"),
  42. Name = "Zajchar",
  43. CountryId = Guid.Parse("889a4666-7cd4-4733-946c-3960d8826b5d"), // the same as Serbia Guid
  44. },
  45. new Brewery
  46. {
  47. Id = Guid.Parse("0c87b7f9-317c-43d3-abbb-42a1365362b1"),
  48. Name = "Timisoara",
  49. CountryId = Guid.Parse("59e77aef-0550-4eeb-864a-7c17b3696e77"), // the same as Romania Guid
  50. });
  51.  
  52. //Style
  53. builder.Entity<Style>().HasData(
  54. new Style
  55. {
  56. Id = Guid.Parse("7809e394-4bdf-42b6-8504-920da3a26a80"),
  57. Name = "BatkaStyle",
  58. },
  59. new Style
  60. {
  61. Id = Guid.Parse("ebb0a604-505e-43ba-a0d4-896d4a703f8d"),
  62. Name = "BrateStyle",
  63. },
  64. new Style
  65. {
  66. Id = Guid.Parse("66bc75dd-b894-43a4-afb1-6a79bba8f316"),
  67. Name = "MamaligaStyle",
  68. });
  69.  
  70. //Beer
  71. builder.Entity<Beer>().HasData(
  72. new Beer
  73. {
  74. Id = Guid.Parse("b013d5d2-3348-4daa-9a94-0aeee86e44c5"),
  75. Name = "Burgasko",
  76. Brand = "Burgasko",
  77. CountryId = Guid.Parse("253ad297-7da0-4302-a211-6d8b80cabfa0"),
  78. StyleId = Guid.Parse("7809e394-4bdf-42b6-8504-920da3a26a80"), //the same as Batka Style Id
  79. BreweryId = Guid.Parse("993d7431-0be5-4479-b8c2-9e1c53ca7e67"), //the same as KamenitzaAD Id
  80. ABV = double.Parse("4.5"),
  81. },
  82. new Beer
  83. {
  84. Id = Guid.Parse("66337ae1-5a6f-4e5f-801b-ba18efd206e3"),
  85. Name = "Zajecharsko",
  86. Brand = "Zajchersko",
  87. CountryId = Guid.Parse("889a4666-7cd4-4733-946c-3960d8826b5d"),
  88. StyleId = Guid.Parse("ebb0a604-505e-43ba-a0d4-896d4a703f8d"), //the same as Brate Style Id
  89. BreweryId = Guid.Parse("839d494c-840c-432b-be31-9765750bad14"), // the same as Zajchar Brewery Id
  90. ABV = double.Parse("3.5"),
  91. },
  92. new Beer
  93. {
  94. Id = Guid.Parse("e2e4bfd0-95e8-4b19-8666-731594961eb1"),
  95. Name = "Ursus",
  96. Brand = "Ursus",
  97. CountryId = Guid.Parse("59e77aef-0550-4eeb-864a-7c17b3696e77"),
  98. StyleId = Guid.Parse("66bc75dd-b894-43a4-afb1-6a79bba8f316"), //the same as Mamaliga Style Id
  99. BreweryId = Guid.Parse("0c87b7f9-317c-43d3-abbb-42a1365362b1"), // the same as Timisoara Brewery Id
  100. ABV = double.Parse("5.5"),
  101. }
  102. );
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment