public void GetsComponentContexts() { SetupMyNamespaceComponents(); var contextNames = _data.GetContextNames(); Assert.AreEqual(2, contextNames.Length); Assert.AreEqual("Test", contextNames[0]); Assert.AreEqual("Test2", contextNames[1]); }
CodeGenFile[] generateExtensions(ComponentData data) { if (data.GetContextNames().Length > 1) { return(new[] { generateInterface(data) }.Concat( data.GetContextNames().Select(contextName => generateEntityInterfaceExtension(contextName, data)) ).ToArray()); } return(new CodeGenFile[0]); }
CodeGenFile generateComponentClass(ComponentData data) { var contexts = string.Join(", ", data.GetContextNames()); var unique = data.IsUnique() ? "[Entitas.CodeGenerator.Api.UniqueAttribute]" : string.Empty; if (!string.IsNullOrEmpty(contexts)) { contexts = "[" + contexts + "]"; } var hide = data.ShouldHideInBlueprintInspector() ? "[Entitas.CodeGenerator.Api.HideInBlueprintInspectorAttribute]" : string.Empty; return(new CodeGenFile( "Components" + Path.DirectorySeparatorChar + data.GetFullComponentName() + ".cs", COMPONENT_TEMPLATE .Replace("${Name}", data.GetFullComponentName()) .Replace("${Type}", data.GetObjectType()) .Replace("${Contexts}", contexts) .Replace("${Unique}", unique) .Replace("${HideInBlueprintsInspector}", hide), GetType().FullName )); }
private static IEnumerable <CodeGenFile> FileByComponentNameIn(CodeGenFile[] codeGenFiles, ComponentData component) { foreach (CodeGenFile file in codeGenFiles) { string contextName = file.ContextName(); string[] componentContextNames = component.GetContextNames(); string componentNameStripped = component.ComponentName() .Replace("Component", ""); if (componentContextNames.Any(x => x == contextName) && file.fileName.EndsWith($"{contextName}{componentNameStripped}Component.cs")) { yield return(file); } } }
CodeGenFile generateComponentClass(ComponentData data) { var fullComponentName = data.GetFullTypeName().RemoveDots(); var contexts = string.Join(", ", data.GetContextNames()); var unique = data.IsUnique() ? "[QFramework.CodeGeneration.Attributes.UniqueAttribute]" : string.Empty; if (!string.IsNullOrEmpty(contexts)) { contexts = "[" + contexts + "]"; } return(new CodeGenFile( "Components" + Path.DirectorySeparatorChar + fullComponentName + ".cs", COMPONENT_TEMPLATE .Replace("${FullComponentName}", fullComponentName) .Replace("${Type}", data.GetObjectType()) .Replace("${Contexts}", contexts) .Replace("${Unique}", unique), GetType().FullName )); }
private static CodeGenFile FindByComponentNameIn(CodeGenFile[] codeGenFiles, ComponentData component) { CodeGenFile byName = null; foreach (var file in codeGenFiles) { var contextName = file.ContextName(); var componentContextNames = component.GetContextNames(); string componentNameStripped = component.ComponentName() .Replace("Component", ""); if (componentContextNames.Any(x => x == contextName) && file.fileName.EndsWith($"{contextName}{componentNameStripped}Component.cs")) { byName = file; break; } } return(byName); }
void when_providing() { context["component"] = () => { Type type = null; ComponentData data = null; before = () => { type = typeof(MyNamespaceComponent); data = getData <MyNamespaceComponent>(); }; it["get data"] = () => { data.should_not_be_null(); }; it["gets full type name"] = () => { data.GetFullTypeName().GetType().should_be(typeof(string)); data.GetFullTypeName().should_be(type.ToCompilableString()); }; it["gets contexts"] = () => { var contextNames = data.GetContextNames(); contextNames.GetType().should_be(typeof(string[])); contextNames.Length.should_be(2); contextNames[0].should_be("Test"); contextNames[1].should_be("Test2"); }; it["sets first context as default when component has no context"] = () => { var contextNames = getData <NoContextComponent>().GetContextNames(); contextNames.Length.should_be(1); contextNames[0].should_be("Game"); }; it["gets unique"] = () => { data.IsUnique().GetType().should_be(typeof(bool)); data.IsUnique().should_be_false(); getData <UniqueStandardComponent>().IsUnique().should_be_true(); }; it["gets member data"] = () => { data.GetMemberData().GetType().should_be(typeof(MemberData[])); data.GetMemberData().Length.should_be(1); data.GetMemberData()[0].type.should_be("string"); }; it["gets generate component"] = () => { data.ShouldGenerateComponent().GetType().should_be(typeof(bool)); data.ShouldGenerateComponent().should_be_false(); data.ContainsKey(ShouldGenerateComponentComponentDataExtension.COMPONENT_OBJECT_TYPE).should_be_false(); }; it["gets generate index"] = () => { data.ShouldGenerateIndex().GetType().should_be(typeof(bool)); data.ShouldGenerateIndex().should_be_true(); getData <DontGenerateIndexComponent>().ShouldGenerateIndex().should_be_false(); }; it["gets generate methods"] = () => { data.ShouldGenerateMethods().GetType().should_be(typeof(bool)); data.ShouldGenerateMethods().should_be_true(); getData <DontGenerateMethodsComponent>().ShouldGenerateMethods().should_be_false(); }; it["gets custom prefix"] = () => { data.GetCustomComponentPrefix().GetType().should_be(typeof(string)); data.GetCustomComponentPrefix().should_be("is"); getData <CustomPrefixFlagComponent>().GetCustomComponentPrefix().should_be("My"); }; }; context["non component"] = () => { Type type = null; ComponentData data = null; before = () => { type = typeof(ClassToGenerate); data = getData <ClassToGenerate>(); }; it["get data"] = () => { data.should_not_be_null(); }; it["gets full type name"] = () => { // Not the type, but the component that should be generated // See: no namespace data.GetFullTypeName().should_be("ClassToGenerateComponent"); }; it["gets contexts"] = () => { var contextNames = data.GetContextNames(); contextNames.Length.should_be(2); contextNames[0].should_be("Test"); contextNames[1].should_be("Test2"); }; it["gets unique"] = () => { data.IsUnique().should_be_false(); }; it["gets member data"] = () => { data.GetMemberData().Length.should_be(1); data.GetMemberData()[0].type.should_be(type.ToCompilableString()); }; it["gets generate component"] = () => { data.ShouldGenerateComponent().GetType().should_be(typeof(bool)); data.ShouldGenerateComponent().should_be_true(); data.GetObjectType().should_be(typeof(ClassToGenerate).ToCompilableString()); }; it["gets generate index"] = () => { data.ShouldGenerateIndex().should_be_true(); }; it["gets generate methods"] = () => { data.ShouldGenerateMethods().should_be_true(); }; it["gets custom prefix"] = () => { data.GetCustomComponentPrefix().should_be("is"); }; }; context["multiple types"] = () => { it["creates data for each type"] = () => { var types = new [] { typeof(NameAgeComponent), typeof(Test2ContextComponent) }; var provider = new ComponentDataProvider(types); provider.Configure(new Properties( "Entitas.CodeGeneration.Plugins.Contexts = Game, GameState" )); var data = provider.GetData(); data.Length.should_be(types.Length); }; }; context["multiple custom component names"] = () => { Type type = null; ComponentData data1 = null; ComponentData data2 = null; before = () => { type = typeof(CustomName); var data = getMultipleData <CustomName>(); data1 = data[0]; data2 = data[1]; }; it["creates data for each custom component name"] = () => { data1.GetObjectType().should_be(type.ToCompilableString()); data2.GetObjectType().should_be(type.ToCompilableString()); data1.GetFullTypeName().should_be("NewCustomNameComponent1Component"); data2.GetFullTypeName().should_be("NewCustomNameComponent2Component"); }; }; context["configure"] = () => { Type type = null; ComponentData data = null; before = () => { var properties = new Properties( "Entitas.CodeGeneration.Plugins.Contexts = ConfiguredContext" + "\n" ); type = typeof(NoContextComponent); data = getData <NoContextComponent>(properties); }; it["gets default context"] = () => { var contextNames = data.GetContextNames(); contextNames.Length.should_be(1); contextNames[0].should_be("ConfiguredContext"); }; }; }
void when_providing() { context["component"] = () => { Type type = null; ComponentData data = null; before = () => { type = typeof(MyNamespaceComponent); data = getData <MyNamespaceComponent>(); }; it["get data"] = () => { data.should_not_be_null(); }; it["gets full type name"] = () => { data.GetTypeName().GetType().should_be(typeof(string)); data.GetTypeName().should_be(type.ToCompilableString()); }; it["gets contexts"] = () => { var contextNames = data.GetContextNames(); contextNames.GetType().should_be(typeof(string[])); contextNames.Length.should_be(2); contextNames[0].should_be("Test"); contextNames[1].should_be("Test2"); }; it["sets first context as default when component has no context"] = () => { var contextNames = getData <NoContextComponent>().GetContextNames(); contextNames.Length.should_be(1); contextNames[0].should_be("Game"); }; it["gets unique"] = () => { data.IsUnique().GetType().should_be(typeof(bool)); data.IsUnique().should_be_false(); getData <UniqueStandardComponent>().IsUnique().should_be_true(); }; it["gets member data"] = () => { data.GetMemberData().GetType().should_be(typeof(MemberData[])); data.GetMemberData().Length.should_be(1); data.GetMemberData()[0].type.should_be("string"); }; it["gets generate component"] = () => { data.ShouldGenerateComponent().GetType().should_be(typeof(bool)); data.ShouldGenerateComponent().should_be_false(); data.ContainsKey(ShouldGenerateComponentComponentDataExtension.COMPONENT_OBJECT_TYPE).should_be_false(); }; it["gets generate index"] = () => { data.ShouldGenerateIndex().GetType().should_be(typeof(bool)); data.ShouldGenerateIndex().should_be_true(); getData <DontGenerateIndexComponent>().ShouldGenerateIndex().should_be_false(); }; it["gets generate methods"] = () => { data.ShouldGenerateMethods().GetType().should_be(typeof(bool)); data.ShouldGenerateMethods().should_be_true(); getData <DontGenerateMethodsComponent>().ShouldGenerateMethods().should_be_false(); }; it["gets flag prefix"] = () => { data.GetFlagPrefix().GetType().should_be(typeof(string)); data.GetFlagPrefix().should_be("is"); getData <CustomPrefixFlagComponent>().GetFlagPrefix().should_be("My"); }; it["gets is no event"] = () => { data.IsEvent().GetType().should_be(typeof(bool)); data.IsEvent().should_be_false(); }; it["gets event"] = () => { getData <StandardEventComponent>().IsEvent().should_be_true(); }; it["gets multiple events"] = () => { var d = getData <MultipleEventsStandardEventComponent>(); d.IsEvent().should_be_true(); var eventData = d.GetEventData(); eventData.Length.should_be(2); eventData[0].eventTarget.should_be(EventTarget.Any); eventData[0].eventType.should_be(EventType.Added); eventData[0].priority.should_be(1); eventData[1].eventTarget.should_be(EventTarget.Self); eventData[1].eventType.should_be(EventType.Removed); eventData[1].priority.should_be(2); }; it["gets event target"] = () => { getData <StandardEventComponent>().GetEventData()[0].eventTarget.GetType().should_be(typeof(EventTarget)); getData <StandardEventComponent>().GetEventData()[0].eventTarget.should_be(EventTarget.Any); getData <StandardEntityEventComponent>().GetEventData()[0].eventTarget.should_be(EventTarget.Self); }; it["gets event type"] = () => { getData <StandardEventComponent>().GetEventData()[0].eventType.GetType().should_be(typeof(EventType)); getData <StandardEventComponent>().GetEventData()[0].eventType.should_be(EventType.Added); getData <StandardEntityEventComponent>().GetEventData()[0].eventType.should_be(EventType.Removed); }; it["gets event priority"] = () => { getData <StandardEventComponent>().GetEventData()[0].priority.GetType().should_be(typeof(int)); getData <StandardEntityEventComponent>().GetEventData()[0].priority.should_be(1); }; it["creates data for event listeners"] = () => { var d = getMultipleData <StandardEventComponent>(); d.Length.should_be(2); d[1].IsEvent().should_be_false(); d[1].GetTypeName().should_be("AnyStandardEventListenerComponent"); d[1].GetMemberData().Length.should_be(1); d[1].GetMemberData()[0].name.should_be("value"); d[1].GetMemberData()[0].type.should_be("System.Collections.Generic.List<IAnyStandardEventListener>"); }; it["creates data for unique event listeners"] = () => { var d = getMultipleData <UniqueEventComponent>(); d.Length.should_be(2); d[1].IsEvent().should_be_false(); d[1].IsUnique().should_be_false(); }; it["creates data for event listeners with multiple contexts"] = () => { var d = getMultipleData <MultipleContextStandardEventComponent>(); d.Length.should_be(3); d[1].IsEvent().should_be_false(); d[1].GetTypeName().should_be("TestAnyMultipleContextStandardEventListenerComponent"); d[1].GetMemberData().Length.should_be(1); d[1].GetMemberData()[0].name.should_be("value"); d[1].GetMemberData()[0].type.should_be("System.Collections.Generic.List<ITestAnyMultipleContextStandardEventListener>"); d[2].IsEvent().should_be_false(); d[2].GetTypeName().should_be("Test2AnyMultipleContextStandardEventListenerComponent"); d[2].GetMemberData().Length.should_be(1); d[2].GetMemberData()[0].name.should_be("value"); d[2].GetMemberData()[0].type.should_be("System.Collections.Generic.List<ITest2AnyMultipleContextStandardEventListener>"); }; }; context["non component"] = () => { Type type = null; ComponentData data = null; before = () => { type = typeof(ClassToGenerate); data = getData <ClassToGenerate>(); }; it["get data"] = () => { data.should_not_be_null(); }; it["gets full type name"] = () => { // Not the type, but the component that should be generated // See: no namespace data.GetTypeName().should_be("ClassToGenerateComponent"); }; it["gets contexts"] = () => { var contextNames = data.GetContextNames(); contextNames.Length.should_be(2); contextNames[0].should_be("Test"); contextNames[1].should_be("Test2"); }; it["gets unique"] = () => { data.IsUnique().should_be_false(); }; it["gets member data"] = () => { data.GetMemberData().Length.should_be(1); data.GetMemberData()[0].type.should_be(type.ToCompilableString()); }; it["gets generate component"] = () => { data.ShouldGenerateComponent().GetType().should_be(typeof(bool)); data.ShouldGenerateComponent().should_be_true(); data.GetObjectTypeName().should_be(typeof(ClassToGenerate).ToCompilableString()); }; it["gets generate index"] = () => { data.ShouldGenerateIndex().should_be_true(); }; it["gets generate methods"] = () => { data.ShouldGenerateMethods().should_be_true(); }; it["gets flag prefix"] = () => { data.GetFlagPrefix().should_be("is"); }; it["gets is no event"] = () => { data.IsEvent().should_be_false(); }; it["gets event"] = () => { getData <EventToGenerate>().GetEventData().Length.should_be(1); var eventData = getData <EventToGenerate>().GetEventData()[0]; eventData.eventTarget.should_be(EventTarget.Any); eventData.eventType.should_be(EventType.Added); eventData.priority.should_be(0); }; it["creates data for event listeners"] = () => { var d = getMultipleData <EventToGenerate>(); d.Length.should_be(3); d[1].IsEvent().should_be_false(); d[1].ShouldGenerateComponent().should_be_false(); d[1].GetTypeName().should_be("TestAnyEventToGenerateListenerComponent"); d[1].GetMemberData().Length.should_be(1); d[1].GetMemberData()[0].name.should_be("value"); d[1].GetMemberData()[0].type.should_be("System.Collections.Generic.List<ITestAnyEventToGenerateListener>"); d[2].IsEvent().should_be_false(); d[2].ShouldGenerateComponent().should_be_false(); d[2].GetTypeName().should_be("Test2AnyEventToGenerateListenerComponent"); d[2].GetMemberData().Length.should_be(1); d[2].GetMemberData()[0].name.should_be("value"); d[2].GetMemberData()[0].type.should_be("System.Collections.Generic.List<ITest2AnyEventToGenerateListener>"); }; }; context["multiple types"] = () => { it["creates data for each type"] = () => { var types = new[] { typeof(NameAgeComponent), typeof(Test2ContextComponent) }; var provider = new ComponentDataProvider(types); provider.Configure(new TestPreferences( "Entitas.CodeGeneration.Plugins.Contexts = Game, GameState" )); var data = provider.GetData(); data.Length.should_be(types.Length); }; it["ignores duplicates from non components"] = () => { var types = new[] { typeof(ClassToGenerate), typeof(ClassToGenerateComponent) }; var provider = new ComponentDataProvider(types); provider.Configure(new TestPreferences( "Entitas.CodeGeneration.Plugins.Contexts = Game, GameState" )); var data = provider.GetData(); data.Length.should_be(1); }; }; context["multiple custom component names"] = () => { Type type = null; ComponentData data1 = null; ComponentData data2 = null; before = () => { type = typeof(CustomName); var data = getMultipleData <CustomName>(); data1 = data[0]; data2 = data[1]; }; it["creates data for each custom component name"] = () => { data1.GetObjectTypeName().should_be(type.ToCompilableString()); data2.GetObjectTypeName().should_be(type.ToCompilableString()); data1.GetTypeName().should_be("NewCustomNameComponent1Component"); data2.GetTypeName().should_be("NewCustomNameComponent2Component"); }; }; context["configure"] = () => { Type type = null; ComponentData data = null; before = () => { var preferences = new TestPreferences( "Entitas.CodeGeneration.Plugins.Contexts = ConfiguredContext" + "\n" ); type = typeof(NoContextComponent); data = getData <NoContextComponent>(preferences); }; it["gets default context"] = () => { var contextNames = data.GetContextNames(); contextNames.Length.should_be(1); contextNames[0].should_be("ConfiguredContext"); }; }; }
CodeGenFile[] generateMatcher(ComponentData data) { return(data.GetContextNames() .Select(context => generateMatcher(context, data)) .ToArray()); }
CodeGenFile[] generateExtensions(ComponentData data) { return(data.GetContextNames() .Select(contextName => generateExtension(contextName, data)) .ToArray()); }
public static CodeGenFile CorrespondingFile(this ComponentData component, CodeGenFile[] codeGenFiles) => codeGenFiles.FirstOrDefault(f => f.fileName.EndsWith($"{component.GetContextNames().First()}{component.ComponentName()}Component.cs"));
void when_providing() { context["component"] = () => { Type[] types = null; ComponentData[] data = null; ComponentData d = null; before = () => { types = new [] { typeof(MyNamespaceComponent) }; var provider = new ComponentDataProvider(types); data = (ComponentData[])provider.GetData(); d = data[0]; }; it["get data"] = () => { data.Length.should_be(1); }; it["gets component name"] = () => { d.GetComponentName().GetType().should_be(typeof(string)); d.GetComponentName().should_be("MyNamespace"); d.GetFullComponentName().GetType().should_be(typeof(string)); d.GetFullComponentName().should_be("MyNamespaceComponent"); }; it["gets full type name"] = () => { d.GetFullTypeName().GetType().should_be(typeof(string)); d.GetFullTypeName().should_be(types[0].ToCompilableString()); }; it["gets contexts"] = () => { d.GetContextNames().GetType().should_be(typeof(string[])); d.GetContextNames().Length.should_be(2); d.GetContextNames()[0].should_be("Test"); d.GetContextNames()[1].should_be("Test2"); }; it["sets first context as default when component has no context"] = () => { var contextNames = getData <NoContextComponent>().GetContextNames(); contextNames.Length.should_be(1); contextNames[0].should_be("Game"); }; it["gets unique"] = () => { d.IsUnique().GetType().should_be(typeof(bool)); d.IsUnique().should_be_false(); getData <UniqueStandardComponent>().IsUnique().should_be_true(); }; it["gets member data"] = () => { d.GetMemberData().GetType().should_be(typeof(MemberData[])); d.GetMemberData().Length.should_be(1); }; it["gets generate component"] = () => { d.ShouldGenerateComponent().GetType().should_be(typeof(bool)); d.ShouldGenerateComponent().should_be_false(); d.ContainsKey(ShouldGenerateComponentComponentDataExtension.COMPONENT_OBJECT_TYPE).should_be_false(); }; it["gets generate index"] = () => { d.ShouldGenerateIndex().GetType().should_be(typeof(bool)); d.ShouldGenerateIndex().should_be_true(); getData <DontGenerateIndexComponent>().ShouldGenerateIndex().should_be_false(); }; it["gets generate methods"] = () => { d.ShouldGenerateMethods().GetType().should_be(typeof(bool)); d.ShouldGenerateMethods().should_be_true(); getData <DontGenerateMethodsComponent>().ShouldGenerateMethods().should_be_false(); }; it["gets unique prefix"] = () => { d.GetUniqueComponentPrefix().GetType().should_be(typeof(string)); d.GetUniqueComponentPrefix().should_be("is"); getData <CustomPrefixFlagComponent>().GetUniqueComponentPrefix().should_be("My"); }; }; context["non component"] = () => { Type[] types = null; ComponentData[] data = null; ComponentData d = null; before = () => { types = new [] { typeof(ClassToGenerate) }; var provider = new ComponentDataProvider(types); data = (ComponentData[])provider.GetData(); d = data[0]; }; it["get data"] = () => { data.Length.should_be(1); }; it["gets component name"] = () => { d.GetComponentName().GetType().should_be(typeof(string)); // Not the type, but the component that should be generated // See: no namespace d.GetComponentName().should_be("ClassToGenerate"); d.GetFullComponentName().GetType().should_be(typeof(string)); // Not the type, but the component that should be generated // See: no namespace d.GetFullComponentName().should_be("ClassToGenerateComponent"); }; it["gets full type name"] = () => { d.GetFullTypeName().GetType().should_be(typeof(string)); // Not the type, but the component that should be generated // See: no namespace d.GetFullTypeName().should_be("ClassToGenerateComponent"); }; it["gets contexts"] = () => { d.GetContextNames().GetType().should_be(typeof(string[])); d.GetContextNames().Length.should_be(2); d.GetContextNames()[0].should_be("Test"); d.GetContextNames()[1].should_be("Test2"); }; it["gets unique"] = () => { d.IsUnique().GetType().should_be(typeof(bool)); d.IsUnique().should_be_false(); }; it["gets member data"] = () => { d.GetMemberData().Length.should_be(1); d.GetMemberData()[0].type.should_be(typeof(ClassToGenerate).ToCompilableString()); }; it["gets generate component"] = () => { d.ShouldGenerateComponent().GetType().should_be(typeof(bool)); d.ShouldGenerateComponent().should_be_true(); d.GetObjectType().should_be(typeof(ClassToGenerate).ToCompilableString()); }; it["gets generate index"] = () => { d.ShouldGenerateIndex().GetType().should_be(typeof(bool)); d.ShouldGenerateIndex().should_be_true(); }; it["gets generate methods"] = () => { d.ShouldGenerateMethods().GetType().should_be(typeof(bool)); d.ShouldGenerateMethods().should_be_true(); }; it["gets unique prefix"] = () => { d.GetUniqueComponentPrefix().GetType().should_be(typeof(string)); d.GetUniqueComponentPrefix().should_be("is"); }; }; context["multiple types"] = () => { it["creates data for each type"] = () => { var types = new [] { typeof(NameAgeComponent), typeof(Test2ContextComponent) }; var provider = new ComponentDataProvider(types); var data = provider.GetData(); data.Length.should_be(types.Length); }; }; context["multiple custom component names"] = () => { Type[] types = null; ComponentData[] data = null; ComponentData d1 = null; ComponentData d2 = null; before = () => { types = new [] { typeof(CustomName) }; var provider = new ComponentDataProvider(types); data = (ComponentData[])provider.GetData(); d1 = data[0]; d2 = data[1]; }; it["get data"] = () => { data.Length.should_be(2); }; it["creates data for each custom component name"] = () => { d1.GetComponentName().should_be("NewCustomNameComponent1"); d2.GetComponentName().should_be("NewCustomNameComponent2"); d1.GetObjectType().should_be(types[0].ToCompilableString()); d2.GetObjectType().should_be(types[0].ToCompilableString()); d1.GetFullTypeName().should_be("NewCustomNameComponent1Component"); d2.GetFullTypeName().should_be("NewCustomNameComponent2Component"); d1.GetComponentName().should_be("NewCustomNameComponent1"); d2.GetComponentName().should_be("NewCustomNameComponent2"); d1.GetFullComponentName().should_be("NewCustomNameComponent1Component"); d2.GetFullComponentName().should_be("NewCustomNameComponent2Component"); }; }; }
CodeGenFile[] generate(ComponentData data) { return(new[] { generateInterface(data) } .Concat(data.GetContextNames().Select(contextName => generateEntityInterface(contextName, data))) .ToArray()); }
private CodeGenFile[] Generate(ComponentData data) => new[] { GenerateInterface(data) } .Concat(data.GetContextNames().Select(contextName => GenerateEntityInterface(contextName, data))) .ToArray();