Пример #1
0
        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));
        }
Пример #2
0
    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);
            }
        }
    }
Пример #3
0
        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));
        }
Пример #5
0
 public FactoryTemplate(FactoryDefinition factory)
 {
     Factory = factory;
 }
Пример #6
0
 public InjectionAggregator(FactoryDefinition factory, IResolverContext caller)
 {
     _factory = factory;
     _caller  = caller;
 }