public static string?GetPriorInjectionExpression(this IResolverContext caller, TypeName typeName, FactoryDefinition factory, params InjectionMethod[] methodsToExclude) { var aggregator = new InjectionAggregator(factory, caller); return(aggregator.GetPriorInjectionExpression(typeName, methodsToExclude)); }
private void OnEnable() { if (instance == null) { instance = this; prefabs = new Dictionary <Type, FactoryObject>(); foreach (var item in factoryDefinitions) { prefabs.Add(FactoryDefinition.GetPrefabType(item.FactoryType), item.FactoryObject); } } }
public Solution GetFactoryAppliedSolution(Document document, FactoryDefinition definition) { var template = new FactoryTemplate(definition); var code = template.TransformText(); Logger.WriteLine(code).Wait(); var fileName = $"{definition.TypeName}.g.cs"; var existing = document.Project.Documents .Where(d => d.Folders.IsStructualEqual(document.Folders)) .FirstOrDefault(d => d.Name == fileName); if (existing is { })
public IDictionary <string, object> GenerateValues(Action <FactoryDefinition> customDefinitions) { IDictionary <string, object> generatedValuesDict = new Dictionary <string, object>(); FactoryDefinition definitions = new FactoryDefinition(generatedValuesDict); // Apply custom definition customDefinitions(definitions); // Generate the values GenerateValuesForColumns(generatedValuesDict); // Insert values into database return(InsertInDatabase(generatedValuesDict)); }
public FactoryTemplate(FactoryDefinition factory) { Factory = factory; }
public InjectionAggregator(FactoryDefinition factory, IResolverContext caller) { _factory = factory; _caller = caller; }