コード例 #1
0
        public bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var    container    = (IEntityContainer)baseObject;
            var    servicesPath = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.WebAPIServicesRoot];
            var    graphQLPath  = FileSystemObject.PathCombine(servicesPath, "GraphQL");
            string name;
            string dataContext;
            string dataContextNamespace;

            if (container is RestEntityContainer)
            {
                var entityWithPathPrefix = baseObject.CastTo <IEntityWithPrefix>();

                name                 = (string)((RestEntityContainer)container).Variables["title"];
                dataContext          = "I" + name + "DataContext";
                dataContextNamespace = ((RestEntityContainer)container).Namespace + ".Models." + entityWithPathPrefix.PathPrefix;
            }
            else
            {
                name                 = baseObject.Name.RemoveEndIfMatches("Entities", "Context");
                dataContext          = "I" + baseObject.Name;
                dataContextNamespace = ((Entity_Container)container).Namespace;
            }

            WebAPIGraphQLSchemaGenerator.GenerateSchema(baseObject, graphQLPath, name, dataContext, dataContextNamespace, generatorConfiguration);

            return(true);
        }
コード例 #2
0
        public bool Terminate(IGeneratorConfiguration generatorConfiguration)
        {
            var servicesPath = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.WebAPIServicesRoot];
            var configPath   = FileSystemObject.PathCombine(servicesPath, "wwwroot");

            ConfigJsonGenerator.GenerateJson(configPath, generatorConfiguration);

            return(true);
        }
コード例 #3
0
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var uiAttribute     = (UIAttribute)facet.Attribute;
            var baseElement     = (IElement)baseObject;
            var userFields      = new List <IdentityField>();
            var parentObject    = (IElement)baseObject.Parent;
            var name            = baseElement.GetNavigationName(UIKind.LoginPage);
            var subFolderName   = name.ToLower();
            var pagePath        = FileSystemObject.PathCombine(generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages], subFolderName);
            var resourcesHelper = generatorConfiguration.ResourcesHandler.CreateHelper(UIKind.LoginPage, baseObject);
            IDictionary <string, IEnumerable <ModuleImportDeclaration> > importGroups;
            IModuleAssembly module;
            Folder          pageFolder = null;
            string          loginTitleTranslationKey;
            string          loginButtonTranslationKey;

            if (!generatorConfiguration.FileSystem.Exists(pagePath))
            {
                var newPath = generatorConfiguration.FileSystem.CreatePath(pagePath);

                pageFolder = (Folder)generatorConfiguration.FileSystem[newPath];
            }
            else
            {
                pageFolder = (Folder)generatorConfiguration.FileSystem[pagePath];
            }

            if (uiAttribute.UILoadKind == UILoadKind.RootPage)
            {
                this.Raise <ApplicationFacetHandler>();
            }

            importGroups = generatorConfiguration.CreateImportGroups(this, baseObject, pageFolder, true);
            importGroups.AddIndexImport("Page", "MainPage", 1);

            foreach (var childObject in baseElement.GetIdentityFields(IdentityFieldCategory.Login))
            {
                if (childObject is IAttribute)
                {
                    userFields.Add(new IdentityField((IAttribute)childObject, generatorConfiguration));
                }
                else
                {
                    DebugUtils.Break();
                }
            }

            module                    = generatorConfiguration.PushModuleAssembly <AngularModule>("Login");
            module.UILoadKind         = uiAttribute.UILoadKind;
            loginTitleTranslationKey  = resourcesHelper.Get(() => LOGIN_TITLE);
            loginButtonTranslationKey = resourcesHelper.Get(() => LOGIN_BUTTON);

            LoginPageGenerator.GeneratePage(baseObject, pagePath, name, generatorConfiguration, module, importGroups, userFields, loginTitleTranslationKey, loginButtonTranslationKey);

            return(true);
        }
コード例 #4
0
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var uiAttribute   = (UIAttribute)facet.Attribute;
            var baseElement   = (IElement)baseObject;
            var name          = baseElement.GetNavigationName();
            var formFields    = new List <FormField>();
            var parentObject  = (IElement)baseObject.Parent;
            var subFolderName = name.ToLower();
            var pagePath      = FileSystemObject.PathCombine(generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages], subFolderName);
            IDictionary <string, IEnumerable <ModuleImportDeclaration> > importGroups;
            IModuleAssembly module;
            Folder          pageFolder = null;

            if (!generatorConfiguration.FileSystem.Exists(pagePath))
            {
                var newPath = generatorConfiguration.FileSystem.CreatePath(pagePath);

                pageFolder = (Folder)generatorConfiguration.FileSystem[newPath];
            }
            else
            {
                pageFolder = (Folder)generatorConfiguration.FileSystem[pagePath];
            }

            if (uiAttribute.UILoadKind == UILoadKind.RootPage)
            {
                this.Raise <ApplicationFacetHandler>();
            }

            importGroups = generatorConfiguration.CreateImportGroups(this, baseObject, pageFolder, true);

            foreach (var childObject in baseElement.GetFormFields(generatorConfiguration.PartsAliasResolver))
            {
                if (childObject is IAttribute)
                {
                    formFields.Add(new FormField((IAttribute)childObject, generatorConfiguration));
                }
                else
                {
                    DebugUtils.Break();
                }
            }

            module            = generatorConfiguration.PushModuleAssembly <AngularModule>("Edit" + name);
            module.UILoadKind = uiAttribute.UILoadKind;

            EditPopupPageGenerator.GeneratePage(baseObject, pagePath, name, generatorConfiguration, module, importGroups, formFields);

            return(true);
        }
コード例 #5
0
        public bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var name         = baseObject.Name;
            var container    = (RestEntityContainer)baseObject;
            var variables    = container.Variables;
            var servicesPath = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.WebAPIServicesRoot];
            var configPath   = FileSystemObject.PathCombine(servicesPath, "wwwroot", (string)container.Variables["title"] + "Config");
            var parentPath   = (string)variables["parentPath"];
            var parentObject = baseObject.EntityDictionary.Single(p => p.Value.GetCondensedID() == parentPath).Value;
            var rootObject   = (object)container.JsonRootObject;

            rootObject.SetDynamicMember("idBase", parentObject.GetCondensedID().ToBase64());

            WebAPIRestConfigJsonGenerator.GenerateJson(baseObject, configPath, generatorConfiguration);

            return(true);
        }
コード例 #6
0
        public bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var           container = (IEntityContainer)baseObject;
            GraphQLSchema schema;
            string        name;

            if (baseObject.SkipProcess(this, facet, generatorConfiguration))
            {
                return(true);
            }

            if (graphQLPath == null)
            {
                var servicesPath = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.WebAPIServicesRoot];

                graphQLPath = FileSystemObject.PathCombine(servicesPath, "GraphQL");
            }

            if (container is RestEntityContainer)
            {
                name = (string)((RestEntityContainer)container).Variables["title"];
            }
            else
            {
                name = baseObject.Name.RemoveEndIfMatches("Entities", "Context");
            }

            schema = new GraphQLSchema(baseObject, name, generatorConfiguration);

            if (generatorConfiguration.CurrentPass == GeneratorPass.Files)
            {
                this.schemas.Add(schema);
            }

            return(true);
        }