public void Load(IModuleBuilder moduleBuilder) { moduleBuilder.ModelRegister.RegisterContext(c => new HelloWorldContext()); moduleBuilder.ModelRegister.Register <Category>() .WithViewModel <ViewModels.Category>() .AddValidationTask(Mvc.Validators.UniqueValidationTask <ViewModels.Category> .Check(e => e.Name)) .SetMapper <ViewModels.Mappers.CategoryMapper>(); moduleBuilder.ModelRegister.Register <News>() .AddValidationTask(Mvc.Validators.UniqueValidationTask <News> .Check(e => e.Title)); //moduleBuilder.ModelRegister.Register<News2>() // .AddValidationTask(Mvc.Validators.UniqueValidationTask<News2>.Check(e => e.Title)); var moduleName = typeof(ModuleConfig).Namespace; moduleBuilder.FunctionBuilder.DefineFunction("Category", moduleName) .AddStandarRoles <ViewModels.Category>(); // Setting rights of CRUD moduleBuilder.FunctionBuilder.DefineFunction("News", moduleName) .AddStandarRoles <News>() .AddQuerySettings <News>(new QueryGuardBuilder <News>() .AllowExpand(e => e.Category.Name) .Build() ); //moduleBuilder.FunctionBuilder.DefineFunction("News2", moduleName) // .AddStandarRoles<News2>() // .AddQuerySettings<News2>(new QueryGuardBuilder<News2>() // .Build() // ); }
protected override void OnModuleConfiguration(IModuleBuilder moduleBuilder) { moduleBuilder.Entity <User>() .TableName("Users", "geto") .HasKnownType(x => x.Person, typeof(Person)) .HasPrimaryKey(x => x.Id, false) .NotNullable(x => x.UserName) .HasDataEncode(x => x.UserName) .HasDataEncode(x => x.Password) .HasForeignKey <Role, Guid>(x => x.RoleId) .HasIndependentData(x => x.Role) .HasForeignKey <Person, Guid>(x => x.PersonId) .HasRule <UserRule>() .HasJsonIgnore(x => x.Password); moduleBuilder.EntityType(typeof(User)) .TableName("Users", "geto") .HasKnownType("Person", typeof(Person)) .HasPrimaryKey("Id", false) .NotNullable("UserName") .HasDataEncode("UserName") .HasDataEncode("Password") .HasForeignKey <Role>("RoleId") .HasIndependentData("Role") .HasForeignKey <Person>("PersonId") .HasRule <UserRule>() .HasJsonIgnore("Password"); }
private void CheckAdapterAndSaveToDiskBehavior(IModuleBuilder moduleBuilder, string assemblyDirectory, byte[] expectedPublicKey = null) { Assert.That(moduleBuilder, Is.TypeOf <ModuleBuilderAdapter>()); var moduleBuilderAdapter = (ModuleBuilderAdapter)moduleBuilder; Assert.That(moduleBuilderAdapter.ScopeName, Is.EqualTo(c_assemblyFileName)); Assert.That(moduleBuilderAdapter.AssemblyBuilder, Is.TypeOf <AssemblyBuilderAdapter>()); var assemblyBuilderAdapter = (AssemblyBuilderAdapter)moduleBuilder.AssemblyBuilder; Assert.That(assemblyBuilderAdapter.AssemblyName, Is.EqualTo(c_assemblyName)); Assert.That(assemblyBuilderAdapter.PublicKey, Is.EqualTo(expectedPublicKey ?? new byte[0])); var assemblyPath = Path.Combine(assemblyDirectory, c_assemblyFileName); var pdbPath = Path.Combine(assemblyDirectory, c_pdbFileName); Assert.That(File.Exists(assemblyPath), Is.False); Assert.That(File.Exists(pdbPath), Is.False); var result = assemblyBuilderAdapter.SaveToDisk(); Assert.That(File.Exists(assemblyPath), Is.True); Assert.That(File.Exists(pdbPath), Is.True); Assert.That(result, Is.EqualTo(assemblyPath)); FileUtility.DeleteAndWaitForCompletion(Path.Combine(assemblyDirectory, c_assemblyFileName)); FileUtility.DeleteAndWaitForCompletion(Path.Combine(assemblyDirectory, c_pdbFileName)); }
public EmployeeInfo GetNextApproval(int departmentID, int locationID, StepModuleList StepModule, int stepNumber) { IModuleBuilder moduleBuilder = null; EmployeeInfo nextAssignee = null; switch (StepModule) { case StepModuleList.VehicleManagement: moduleBuilder = new VehicleManagementDAL(SiteUrl); break; case StepModuleList.LeaveManagement: moduleBuilder = new LeaveManagementDAL(SiteUrl); break; default: return(null); } var approvalList = moduleBuilder.CreateApprovalList(departmentID, locationID); if (approvalList.Count > 0 && approvalList.Count() >= stepNumber) { nextAssignee = approvalList.ElementAt(stepNumber - 1); } return(nextAssignee); }
public override void Configure(IModuleBuilder builder) { builder.AddModule <ValidationModule>(); builder.AddModule <DataModule>(); builder.AddModule <AuthModule>(); builder.AddCollection <TodoCollection, Todo>(); }
public static ResultExecutor Create(IModuleBuilder moduleBuilder, ICommandBuilder commandBuilder) { var(body, instanceParameter, argsParameter) = ExecutorUtils.GetBasicExpressions(moduleBuilder, commandBuilder); var callback = ExecutorUtils.CreateCallbackForTaskResult(body, instanceParameter, argsParameter); return(new ResultExecutor(callback)); }
public static void AddCollection <TCollection, TDocument>(this IModuleBuilder builder, string collection) where TCollection : Collection <TDocument>, new() where TDocument : Document { builder.AddHandler <CreateDocumentHandler <TDocument>, CreateDocument <TDocument> >($"data.create.{collection}"); builder.AddHandler <UpdateDocumentHandler <TDocument>, UpdateDocument <TDocument> >($"data.update.{collection}"); builder.AddHandler <DeleteDocumentHandler <TDocument>, DeleteDocument <TDocument> >($"data.delete.{collection}"); builder.AddHandler <ReadDocumentHandler <TDocument>, ReadDocument <TDocument> >($"data.read.{collection}"); }
public override void Configure(IModuleBuilder moduleBuilder) { moduleBuilder.Dependencies.AddSingleton <PermissionService>(); moduleBuilder.Dependencies.AddSingleton(() => new Authorization()); moduleBuilder.AddHandler <TokenHandler, TokenMessage>(); moduleBuilder.AddHandler <PermissionHandler, object>("*"); moduleBuilder.AddHandler <LoginHandler, LoginMessage>(); }
/// <summary> /// Initialises a new instance of the <see cref="TypeFactory"/> class. /// </summary> /// <param name="assemblyName">The assembly name.</param> /// <param name="moduleName">The module name.</param> public TypeFactory(string assemblyName, string moduleName) { Utility.ThrowIfArgumentNullEmptyOrWhitespace(assemblyName, nameof(assemblyName)); Utility.ThrowIfArgumentNullEmptyOrWhitespace(moduleName, nameof(moduleName)); this.assemblyCache = new AssemblyBuilderCache(); this.assemblyBuilder = this.assemblyCache.GetOrCreateAssemblyBuilder(assemblyName); this.moduleBuilder = this.assemblyBuilder.NewDynamicModule(moduleName); }
public static void RegisterFlow(IModuleBuilder moduleBuilder) { var flow = moduleBuilder .WithFlow <A2A3A4Model, A2A3A4Context>("a2a3a4") .WithStep(m => m.Data) .GridConfig("1fr 1fr 1fr") .WithBorder(BorderEnum.ltrb) .Next("Save") // .WithTask<A2A3A4CalculationTask>(TaskTypeEnum.PeriTask) .AddDecorator("A2 - Liquid Limit") .PositionConfig("1/4", "1") .WithMetadata("textAlign", "center") .WithMetadata("textWeight", "bold") .End() .AddArray(m => m.LiquidLimitPoints, "Liquid limit points") .Vertical(3) .MaxRows(3) .GridConfig("1fr") .PositionConfig("1/4", "2") .AddControl(m => m.PanNumber, ControlType.Text, "Pan Number").End() .AddControl(m => m.Blows, ControlType.Number, "Blows").End() .AddControl(m => m.WetMass, ControlType.Number, "Wet Mass").WithSuffix(Appendixes.Grams).End() .AddControl(m => m.DryMass, ControlType.Number, "Dry Mass").WithSuffix(Appendixes.Grams).End() .AddControl(m => m.PanMass, ControlType.Number, "Pan Mass").WithSuffix(Appendixes.Grams).End() .AddControl(m => m.LiquidLimit, ControlType.Number, "Liquid Limit").WithSuffix(Appendixes.Percentage).InitiallyDisabled().End() .End() .AddControl(m => m.AverageLiquidLimit, ControlType.Number, "Average Liquid Limit") .InitiallyDisabled() .WithSuffix("%") .PositionConfig("1", "3") .End() .AddDecorator("A3 - Plastic Limit") .PositionConfig("1/4", "4") .WithMetadata("textAlign", "center") .WithMetadata("textWeight", "bold") .End() .AddArray(m => m.PlasticLimitPoints, "Plastic limit points") .Vertical(3) .MaxRows(3) .GridConfig("1fr") .PositionConfig("1/4", "5") .AddControl(m => m.PanNumber, ControlType.Text, "Pan Number").End() .AddControl(m => m.WetMass, ControlType.Number, "Wet Mass").WithSuffix(Appendixes.Grams).End() .AddControl(m => m.DryMass, ControlType.Number, "Dry Mass").WithSuffix(Appendixes.Grams).End() .AddControl(m => m.PanMass, ControlType.Number, "Pan Mass").WithSuffix(Appendixes.Grams).End() .AddControl(m => m.PlasticLimit, ControlType.Number, "Liquid Limit").WithSuffix(Appendixes.Percentage).InitiallyDisabled().End() .End() .AddControl(m => m.AveragePlasticLimit, ControlType.Number, "Average Liquid Limit") .InitiallyDisabled() .WithSuffix(Appendixes.Percentage) .PositionConfig("1", "6") .End() .End(); moduleBuilder.AddFlowToModule("", "lab-calculator", "tmh1", flow.Flow); }
public void SetUp() { _moduleBuilderFactoryMock = MockRepository.GenerateStrictMock <IModuleBuilderFactory>(); _configurationProviderMock = MockRepository.GenerateStrictMock <IConfigurationProvider>(); _flusher = new ReflectionEmitCodeGenerator(_moduleBuilderFactoryMock, _configurationProviderMock); _moduleBuilderMock = MockRepository.GenerateStrictMock <IModuleBuilder>(); _emittableOperandProviderMock = MockRepository.GenerateStrictMock <IEmittableOperandProvider>(); }
public static ObjectTaskExecutor Create(IModuleBuilder moduleBuilder, ICommandBuilder commandBuilder) { var(body, instanceParameter, argsParameter) = ExecutorUtils.GetBasicExpressions(moduleBuilder, commandBuilder); body = ExecutorUtils.ChangeForObjectTaskResultExpression(body, commandBuilder.AsyncResultType); var callback = ExecutorUtils.CreateCallback(body, instanceParameter, argsParameter); return(new ObjectTaskExecutor(callback)); }
public static VoidTaskExecutor Create(IModuleBuilder moduleBuilder, ICommandBuilder commandBuilder) { var(body, instanceParameter, argsParameter) = ExecutorUtils.GetBasicExpressions(moduleBuilder, commandBuilder); body = ExecutorUtils.AddContinueWithExpression(body); var callback = ExecutorUtils.CreateCallback(body, instanceParameter, argsParameter); return(new VoidTaskExecutor(callback)); }
public static ObjectExecutor Create(IModuleBuilder moduleBuilder, ICommandBuilder commandBuilder) { var(body, instanceParameter, argsParameter) = ExecutorUtils.GetBasicExpressions(moduleBuilder, commandBuilder); var objectResultCtor = ExecutorUtils.GetObjectResultCtor(); body = Expression.New(objectResultCtor, body); var callback = ExecutorUtils.CreateCallbackForTaskResult(body, instanceParameter, argsParameter); return(new ObjectExecutor(callback)); }
public static VoidExecutor Create(IModuleBuilder moduleBuilder, ICommandBuilder commandBuilder) { var(body, instanceParameter, argsParameter) = ExecutorUtils.GetBasicExpressions(moduleBuilder, commandBuilder); var resultExpression = Expression.Constant(Task.FromResult(new SuccessResult() as IResult)); body = Expression.Block(body, resultExpression); var callback = ExecutorUtils.CreateCallback(body, instanceParameter, argsParameter); return(new VoidExecutor(callback)); }
public static void RegisterFlow(IModuleBuilder moduleBuilder) { var flow = moduleBuilder .WithFlow <TestData, TestContext>("test-flow") .RequiresAuthorization() .WithStep(m => m.PersonalDetails) .WithTask <TestTask>(TaskTypeEnum.PostTask) .Next("Next") .GridConfig("1fr") .AddGroup(m => m.MainMember, "Main Member") .GridConfig("4fr 4fr 2fr") .AddControl(m => m.FirstName, ControlType.Text, "First Name").End() .AddControl(m => m.LastName, ControlType.Text, "Last Name").End() .AddControl(m => m.Gender, ControlType.Select, "Gender") .WithOptions(Constants.Lookups.Gender) .End() .AddControl(m => m.DateOfBirth, ControlType.DateTime).End() .End() .AddControl(m => m.HasSpouse, ControlType.Boolean, "Do you have a spouse?") .End() .AddGroup(m => m.Spouse, "Spouse") .GridConfig("4fr 4fr 2fr") .WithReactivity(m => m.HasSpouse == false, ReactivityType.ClearWhen) .WithReactivity(m => m.HasSpouse == true, ReactivityType.VisibleWhen) .AddControl(m => m.FirstName, ControlType.Text, "First Name").End() .AddControl(m => m.LastName, ControlType.Text, "Last Name").End() .AddControl(m => m.Gender, ControlType.Select, "Gender") .WithOptions(Constants.Lookups.Gender) .End() .AddControl(m => m.DateOfBirth, ControlType.DateTime).End() .End() .AddControl(m => m.HasChildren, ControlType.Boolean, "Do you have children?") .End() .AddArray(m => m.Children, "Children") .GridConfig("1fr 4fr") .WithReactivity(m => m.HasChildren == false, ReactivityType.ClearWhen) .WithReactivity(m => m.HasChildren == true, ReactivityType.VisibleWhen) .AddControl(m => m.isBiologicalChild, ControlType.Boolean, "Biological child?") .End() .AddGroup(m => m.Details) .PositionConfig("2/5") .GridConfig("4fr 4fr 2fr") .AddControl(m => m.FirstName, ControlType.Text, "First Name").End() .AddControl(m => m.LastName, ControlType.Text, "Last Name").End() .AddControl(m => m.Gender, ControlType.Select, "Gender") .WithOptions(Constants.Lookups.Gender) .End() .End() .End() .End(); moduleBuilder.AddFlowToModule("", "lab-calculator", "test", flow.Flow); }
/// <inheritdoc /> public IModuleBuilder BuildModule(IModuleBuilder parent, Type type) { type.NotNull(nameof(type)); if (parent.HasNoContent() && !IsModule(type)) { throw new ArgumentException(nameof(type), $"{type.FullName} is not a valid module."); } if (parent.HasContent() && !IsSubModule(type)) { throw new ArgumentException(nameof(type), $"{type.FullName} is not a valid submodule."); } var name = GetName(type); var description = GetDescription(type); var remarks = GetRemarks(type); var runMode = GetRunMode(type); var ignoreExtraArgs = GetIgnoreExtraArgs(type); var argumentParserType = GetArgumentParserType(type); var multiMatchHandling = GetMultiMatch(type); var alias = GetAlias(type); var enabled = GetEnabled(type); var attributes = GetAttributes(type); var preconditions = GetPreconditions(attributes); var invoker = GetInvoker(type); var builder = new ModuleBuilder() .WithType(type) .WithName(name) .WithDescription(description) .WithRemarks(remarks) .WithRunMode(runMode) .WithIgnoreExtraArgs(ignoreExtraArgs) .WithArgumentParserType(argumentParserType) .WithMultiMatch(multiMatchHandling) .WithAlias(alias) .WithEnabled(enabled) .WithAttributes(attributes) .WithPreconditions(preconditions) .WithParent(parent) .WithInvoker(invoker); var subModules = GetSubModules(builder, type); var commands = GetCommands(builder); builder.WithSubmodules(subModules); builder.WithCommands(commands); return(builder); }
/// <inheritdoc /> public ICommandBuilder BuildCommand(IModuleBuilder module, MethodInfo methodInfo) { module.NotNull(nameof(module)); methodInfo.NotNull(nameof(methodInfo)); if (!IsCommand(module, methodInfo)) { throw new ArgumentException(nameof(methodInfo), $"{methodInfo.Name} is not a valid command."); } var alias = GetAlias(methodInfo); var name = GetName(methodInfo, alias); var description = GetDescription(methodInfo); var remarks = GetRemarks(methodInfo); var priority = GetPriority(methodInfo); var runMode = GetRunMode(methodInfo); var ignoreExtraArgs = GetIgnoreExtraArgs(methodInfo); var argumentParserType = GetArgumentParserType(methodInfo); var attributes = GetAttributes(methodInfo); var preconditions = GetPreconditions(attributes); var enabled = GetEnabled(methodInfo); var isAsync = GetIsAsync(methodInfo); var asyncResultType = GetAsyncResultType(methodInfo, isAsync); var builder = new CommandBuilder() .WithMethodInfo(methodInfo) .WithName(name) .WithDescription(description) .WithRemarks(remarks) .WithPriority(priority) .WithRunMode(runMode) .WithIgnoreExtraArgs(ignoreExtraArgs) .WithArgumentParserType(argumentParserType) .WithAlias(alias) .WithEnabled(enabled) .WithAttributes(attributes) .WithPreconditions(preconditions) .WithModule(module) .WithIsAsync(isAsync) .WithAsyncResultType(asyncResultType); var executor = GetExecutor(module, builder); builder.WithExecutor(executor); var parameters = GetParameters(builder); builder.WithParameters(parameters); return(builder); }
protected override void OnModuleConfiguration(IModuleBuilder moduleBuilder) { moduleBuilder.Entity <User>() .TableName("Users") .HasPrimaryKey(x => x.Id, false) .NotNullable(x => x.UserName) .HasDataEncode(x => x.UserName) .HasDataEncode(x => x.Password) .HasForeignKey <Role, Guid>(x => x.RoleId) .HasIndependentData(x => x.Role) .HasForeignKey <Person, Guid>(x => x.PersonId) .HasRule <UserRule>() .HasJsonIgnore(x => x.Password); }
public ICommandExecutor GetCommandExecutor(IModuleBuilder moduleBuilder, ICommandBuilder commandBuilder) { var type = commandBuilder.MethodInfo.ReturnType; var asyncResultType = commandBuilder.AsyncResultType; if (commandBuilder.IsAsync) { if (type == typeof(Task) && commandBuilder.AsyncResultType.HasNoContent()) { return(VoidTaskExecutor.Create(moduleBuilder, commandBuilder)); } if (type == typeof(ValueTask) && commandBuilder.AsyncResultType.HasNoContent()) { return(VoidValueTaskExecutor.Create(moduleBuilder, commandBuilder)); } var genericDefinition = type.GetGenericTypeDefinition(); if (genericDefinition == typeof(Task <>) && typeof(IResult).IsAssignableFrom(asyncResultType)) { return(ResultTaskExecutor.Create(moduleBuilder, commandBuilder)); } if (genericDefinition == typeof(ValueTask <>) && typeof(IResult).IsAssignableFrom(asyncResultType)) { return(ResultValueTaskExecutor.Create(moduleBuilder, commandBuilder)); } if (genericDefinition == typeof(ValueTask <>)) { return(ObjectValueTaskExecutor.Create(moduleBuilder, commandBuilder)); } return(ObjectTaskExecutor.Create(moduleBuilder, commandBuilder)); } if (type == typeof(void)) { return(VoidExecutor.Create(moduleBuilder, commandBuilder)); } if (typeof(IResult).IsAssignableFrom(type)) { return(ResultExecutor.Create(moduleBuilder, commandBuilder)); } return(ObjectExecutor.Create(moduleBuilder, commandBuilder)); }
public static void AddCollection <TCollection, TDocument>(this IModuleBuilder builder) where TCollection : Collection <TDocument>, new() where TDocument : Document { var collectionAttribute = typeof(TCollection) .GetTypeInfo() .GetCustomAttribute <Collection>(); if (collectionAttribute == null) { throw new Exception("missing collection attribute"); } AddCollection <TCollection, TDocument>(builder, collectionAttribute.Name); }
public static void RegisterFlow(IModuleBuilder moduleBuilder) { var flow = moduleBuilder.WithFlow <MainReportModel, MainReportContext>("tmh1-main-report") .RequiresAuthorization() .WithReport(m => m.Data, "report") .AddPage(m => m.Page1, "Page 1") .End() .AddPage(m => m.Page2, "Page 2") .Orientation(PageOrientation.Landscape) .End() .AddPage(m => m.Page3, "Page 3") .End() .End(); moduleBuilder.AddFlowToModule("", "lab-calculator", "reports", flow.Flow); }
public static void RegisterFlow(IModuleBuilder moduleBuilder) { var flow = moduleBuilder .WithFlow <UserEditModel, UserEditContext>("user-edit") .WithStep(m => m.UserGrid, "select-user", "edit") .WithTask <UserEditGetGridTask>(TaskTypeEnum.PreTask) .Next("Next") .AddArray(m => m.Users, "System Users", "defaultGrid") .WithMetadata("editable", false) .WithMetadata("allColumnsSearchable", true) .WithMetadata("allColumnsOrderBy", true) .GridConfig("repeat(9, 1fr)") .HideAddAndDelete() .AddControl(m => m.Id, ControlType.Column, "Id").InitiallyDisabled().End() .AddControl(m => m.ProviderId, ControlType.Column, "Provider Id").InitiallyDisabled().End() .AddControl(m => m.ProviderType, ControlType.Column, "Provider Type").InitiallyDisabled().End() .AddControl(m => m.DisplayName, ControlType.Column, "Display Name").InitiallyDisabled().End() .AddControl(m => m.FirstName, ControlType.Column, "First Name").InitiallyDisabled().End() .AddControl(m => m.LastName, ControlType.Column, "Last Name").InitiallyDisabled().End() .AddControl(m => m.EmailAddress, ControlType.Column, "Email Address").InitiallyDisabled().End() .AddControl(m => m.AccountEnabled, ControlType.Column, "Enabled").InitiallyDisabled().End() .AddControl(m => m.Id, ControlType.Button, "Edit") .WithMetadata("icon", "edit") .WithUiTask(TaskTypeEnum.PeriTask, "user-edit") // BUTTON CLICK .End() .End() .End() .WithStep(m => m.UserEdit, "edit", "edit") .WithTask <UserEditRetrieveUserTask>(TaskTypeEnum.PreTask) .Back("Back") .GridConfig("1fr 1fr") .AddControl(m => m.Id, ControlType.Text, "Id").End() .AddControl(m => m.ProviderId, ControlType.Text, "Login Id").End() .AddControl(m => m.ProviderType, ControlType.Text, "Provider Type").End() .AddControl(m => m.DisplayName, ControlType.Text, "Display name").End() .AddControl(m => m.FirstName, ControlType.Text, "First name").End() .AddControl(m => m.LastName, ControlType.Text, "Last name").End() .AddControl(m => m.EmailAddress, ControlType.Text, "Email address").End() .AddControl(m => m.AccountEnabled, ControlType.Boolean, "Account enabled").End() .AddControl(m => m.Id, ControlType.Button, "save-changes") .WithMetadata("icon", "save") .WithTask <UserEditSaveChangesTask>(TaskTypeEnum.PeriTask, "user-edit") .End() .End(); moduleBuilder.AddFlowToModule("", "lab-calculator", "account", flow.Flow); }
private void CheckSaveToDiskBehavior(IModuleBuilder moduleBuilder, string assemblyDirectory) { var assemblyPath = Path.Combine(assemblyDirectory, c_assemblyFileName); var pdbPath = Path.Combine(assemblyDirectory, c_pdbFileName); Assert.That(File.Exists(assemblyPath), Is.False); Assert.That(File.Exists(pdbPath), Is.False); var result = moduleBuilder.AssemblyBuilder.SaveToDisk(); Assert.That(File.Exists(assemblyPath), Is.True); Assert.That(File.Exists(pdbPath), Is.True); Assert.That(result, Is.EqualTo(assemblyPath)); FileUtility.DeleteAndWaitForCompletion(Path.Combine(assemblyDirectory, c_assemblyFileName)); FileUtility.DeleteAndWaitForCompletion(Path.Combine(assemblyDirectory, c_pdbFileName)); }
private void CheckAdapterBehavior(IModuleBuilder moduleBuilder, byte[] expectedPublicKey = null) { Assert.That(moduleBuilder, Is.TypeOf <ModuleBuilderAdapter>()); var moduleBuilderAdapter = (ModuleBuilderAdapter)moduleBuilder; #if FEATURE_ASSEMBLYBUILDER_SAVE Assert.That(moduleBuilderAdapter.ScopeName, Is.EqualTo(c_assemblyFileName)); #else // .NET5 as a hardcoded module name since it does not support AssemblyBuilder.Save(). Assert.That(moduleBuilderAdapter.ScopeName, Is.EqualTo("RefEmit_InMemoryManifestModule")); #endif Assert.That(moduleBuilderAdapter.AssemblyBuilder, Is.TypeOf <AssemblyBuilderAdapter>()); var assemblyBuilderAdapter = (AssemblyBuilderAdapter)moduleBuilder.AssemblyBuilder; Assert.That(assemblyBuilderAdapter.AssemblyName, Is.EqualTo(c_assemblyName)); Assert.That(assemblyBuilderAdapter.PublicKey, Is.EqualTo(expectedPublicKey ?? new byte[0])); }
public static void RegisterFlow(IModuleBuilder moduleBuilder) { var flow = moduleBuilder .WithFlow <SimpleData, SimpleContext>("simple-flow") .WithStep(m => m.Step1) .Next("Next") .GridConfig("1fr") .AddControl(m => m.Shower, ControlType.Boolean, "Toggle to show other value") .End() .AddControl(m => m.DependsOnShower, ControlType.Text, "Toggled Value") .WithReactivity(m => m.Shower != true, ReactivityType.ClearWhen) .WithReactivity(m => m.Shower == true, ReactivityType.VisibleWhen) .End() .End(); moduleBuilder.AddFlowToModule("", "lab-calculator", "test", flow.Flow); }
private IEnumerable <ICommandBuilder> GetCommands(IModuleBuilder builder) { var commandTypes = builder.Type.GetMethods() .Where(a => _commandFactory.IsCommand(builder, a)) .ToList(); var commands = ImmutableArray.CreateBuilder <ICommandBuilder>(commandTypes.Count); foreach (var commandType in commandTypes) { var commandBuilder = _commandFactory.BuildCommand(builder, commandType); commands.Add(commandBuilder); } return(commands.MoveToImmutable()); }
private IEnumerable <IModuleBuilder> GetSubModules(IModuleBuilder parent, Type type) { var subModuleTypes = type.GetNestedTypes() .Where(a => IsSubModule(a)) .ToList(); var subModules = ImmutableArray.CreateBuilder <IModuleBuilder>(subModuleTypes.Count); foreach (var subModuleType in subModuleTypes) { var subModuleBuilder = BuildModule(parent, subModuleType); subModules.Add(subModuleBuilder); } return(subModules.MoveToImmutable()); }
public static void RegisterFlow(IModuleBuilder moduleBuilder) { var flow = moduleBuilder .WithFlow <UserRegistrationModel, UserRegistrationContext>("user-registration") .WithStep(m => m.UserRegistrationDetails, "details", "create") .Next("Register") .GridConfig("5fr 2fr 3fr") .AddControl(m => m.EmailAddress, ControlType.Text, "Email address") .PositionConfig("1 / 2", "1 / 1") .End() .AddControl(m => m.MobilePrefix, ControlType.Select, "Prefix") .PositionConfig("2 / 3", "1 / 1") .WithOptions(new List <SelectOption> { new SelectOption { Key = "27", Display = "+27" }, new SelectOption { Key = "264", Display = "+264" }, }) .End() .AddControl(m => m.MobileNumber, ControlType.Number, "Mobile number") .PositionConfig("3 / 4", "1 / 1") .End() .AddControl(m => m.FirstName, ControlType.Text, "First name") .PositionConfig("1 / 2", "2 / 2") .End() .AddControl(m => m.Surname, ControlType.Text, "Surname") .PositionConfig("2 / 4", "2 / 2") .End() .AddControl(m => m.Password, ControlType.HideableText, "Password") .PositionConfig("1 / 2", "3 / 3") .End() .AddControl(m => m.ConfirmPassword, ControlType.HideableText, "Confirm password") .PositionConfig("2 / 4", "3 / 3") .End() .WithTask <UserRegistrationTask>(TaskTypeEnum.PostTask) .End() .WithStep(m => m.RegistrationDone, "done", "done") .Next("Done") .End(); moduleBuilder.AddFlowToModule("", "lab-calculator", "account", flow.Flow); }
protected virtual void CreateModules(IKernelConfig config) { for (int i = 0; i < config.Modules.Count; i++) { IModuleBuildInfo info = config.Modules[i]; if (info.Active) { IModuleBuilder builder = info.Builder; Type registerType = builder.RegisterType; IApplicationModule module = builder.Build(this, info.Arguments); AddModule(registerType, module); Log.Debug($"Build Module: registerType:'{registerType}', module:'{module}'."); } } }
/// <summary> /// Configures the module. /// </summary> /// <param name="builder">The builder.</param> public void Configure(IModuleBuilder builder) { var seed = (int) DateTime.Now.Ticks; var random = new Random(seed); var randomRanking = random.Next(1, 100); builder.SetModuleTitle("Module #" + randomRanking) .SetModuleRanking(randomRanking) .AddNavigation<TestPage, TestPageViewModel>(Step1Id, rank: 10, parameters: ActionContextEntry.Create("this is a string", "test", false)) .AddNavigation<TestPage2, TestPage2ViewModel>(Step2Id, "Page #" + random.Next(1, 100)) .AddNavigation<TestPage2, TestPage2ViewModel>("Page #" + random.Next(1, 100)) .AddNavigation<TestPage2, TestPage2ViewModel>("Page #" + random.Next(1, 100)) .AddNavigation<TestPage2, TestPage2ViewModel>("Page #" + random.Next(1, 100)) .AddNavigation<TestPage2, TestPage2ViewModel>("Page #" + random.Next(1, 100)) /* .AddNavigation("Multistep", x => x.AddStep<TestPage, TestPageViewModel>(Step1Id) .AddStep<TestPage2, TestPage2ViewModel>()) */.AsStartup(); }