Пример #1
0
        public Function()
        {
            Services = ServiceExtensions.BuildServiceProvider();

            var needsInjection = GetType().GetProperties()
                                 .Where(p => p.GetCustomAttribute <InjectAttribute>() != null);

            foreach (var prop in needsInjection)
            {
                prop.SetValue(this, Services.GetRequiredService(prop.PropertyType));
            }
        }