private void CreateRegistrationEmailTemplates(IObjectSpace objectSpace) { if (!objectSpace.Contains<EmailTemplate>()) { var emailTemplate = objectSpace.CreateObject<EmailTemplate>(); emailTemplate.Configure(EmailTemplateConfig.UserActivation, "http://localhost:50822/"); emailTemplate = objectSpace.CreateObject<EmailTemplate>(); emailTemplate.Configure(EmailTemplateConfig.PassForgotten); } }
public static bool Contains <T>(this IObjectSpace objectSpace) where T : class { return(objectSpace.Contains <T>(null)); }
private void CreateActionArtifacsts(IObjectSpace objectSpace, RuntimeSetupInfo setupInfo) { if (!objectSpace.Contains<ModuleArtifact>(artifact => artifact.Type == ModuleArtifactType.Action)) { var moduleTypes = GetModuleTypes(setupInfo); var controllers = moduleTypes.SelectMany(type => type.Assembly.GetTypes()) .Where(type => !type.IsAbstract && typeof(Controller).IsAssignableFrom(type)) .Select(type => type.CreateInstance()) .Cast<Controller>(); foreach (var controller in controllers) { var controllerArtifact = objectSpace.GetModuleArtifact(controller.GetType()); foreach (var action in controller.Actions) { var name = action.Id; var actionArtifact = objectSpace.GetObject<ModuleArtifact>(artifact => artifact.Name == name && artifact.Type == ModuleArtifactType.Action); actionArtifact.Name = name; actionArtifact.Type = ModuleArtifactType.Action; actionArtifact.Text = action.ToolTip; actionArtifact.ModuleChilds.AddRange(controllerArtifact.ModuleChilds); actionArtifact.Artifacts.Add(controllerArtifact); controllerArtifact.Artifacts.Add(actionArtifact); } } } }