Revize 8b2a2c15
Přidáno uživatelem Vojtěch Bartička před asi 3 roky(ů)
Backend/Core/Seeding/Seeder.cs | ||
---|---|---|
20 | 20 |
var classes = AddClasses(context); |
21 | 21 |
DummyTags.AddDummyTags(context); |
22 | 22 |
context.SaveChanges(); |
23 |
|
|
24 |
AddTagInstance(context); |
|
25 |
context.SaveChanges(); |
|
23 | 26 |
} |
27 |
|
|
28 |
} |
|
29 |
|
|
30 |
private static void AddTagInstance(DatabaseContext context) |
|
31 |
{ |
|
32 |
var tag = context.Tags.Where(t => context.SubTags.Any(st => st.Tag == t)).First(); |
|
33 |
var subtag = context.SubTags.Where(st => st.Tag == tag).First(); |
|
34 |
var annotation = context.Annotations.First(); |
|
35 |
AnnotationTag at = new AnnotationTag() |
|
36 |
{ |
|
37 |
Annotation = annotation, |
|
38 |
Instance = 1, |
|
39 |
Length = 10, |
|
40 |
Position = 0, |
|
41 |
SubTag = subtag, |
|
42 |
Note = "asdasdasd", |
|
43 |
Tag = tag |
|
44 |
}; |
|
45 |
context.AnnotationTags.Add(at); |
|
24 | 46 |
} |
25 | 47 |
|
26 | 48 |
public static void SeedProduction(DatabaseContext context) |
Také k dispozici: Unified diff
Seeding for an annotation tag instance