public override void Generate()
		{
			foreach (var table in GetList())
			{
				var template = new AuditEntityExtenderTemplate(_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("I{0}Audit.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("I{0}Audit.cs", name);
				var eventArgs = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
				OnProjectItemDeleted(this, eventArgs);
			}

			var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
			OnGenerationComplete(this, gcEventArgs);
		}
Beispiel #2
0
        public override void Generate()
        {
            {
                var template = new SSDLTemplate(_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);
            }

            if (_model.Database.Tables.Any(x => x.IsTenant && x.Generated))
            {
                var template = new SSDLAdminTemplate(_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);
            }
            else
            {
                //If this is not a tenant model then remove the admin SSDL file
                var template = new SSDLAdminTemplate(_model);
                var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
                var eventArgs = new ProjectItemDeletedEventArgs(fullFileName, ProjectName, this);
                OnProjectItemDeleted(this, eventArgs);
            }

            var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
            OnGenerationComplete(this, gcEventArgs);
        }
Beispiel #3
0
 protected virtual void OnGenerationComplete(object sender, ProjectItemGenerationCompleteEventArgs args)
 {
     if (GenerationComplete != null)
     {
         this.GenerationComplete(sender, args);
     }
 }
 public override void Generate()
 {
     var template = new HelperExtenderTemplate(_model);
     var fullFileName = RELATIVE_OUTPUT_LOCATION + template.FileName;
     var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this, false);
     OnProjectItemGenerated(this, eventArgs);
     var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
     OnGenerationComplete(this, gcEventArgs);
 }
		public override void Generate()
		{
			var template = new ContextExtensionsGeneratedTemplate(_model);
			var fullParentName = RELATIVE_OUTPUT_LOCATION + template.ParentItemName;
			var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, fullParentName, this, true);
			OnProjectItemGenerated(this, eventArgs);
			var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
			OnGenerationComplete(this, gcEventArgs);
		}
 public override void Generate()
 {
     var template = new UpgradeVersionedTemplate(_model);
     var fullFileName = template.FileName;
     var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, false);
     eventArgs.Properties.Add("BuildAction", 3);
     OnProjectItemGenerated(this, eventArgs);
     var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
     OnGenerationComplete(this, gcEventArgs);
 }
Beispiel #7
0
        public override void Generate()
        {
            //Sql Server
            var template = new CSDLTemplate(_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);
        }
 public override void Generate()
 {
     foreach (var customView in _model.Database.CustomViews.Where(x => x.Generated).OrderBy(x => x.Name))
     {
         var template = new ViewEntityGeneratedTemplate(_model, customView);
         var fullParentName = RELATIVE_OUTPUT_LOCATION + template.ParentItemName;
         var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, fullParentName, this, true);
         OnProjectItemGenerated(this, eventArgs);
     }
     var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
     OnGenerationComplete(this, gcEventArgs);
 }
 public override void Generate()
 {
     foreach (var table in _model.Database.Tables.Where(x => x.Generated && !x.AssociativeTable && (x.TypedTable != TypedTableConstants.EnumOnly) && x.AllowAuditTracking).OrderBy(x => x.Name))
     {
         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);
     }
     var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
     OnGenerationComplete(this, gcEventArgs);
 }
Beispiel #10
0
		public override void Generate()
		{
			try
			{
				var template = new FunctionsTemplate(_model);
				var fullFileName = template.FileName;
				var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this.ParentItemPath, ProjectItemType.Folder, this, true);
				eventArgs.Properties.Add("BuildAction", 3);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			catch (Exception ex)
			{
				throw;
			}
		}
Beispiel #11
0
		public override void Generate()
		{
			var metaKey1 = _model.MetaData.FirstOrDefault(x => x.Key.ToLower() == "xsdprojectname");
			var metaKey2 = _model.MetaData.FirstOrDefault(x => x.Key.ToLower() == "xsdfilename");
			var metaKey3 = _model.MetaData.FirstOrDefault(x => x.Key.ToLower() == "xsdschemaname");
			var metaKey4 = _model.MetaData.FirstOrDefault(x => x.Key.ToLower() == "xsddroprelations");

			if (metaKey2 == null || metaKey3 == null)
			{
				OnProjectItemGeneratedError(this,
					new ProjectItemGeneratedErrorEventArgs()
					{
						Text = "The XSD generation template requires the model metadata 'XSDFileName' and 'XSDSchemaName' be set. Also an optional 'XSDProjectName' meta tag may be set.",
						ShowError = true
					}
					);
				return;
			}

			var fileName = metaKey2.Value;
			var schemaName = metaKey3.Value;
			var projectName = string.Empty;
			if (metaKey1 != null) projectName = metaKey1.Value;

			var droprelations = false;
			if (metaKey4 != null)
			{
				bool.TryParse(metaKey4.Value, out droprelations);
			}

			//Prepend Module name if necessary
			if (!string.IsNullOrEmpty(_model.ModuleName))
			{
				fileName = _model.ModuleName + "." + fileName;
			}

			var noPathFileName = fileName.Split('\\').Last();

			var template = new XSDSchemaTemplate(_model, schemaName, noPathFileName, droprelations);
			var eventArgs = new ProjectItemGeneratedEventArgs(fileName, template.FileContent, projectName, this, true) { RunCustomTool = true, CustomToolName = "MSDataSetGenerator" };
			OnProjectItemGenerated(this, eventArgs);
			var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
			OnGenerationComplete(this, gcEventArgs);
		}
		public override void Generate()
		{
			foreach (var table in GetList())
			{
				var template = new ViewEntityExtenderTemplate(_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.RemovedViews)
			{
				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);
		}
		public override void Generate()
		{
			foreach (var table in GetList())
			{
				var template = new EntityPrimaryKeyTemplate(_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 + "PrimaryKey.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 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.Generated && !x.AssociativeTable && (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 + 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()
        {
            //if (_model.Database.AllowZeroTouch) return;
            try
            {
                if (this.UseSingleFile)
                {
                    //Process all views
                    var sb = new StringBuilder();
                    sb.AppendLine("--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.");
                    sb.AppendLine();

                    if (_model.EmitSafetyScripts)
                    {
                        sb.AppendLine("--##SECTION BEGIN [INTERNAL STORED PROCS]");
                        sb.AppendLine();

                        foreach (var table in _model.Database.Tables.Where(x => x.Generated && (x.TypedTable != TypedTableConstants.EnumOnly)).OrderBy(x => x.Name))
                        {
                            var template = new SQLStoredProcedureTableAllTemplate(_model, table, true);
                            sb.Append(template.FileContent);
                        }

                        sb.AppendLine("--##SECTION END [INTERNAL STORED PROCS]");
                        sb.AppendLine();
                    }

                    var eventArgs = new ProjectItemGeneratedEventArgs("StoredProcedures.sql", sb.ToString(), ProjectName, this.ParentItemPath, ProjectItemType.Folder, this, true);
                    eventArgs.Properties.Add("BuildAction", 3);
                    OnProjectItemGenerated(this, eventArgs);
                }
                else
                {
                    if (_model.EmitSafetyScripts)
                    {
                        //Process all tables
                        foreach (var table in _model.Database.Tables.Where(x => x.Generated && (x.TypedTable != TypedTableConstants.EnumOnly)).OrderBy(x => x.Name))
                        {
                            var template = new SQLStoredProcedureTableAllTemplate(_model, table, false);
                            var fullFileName = template.FileName;
                            var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, this.ParentItemPath, ProjectItemType.Folder, this, true);
                            eventArgs.Properties.Add("BuildAction", 3);
                            OnProjectItemGenerated(this, eventArgs);
                        }
                    }
                }

                var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
                OnGenerationComplete(this, gcEventArgs);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #17
0
		public override void Generate()
		{
			//var template = new DatasiteOverviewTemplate(_model);
			//var fullFileName = template.FileName;
			//var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
			//OnProjectItemGenerated(this, eventArgs);
			//var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
			//OnGenerationComplete(this, gcEventArgs);

			#region Images
			{ //FK
				var eventArgs = new ProjectItemGeneratedEventArgs("fk.gif", string.Empty, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true)
				{
					ProjectItemBinaryContent = Helpers.GetFileBinContent(new EmbeddedResourceName(GetEmbeddedPath() + ".fk.gif")),
					ContentType = ProjectItemContentType.Binary,
				};
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			{ //PK
				var eventArgs = new ProjectItemGeneratedEventArgs("key.gif", string.Empty, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true)
				{
					ProjectItemBinaryContent = Helpers.GetFileBinContent(new EmbeddedResourceName(GetEmbeddedPath() + ".key.gif")),
					ContentType = ProjectItemContentType.Binary,
				};
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			{ //YES
				var eventArgs = new ProjectItemGeneratedEventArgs("yes.gif", string.Empty, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true)
				{
					ProjectItemBinaryContent = Helpers.GetFileBinContent(new EmbeddedResourceName(GetEmbeddedPath() + ".yes.gif")),
					ContentType = ProjectItemContentType.Binary,
				};
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			{ //NO
				var eventArgs = new ProjectItemGeneratedEventArgs("no.gif", string.Empty, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true)
				{
					ProjectItemBinaryContent = Helpers.GetFileBinContent(new EmbeddedResourceName(GetEmbeddedPath() + ".no.gif")),
					ContentType = ProjectItemContentType.Binary,
				};
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			{ //CONSTRAINT
				var eventArgs = new ProjectItemGeneratedEventArgs("constraint.gif", string.Empty, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true)
				{
					ProjectItemBinaryContent = Helpers.GetFileBinContent(new EmbeddedResourceName(GetEmbeddedPath() + ".constraint.gif")),
					ContentType = ProjectItemContentType.Binary,
				};
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			{ //INDEX
				var eventArgs = new ProjectItemGeneratedEventArgs("index.gif", string.Empty, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true)
				{
					ProjectItemBinaryContent = Helpers.GetFileBinContent(new EmbeddedResourceName(GetEmbeddedPath() + ".index.gif")),
					ContentType = ProjectItemContentType.Binary,
				};
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}
			#endregion

			//Style sheet
			{
				var template = new StyleSheetTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Site overview
			{
				var template = new DatasiteOverviewTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Table overview
			{
				var template = new DatasiteTableListTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Tables
			foreach (var item in _model.Database.Tables.Where(x => x.Generated).OrderBy(x => x.Name))
			{
				var template = new DatasiteTableItemTemplate(_model, item, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Views overview
			{
				var template = new DatasiteViewListTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Views
			foreach (var item in _model.Database.CustomViews.Where(x => x.Generated).OrderBy(x => x.Name))
			{
				var template = new DatasiteViewItemTemplate(_model, item, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Stored Procs overview
			{
				var template = new DatasiteStoredProcListTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Stored Procs
			foreach (var item in _model.Database.CustomStoredProcedures.Where(x => x.Generated).OrderBy(x => x.Name))
			{
				var template = new DatasiteStoredProcItemTemplate(_model, item, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Functions overview
			{
				var template = new DatasiteFunctionListTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Functions
			foreach (var item in _model.Database.Functions.Where(x => x.Generated).OrderBy(x => x.Name))
			{
				var template = new DatasiteFunctionItemTemplate(_model, item, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template.FileName, template.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

			//Scripts
			{
				var template1 = new DatasiteJQueryTemplate(_model, GetEmbeddedPath());
				var eventArgs = new ProjectItemGeneratedEventArgs(template1.FileName, template1.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);

				var template2 = new DatasiteJQueryCornersTemplate(_model, GetEmbeddedPath());
				eventArgs = new ProjectItemGeneratedEventArgs(template2.FileName, template2.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);

				var template3 = new DatasiteMasterScriptTemplate(_model, GetEmbeddedPath());
				eventArgs = new ProjectItemGeneratedEventArgs(template3.FileName, template3.FileContent, ProjectName, PARENT_ITEM_NAME, ProjectItemType.Folder, this, true);
				OnProjectItemGenerated(this, eventArgs);
				gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);
			}

		}
		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);
		}
 private void projectItemGenerator_GenerationComplete(object sender, ProjectItemGenerationCompleteEventArgs e)
 {
     nHydrateLog.LogInfo("Project Item Generation Complete: {0}", e.ProjectItemGenerator);
     try
     {
         GenerateSubItems(e.ProjectItemGenerator);
         this.OnGenerationComplete(sender, e);
     }
     catch (Exception ex)
     {
         nHydrateLog.LogWarning(ex);
     }
 }
		public override void Generate()
		{
			try
			{
				GenerateDatabaseInstallerCs();
				GenerateAzureCopy();
				GenerateInstallSettings();
				GenerateDatabaseInstallerDesignerCs();
				GenerateIdentifyDatabaseFormCs();
				GenerateIdentifyDatabaseFormDesigner();
				GenerateIdentifyDatabaseFormResx();
				GenerateInstallSettingsUICs();
				GenerateInstallSettingsUIResx();
				GenerateInstallSettingsUIDesigner();
				GenerateHistoryFormCs();
				GenerateHistoryFormResx();
				GenerateSqlServersCs();
				//GenerateArchiveReaderCs();
				GenerateXmlHelperCs();
				GenerateUpgradeInstaller();
				GenerateAzureCopyControlCs();
				GenerateAzureCopyControlDesigner();
				GenerateAzureCopyControlResx();
				
				GenerateSqlErrorCs();
				GenerateSqlErrorDesigner();
				GenerateSqlErrorResx();

				//Folder structure
				GenerateFolder1();
				GenerateFolder2();
				GenerateFolder3();
				GenerateFolder4();
				GenerateFolder5();
				GenerateFolder6();

				var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
				OnGenerationComplete(this, gcEventArgs);

				//_model.IncrementGeneratedVersion();
			}
			catch (Exception ex)
			{
				throw;
			}
		}
Beispiel #21
0
		private void GenerationCompleteHandler(object sender, ProjectItemGenerationCompleteEventArgs e)
		{
			//lvwOutput.Items.Add("Generation Complete");
			//lvwOutput.EnsureVisible(lvwOutput.Items.Count - 1);
			//Application.DoEvents();
		}
        public override void Generate()
        {
            try
            {
                if (this.UseSingleFile)
                {
                    //Process all views
                    var sb = new StringBuilder();
                    sb.AppendLine("--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.");
                    sb.AppendLine();

                    var grantSB = new StringBuilder();
                    foreach (var view in _model.Database.CustomViews.Where(x => x.Generated).OrderBy(x => x.Name))
                    {
                        var template = new SQLStoredProcedureViewAllTemplate(_model, view, true, grantSB);
                        sb.Append(template.FileContent);
                    }

                    //Tenant Views
                    foreach (var table in _model.Database.Tables.Where(x => x.Generated && x.IsTenant).OrderBy(x => x.Name))
                    {
                        var template = new SQLSelectTenantViewTemplate(_model, table, grantSB);
                        sb.Append(template.FileContent);
                    }

                    //Add grants
                    sb.Append(grantSB.ToString());

                    var eventArgs = new ProjectItemGeneratedEventArgs("Views.sql", sb.ToString(), ProjectName, this.ParentItemPath, ProjectItemType.Folder, this, true);
                    eventArgs.Properties.Add("BuildAction", 3);
                    OnProjectItemGenerated(this, eventArgs);
                }
                else
                {
                    //Process all views
                    foreach (var view in _model.Database.CustomViews.Where(x => x.Generated).OrderBy(x => x.Name))
                    {
                        var grantSB = new StringBuilder();
                        var template = new SQLStoredProcedureViewAllTemplate(_model, view, false, grantSB);
                        var fullFileName = template.FileName;

                        //Add grants
                        var sb = new StringBuilder();
                        sb.Append(template.FileContent);
                        sb.Append(grantSB.ToString());

                        var eventArgs = new ProjectItemGeneratedEventArgs(fullFileName, sb.ToString(), ProjectName, this.ParentItemPath, ProjectItemType.Folder, this, true);
                        eventArgs.Properties.Add("BuildAction", 3);
                        OnProjectItemGenerated(this, eventArgs);
                    }
                }

                var gcEventArgs = new ProjectItemGenerationCompleteEventArgs(this);
                OnGenerationComplete(this, gcEventArgs);
            }
            catch (Exception ex)
            {
                throw;
            }
        }