Example #1
0
        protected static Page Build(Navigation builder)
        {
            var parameters = new List<Parameter>();
            builder.Parameters.ForEach(param => parameters.Add(param));

            var claims = new List<Claim>();
            builder.Claims.ForEach(claim => claims.Add(claim));

            int index = 0;
            var children = new List<Page>();
            builder.Children.ForEach(child =>
            {
                child.Index = index++;
                children.Add(child);
            });

            var built = new Page
            {
                Id = GetIdentity(builder, builder.Id),
                Title = builder.Title,
                Name = builder.Name,
                ParentOverride = builder.ParentOverride,
                Description = builder.Description,
                Application = GetApplication(builder),
                Index = builder.Index,
                Options = builder.Options,
                Classifier = builder.Classifier,
                Condition = builder.Condition,
                Icon = builder.Icon,
                Parent = builder.Parent == null ? string.Empty : GetIdentity(builder.Parent, builder.Parent.Id),
                Children = children,
                Parameters = parameters,
                Claims = claims,
            };

            builder.RunCustomBuildingLogic(built);

            return built;
        }
Example #2
0
 private static string GetApplication(Navigation builder)
 {
     return builder.Parent == null ? builder.Application : GetApplication(builder.Parent);
 }
Example #3
0
 private static string GetIdentity(Navigation builder, string name)
 {
     return builder.Parent == null ? name : GetIdentity(builder.Parent, builder.Parent.Id + name);
 }