本文整理汇总了C#中IObjectSpace.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectSpace.Contains方法的具体用法?C# IObjectSpace.Contains怎么用?C# IObjectSpace.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObjectSpace
的用法示例。
在下文中一共展示了IObjectSpace.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRegistrationEmailTemplates
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);
}
}
示例2: CreateActionArtifacsts
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);
}
}
}
}