feat: some application of source code generator

This commit is contained in:
redglow
2026-07-19 19:18:01 +02:00
parent aae9c083d9
commit 036e4af431
6 changed files with 14 additions and 34 deletions
-28
View File
@@ -25,7 +25,6 @@ public partial class ServiceSource : Node
var serviceScope = ScopeTypesAndNames.GetType(_serviceScope);
provider = provider.GetScopedProvider(serviceScope);
// invoke onScopeCreated, if present
// TODO: replace with a source code generation by turning this method private with Action<IProvider> argument, and every invocation site calls the necessary provider.Get<...> to build the argument list
if (onScopeCreated != null)
{
var parameters = onScopeCreated.Method
@@ -52,33 +51,6 @@ public partial class ServiceSource : Node
{
injectable.Inject(provider);
}
// var nodeType = node.GetType();
// foreach (var field in nodeType
// .GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
// {
// if (field.GetCustomAttribute<InjectAttribute>() == null) continue;
// var fieldType = field.FieldType;
// var service = provider.Get(fieldType);
// field.SetValue(node, service);
// }
//
// foreach (var method in nodeType.GetMethods(BindingFlags.Instance | BindingFlags.Public |
// BindingFlags.NonPublic))
// {
// if (method.GetCustomAttribute<InjectAttribute>() == null) continue;
// var parameters = method.GetParameters();
// var values = new object?[parameters.Length];
// var i = 0;
// foreach (var parameter in parameters)
// {
// var parameterType = parameter.ParameterType;
// var service = provider.Get(parameterType);
// values[i++] = service;
// }
//
// method.Invoke(node, values);
// }
}
}