Example #1
0
        public ModuleBase()
        {
            var t = this.GetType();

            this.Id           = t.GUID;// Guid.NewGuid();
            this.Metadata     = ModuleMetadataAttribute.GetMetadata(t);
            this._configProxy = new ConfigProxy(this);
            this._configProxy.PropertyChanged += (sender, e) => (sender as ConfigProxy).Save();
        }
        internal static IModuleMetadata GetMetadata(Type type)
        {
            var meta = type.GetCustomAttribute <ModuleMetadataAttribute>();

            if (meta is null)
            {
                meta = new ModuleMetadataAttribute(type.Name);
            }
            else if (string.IsNullOrWhiteSpace(meta.Name))
            {
                meta.Name = type.Name;
            }
            return(meta);
        }