Beispiel #1
0
        // TODO: unify DashboardComponent.GetServices and this
        public virtual void GetServices(DashboardManager manager)
        {
            var properties = GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)
                             .Where(x => x.IsDefined(typeof(RequireServiceAttribute), true))
                             .Select(prop => (prop, (RequireServiceAttribute)Attribute.GetCustomAttribute(prop, typeof(RequireServiceAttribute))));

            properties.ForEach(x => x.prop.SetValue(this, manager.GetService(x.prop.PropertyType, (string)GetType().GetProperty(x.Item2.ServiceIdProperty).GetValue(this))));
            OnInitialized();
        }