You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This article is a continuation of this section - as it seems that I "waffled" in my response to @Thanood's question. In other words, whatever my answer was, this text here supersedes it in full.
sampleTag = "Autocomplete";
var autocompleteComponent = new Component()
{
DateCreated = DateTime.UtcNow,
Name = sampleTag,
CreatorName = "@catalogAdmin",
ComponentTags = new List<ComponentTag>() { new ComponentTag { cTag = "autocomplete" } },
Samples = new List<Sample>()
{
new Sample() { Name = "basic-use", gist = "0ddb2e1d4ff26b988382c9150d4fc475" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "basic-use" } } },
new Sample() { Name = "api", gist = "55999353554add4f866b26481f0ad555" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "api" } } },
new Sample() { Name = "customizing-templates", gist = "f4755c3c68dab68260647851ff9e52a0" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "customizing-templates" } } },
new Sample() { Name = "events", gist = "625fc6a733b599fa9374d732ae5e696d" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "events" } } },
new Sample() { Name = "server-filtering", gist = "65f25b1fb2e07ec4e2749d21136650e7" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "server-filtering" } } },
new Sample() { Name = "virtualization", gist = "1abf5f5fbb4d3e1306385506bc676aff" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "virtualization" } } },
new Sample() { Name = "grouping", gist = "5da30e9c363cf37fe3e313476a65edb4" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "grouping" } } },
new Sample() { Name = "value-binding", gist = "ba981cf9b774273a75bb6a4dedf21190" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "value-binding" } } },
new Sample() { Name = "highlighting", gist = "078dec4fe353ff9214ef6d5ee0e091a7" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "highlighting" } } },
new Sample() { Name = "with.bind", gist = "2fa190db778824c2b406b10c673ae9ae" , sampleTags = new List<SampleTag>() { new SampleTag { sTag = "with.bind" } } },
}
};
The entity ComponentTags is defined here as
ComponentTags = new List<ComponentTag>() { new ComponentTag { cTag = "autocomplete" } }
which states that the object containing the tags for a component is a List of ComponentTag objects, which in turn are almost "plain strings" (objects consisting of a string, containing the actual tag and the index of that tag
public class ComponentTag
{
public int Id { get; set; }
public string cTag { get; set; }
}
One could say that this ComponentTag is unnecessary, since it is an element of a List which already implies ordering and the Id is redundant - and this is where I initially answered that my original code is wrong.
As @JeroenVinke takes over this part (being kind to bail me out of my "deep water" situation) - this can be resolved by either replacing List with an unordered Collection, or any other way.
Note that I wanted to preserve the ComponentTag class to remain in the form it is now, so we can enrich it later.
Note that the code being discussed here is created by the GenerateSampleHeader(title, componentName) function. So, if the decision will be made to change the initialization code for all components - that would be a simple thing to do and I will recreate the database once someone defines this change for me.
The text was updated successfully, but these errors were encountered:
This article is a continuation of this section - as it seems that I "waffled" in my response to @Thanood's question. In other words, whatever my answer was, this text here supersedes it in full.
The CatalogContextSeedData.cs file defines the
autocomplete
entity to beThe entity
ComponentTags
is defined here aswhich states that the object containing the tags for a component is a
List
ofComponentTag
objects, which in turn are almost "plain strings" (objects consisting of a string, containing the actual tag and the index of that tagOne could say that this
ComponentTag
is unnecessary, since it is an element of aList
which already implies ordering and theId
is redundant - and this is where I initially answered that my original code is wrong.As @JeroenVinke takes over this part (being kind to bail me out of my "deep water" situation) - this can be resolved by either replacing
List
with an unorderedCollection
, or any other way.Note that I wanted to preserve the
ComponentTag
class to remain in the form it is now, so we can enrich it later.Note that the code being discussed here is created by the GenerateSampleHeader(title, componentName) function. So, if the decision will be made to change the initialization code for all components - that would be a simple thing to do and I will recreate the database once someone defines this change for me.
The text was updated successfully, but these errors were encountered: