public override void Generate()
        {
            foreach (var table in GetList())
            {
                var template       = new AuditEntityGeneratedTemplate(_model, table);
                var fullParentName = RELATIVE_OUTPUT_LOCATION + template.ParentItemName;
                var eventArgs      = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, fullParentName, this, true);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedTables)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + string.Format("{0}Audit.Generated.cs", name);
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            //Process tables that are not longer audited
            foreach (var name in _model.Database.Tables.Where(x => !x.AllowAuditTracking))
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + string.Format("{0}Audit.Generated.cs", name);
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
Esempio n. 2
0
 protected virtual void OnProjectItemDeleted(object sender, ProjectItemDeletedEventArgs pigArgs)
 {
     if (ProjectItemDeleted != null)
     {
         this.ProjectItemDeleted(sender, pigArgs);
     }
 }
Esempio n. 3
0
        public override void Generate()
        {
            {
                var template     = new MSLTemplate(_model);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs    = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, true);
                eventArgs.Properties.Add("BuildAction", 3);
                OnProjectItemGenerated(this, eventArgs);
                var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
                OnGenerationComplete(this, gcEventArgs);
            }

            if (_model.Database.Tables.Any(x => x.IsTenant && x.Generated))
            {
                var template     = new MSLAdminTemplate(_model);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs    = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, true);
                eventArgs.Properties.Add("BuildAction", 3);
                OnProjectItemGenerated(this, eventArgs);
                var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
                OnGenerationComplete(this, gcEventArgs);
            }
            else
            {
                //If this is not a tenant model then remove the admin MSL file
                var template     = new MSLAdminTemplate(_model);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }
        }
Esempio n. 4
0
        private void projectItemGenerator_ProjectItemDeleted(object sender, ProjectItemDeletedEventArgs e)
        {
            try
            {
                var project = EnvDTEHelper.Instance.GetProject(e.ProjectName);
                var parent  = EnvDTEHelper.Instance.GetProjectItem(e.ProjectName, e.ParentItemName, e.ParentItemType);

                var fileStateInfo = new FileStateInfo();
                if (e.ParentItemName != string.Empty)
                {
                    EnvDTEHelper.Instance.DeleteProjectItem(parent, e.ProjectItemName, out fileStateInfo);
                }
                else
                {
                    EnvDTEHelper.DeleteProjectItem(project, e.ProjectItemName, out fileStateInfo);
                }
                Application.DoEvents();

                //Write Log
                nHydrateLog.LogInfo("Project Item Deleted: {0}", e.ProjectItemName);
                e.FileState = fileStateInfo.FileState;
                e.FullName  = fileStateInfo.FileName;
                //this.OnProjectItemGenerated(sender, e);
            }
            catch (Exception ex)
            {
                //this.OnProjectItemGeneratedError(this, e);
                nHydrateLog.LogWarning(ex);
            }
        }
Esempio n. 5
0
        public override void Generate()
        {
            var template = new CreateDataTemplate(_model);
            var fullFileName = template.FileName;
            var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
            eventArgs.Properties.Add("BuildAction", 3);
            OnProjectItemGenerated(this, eventArgs);
            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
            OnGenerationComplete(this, gcEventArgs);

            //Delete the old one
            var delEventArgs = new ProjectItemDeletedEventArgs($@"\{PARENT_ITEM_NAME}\{template.OldFileName}", ProjectName, this);
            delEventArgs.DeleteFile = true;
            OnProjectItemDeleted(this, delEventArgs);
        }
        public override void Generate()
        {
            var template     = new ContextAuditExtenderTemplate(_model);
            var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;

            if (this.FileCount == 0)
            {
                var eventArgs = new ProjectItemDeletedEventArgs(RELATIVE_OUTPUT_LOCATION + template.FileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }
            else
            {
                ProjectItemGeneratedEventArgs eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, false);
                OnProjectItemGenerated(this, eventArgs);
                var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
                OnGenerationComplete(this, gcEventArgs);
            }
        }
Esempio n. 7
0
        public override void Generate()
        {
            foreach (var table in GetList())
            {
                var template     = new EntityPrimaryKeyExtenderTemplate(_model, table);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs    = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, false);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedTables)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + string.Format("{0}PrimaryKey.cs", name);
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
Esempio n. 8
0
        public override void Generate()
        {
            foreach (var table in _model.Database.Tables.Where(x => x.Generated && (x.TypedTable != Models.TypedTableConstants.EnumOnly)).OrderBy(x => x.Name))
            {
                var    template     = new EntityExtenderTemplate(_model, table);
                string fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var    eventArgs    = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, false);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedTables)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + string.Format("{0}.cs", name);
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
Esempio n. 9
0
        public override void Generate()
        {
            foreach (var item in GetList())
            {
                var template       = new ActionTypesGeneratedTemplate(_model, item);
                var fullParentName = RELATIVE_OUTPUT_LOCATION + template.ParentItemName;
                var eventArgs      = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, fullParentName, this, true);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedStoredProcedures)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + string.Format("{0}.Generated.cs", name);
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
        public override void Generate()
        {
            foreach (var table in _model.Database.Tables.Where(x => (x.TypedTable != Models.TypedTableConstants.EnumOnly)).OrderBy(x => x.Name))
            {
                var template       = new EntityGeneratedTemplate(_model, table);
                var fullParentName = RELATIVE_OUTPUT_LOCATION + template.ParentItemName;
                var eventArgs      = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, fullParentName, this, true);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedTables)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + $"{name}.Generated.cs";
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
        public override void Generate()
        {
            foreach (var table in GetList())
            {
                var template       = new EntityGeneratedTemplate(_model, table);
                var fullParentName = RELATIVE_OUTPUT_LOCATION + template.ParentItemName;
                var eventArgs      = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, fullParentName, this, true);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedTables)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + name + ".Generated.cs";
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
Esempio n. 12
0
        public override void Generate()
        {
            foreach (var item in GetListSP())
            {
                var template     = new ComplexTypesSPExtenderTemplate(_model, item);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs    = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, false);
                OnProjectItemGenerated(this, eventArgs);
            }

            foreach (var item in GetListFunc())
            {
                var template     = new ComplexTypesFuncExtenderTemplate(_model, item);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs    = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, false);
                OnProjectItemGenerated(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedStoredProcedures)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + name + ".cs";
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            //Process deleted items
            foreach (var name in _model.RemovedFunctions)
            {
                var fullFileName = RELATIVE_OUTPUT_LOCATION + name + ".cs";
                var eventArgs    = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);

            OnGenerationComplete(this, gcEventArgs);
        }
 protected virtual void OnProjectItemDeleted(object sender, ProjectItemDeletedEventArgs pigArgs)
 {
     ProjectItemDeleted?.Invoke(sender, pigArgs);
 }
Esempio n. 14
0
 protected abstract void projectItemGenerator_ProjectItemDeleted(object sender, ProjectItemDeletedEventArgs e);
Esempio n. 15
0
        protected override void projectItemGenerator_ProjectItemDeleted(object sender, ProjectItemDeletedEventArgs e)
        {
            var name = e.ProjectItemName;

            if (name.StartsWith(Path.DirectorySeparatorChar))
            {
                name = name.Substring(1, name.Length - 1);
            }
            e.FullName = System.IO.Path.Combine(_outputFolder, e.ProjectName, name);
            if (File.Exists(e.FullName))
            {
                File.Delete(e.FullName);
            }
            e.FileState = Generator.Common.Util.FileStateConstants.Success;
        }