create moduletypes in code
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using zero.Core.Entities;
|
||||
|
||||
namespace zero.Core.Options
|
||||
{
|
||||
public class ModuleOptions : ZeroBackofficeCollection<ModuleType>, IZeroCollectionOptions
|
||||
{
|
||||
public ModuleOptions()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Add<T>(ModuleType<T> moduleType) where T : Module, new()
|
||||
{
|
||||
Items.Add(ModuleType.Convert(moduleType));
|
||||
}
|
||||
|
||||
|
||||
public void Add<T>(string alias, string name, string description, string icon, string group = null, List<string> disallowedPageTypes = null) where T : Module, new()
|
||||
{
|
||||
Items.Add(new ModuleType(typeof(T))
|
||||
{
|
||||
Alias = alias,
|
||||
Name = name,
|
||||
Description = description,
|
||||
Icon = icon,
|
||||
Group = group,
|
||||
DisallowedPageTypes = disallowedPageTypes ?? new List<string>()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void Add(Type type, string alias, string name, string description, string icon, string group = null, List<string> disallowedPageTypes = null)
|
||||
{
|
||||
Items.Add(new ModuleType(type)
|
||||
{
|
||||
Alias = alias,
|
||||
Name = name,
|
||||
Description = description,
|
||||
Icon = icon,
|
||||
Group = group,
|
||||
DisallowedPageTypes = disallowedPageTypes ?? new List<string>()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user