Exemple #1
0
        static string DocumentSqlServer()
        {
            var rr = new ReceiverRelationalSqlServer();

            rr.ConnectionString = "#file:SqlServerConnectionString#";
            string OutputFileName = "relationalSqlServer.html";
            var    sender         = new Sender_HTMLRazor("Views/sqlserver.cshtml", OutputFileName);

            sender.FileMode = FileMode.Create;
            var filter    = new FilterExcludeRelation(new string[] { "columns", "tables", "views" });
            var senderViz = new Sender_HTMLRelationViz("Name", OutputFileName);


            var si = new SimpleJobConditionalTransformers();

            si.Receivers.Add(0, rr);
            si.AddSender(sender);
            si.Add(filter);
            si.Add(filter, senderViz);
            return(si.SerializeMe());
        }
Exemple #2
0
        static string JobDllBlockly()
        {
            string   dir              = Environment.CurrentDirectory;
            IReceive folderWithDll    = new ReceiverFolderHierarchical("#static:Directory.GetCurrentDirectory()#", "*.dll");
            var      filterFiles      = new FilterForFilesHierarchical();
            var      recContentFile   = new ReceiverFromDllRelational();
            var      loadDllFromFiles = new TransformerApplyReceiver(recContentFile, "DllFileName", "FullName");
            //retain just types
            var filterTypes = new FilterRetainRelationalName(FilterType.Equal, "Types");
            //load types that are not generic or abstract
            //var justTypes = new FilterComparableEqual(typeof(string), "Types", "NameRelation");
            var notAbstract  = new FilterComparableEqual(typeof(bool), false, "IsAbstract");
            var notGeneric   = new FilterComparableEqual(typeof(bool), false, "IsGeneric");
            var notInterface = new FilterComparableEqual(typeof(bool), false, "IsInterface");
            //var noInterface = new FilterExcludeRelation("Interfaces");
            //var rel2plain = new TransformerRelationalToPlain();
            var haveProps = new FilterComparableGreat(typeof(int), 0, "PropertiesNr");
            //var justRelations = new FilterRetainItemsWithKey("NameRelation", FilterType.Equal);

            var    fileRazor  = Path.Combine(dir, "blockly.cshtml");
            string filename   = "#static:Directory.GetCurrentDirectory()#\\blockly.html";
            ISend  senderHTML = new SyncSenderMultiple(
                new Sender_Text(filename, "<html><body>")
            {
                FileMode = FileMode.Create
            },
                new Sender_HTMLRazor("Views/" + Path.GetFileName(fileRazor), filename),
                //new Sender_HTMLRelationViz("Name", filename),
                new Sender_Text(filename, "</body></html>")
                )
            ;
            var senderRow     = new SenderByRowToFile("Name", "txt", "Block Definition", "txt");
            var clear         = new TransformClearValues();
            var trReceiveHtml = new ReceiverHTMLTable(@"blockly.html", Encoding.UTF8);
            var decodeHtml    = new TransformerHtmlDecode();
            //var addJS = new TransformModifyField("Name", "{0}.js");
            var senderBlockTag          = new SenderByRowToFile("Name", "_def.txt", "Block definition", "txt");
            var senderBlockDefinitionJs = new SenderByRowToFile("Name", "_block.js", "Block JS", "js");
            var senderBlockCodeJs       = new SenderByRowToFile("Name", "_code.js", "Block CodeGenerator", "js");

            var job = new SimpleJobConditionalTransformers();

            job
            .AddReceiver(folderWithDll)
            .AddFilter(filterFiles)
            .AddTransformer(loadDllFromFiles)
            .AddFilter(filterTypes)
            .AddFilter(notAbstract)
            .AddFilter(notGeneric)
            .AddFilter(notInterface)
            .AddFilter(haveProps)
            //.AddTransformer(noInterface)
            //.AddTransformer(rel2plain)
            .AddSender(senderHTML)
            .AddTransformer(clear)
            .Add(clear, trReceiveHtml)
            .Add(trReceiveHtml, decodeHtml)
            .Add(decodeHtml, senderBlockTag)
            .Add(decodeHtml, senderBlockDefinitionJs)
            .Add(decodeHtml, senderBlockCodeJs)

            ;

            return(job.SerializeMe());
        }