Ejemplo n.º 1
0
        public TapestryGenerateService(DBEntities context, Application application, ModalProgressHandler <EModule> progressHandler, bool rebuild)
        {
            _rebuild           = rebuild;
            _context           = context;
            _application       = application;
            _tapestryNameSpace = "FSS.Omnius.Modules.Tapestry2.Block";
            _usings            = new string[] { "System", "System.Collections.Generic", "System.Linq", "System.Threading.Tasks", "System.Web", "FSS.Omnius.Modules.CORE", "FSS.Omnius.Modules.Tapestry2" };
            _resourceLinks     = new string[] { "FSS.Omnius.Modules.dll", "Newtonsoft.Json.dll", "System.ValueTuple.dll" }.Select(r => Path.Combine(Tapestry.PathRun, r))
            .Concat(new string[] { Assembly.Load("System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").Location,
                                   Assembly.Load("EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").Location,
                                   Assembly.Load("Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35").Location }).ToArray();
            _progressHandler = progressHandler;

            Directory.CreateDirectory(Tapestry.PathOutput);
            Directory.CreateDirectory(Tapestry.PathOutputTemp);
        }
Ejemplo n.º 2
0
        private void Build()
        {
            if (_core.Application.TapestryChangedSinceLastBuild)
            {
                SendObject(new { @action = "building" });

                var progressHandler = new ModalProgressHandler <EModule>((s) => { });
                progressHandler.Section(EModule.Tapestry, "Generating");

                var generator = new T2.Services.TapestryGenerateService(_core.Context, _core.Application, progressHandler, false);
                generator.Generate();

                _core.Application.TapestryChangedSinceLastBuild = false;
                _core.Context.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public Dictionary <TapestryDesignerBlock, Block> GenerateTapestry(COREobject core, ModalProgressHandler <EModule> progressHandler)
        {
            _core            = core;
            _progressHandler = progressHandler;
            _app             = core.Application;

            // block & metablock
            try
            {
                // generate new
                progressHandler.SetMessage("block", "Generating metablocks and blocks", MessageType.InProgress, _app.TapestryDesignerMetablocks.Count);
                saveMetablock(_app.TapestryDesignerRootMetablock, true);
                progressHandler.SetMessage("block", "Generating metablocks and blocks completed", MessageType.Success);
            }
            catch (Exception)
            {
                _context.DiscardChanges();

                throw;
            }

            // block content
            try
            {
                progressHandler.SetMessage("blockContent", "Generating block content", MessageType.InProgress, _app.TapestryDesignerMetablocks.Sum(mb => mb.Blocks.Count));
                saveBlocks();
                _context.SaveChanges();
                progressHandler.SetMessage("blockContent", "Generating block content completed", MessageType.Success);
            }
            catch (Exception)
            {
                _context.DiscardChanges();

                throw;
            }

            return(_blockMapping);
        }
 public DatabaseGenerateService(ModalProgressHandler <EModule> progressHandler)
 {
     _entitronFKs     = new List <DBForeignKey>();
     _progressHandler = progressHandler ?? new ModalProgressHandler <EModule>(s => { });
 }
Ejemplo n.º 5
0
 public ApplicationBuilder(Action <string> sendAction)
 {
     progressHandler = new ModalProgressHandler <EModule>(sendAction);
 }