private void GenerateContent()
		{
			try
			{
				ISQLGenerate generator = null;

				sb.AppendLine("--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.");
				sb.AppendLine("--Data Schema For Version " + _model.Version);
				ValidationHelper.AppendCopyrightInSQL(sb, _model);

				generator = new SQLDeleteBusinessObjectTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLSelectBusinessObjectByPrimaryKeyTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLInsertBusinessObjectTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLPagedSelectBusinessObjectTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLSelectBusinessObjectByAndTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLSelectBusinessObjectByFieldTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLUpdateBusinessObjectTemplate(_model, _table);
				generator.GenerateContent(sb);

				if (_table.AllowCreateAudit)
				{
					generator = new SQLSelectBusinessObjectByCreatedDateTemplate(_model, _table);
					generator.GenerateContent(sb);
				}

				if (_table.AllowModifiedAudit)
				{
					generator = new SQLSelectBusinessObjectByModifiedDateTemplate(_model, _table);
					generator.GenerateContent(sb);
				}

				generator = new SQLSelectBusinessObjectByOrTemplate(_model, _table);
				generator.GenerateContent(sb);

				generator = new SQLSelectBusinessObjectTemplate(_model, _table);
				generator.GenerateContent(sb);


				//All parent relationships
				foreach (Relation relation in _table.ParentRoleRelations.Where(x => x.IsGenerated))
				{
					if (!relation.IsPrimaryKeyRelation())
					{
						generator = new SQLSelectBusinessObjectByRelationTemplate(_model, _table, relation);
						generator.GenerateContent(sb);
					}
				}

				foreach (Relation relation in _table.GetChildRoleRelationsFullHierarchy().Where(x => x.IsGenerated))
				{
					generator = new SQLSelectBusinessObjectByForeignKeyTemplate(_model, relation, _table);
					generator.GenerateContent(sb);
				}

				//All Components for this table
				foreach (TableComponent component in _table.ComponentList)
				{
					generator = new SQLPagedSelectComponentTemplate(_model, component);
					generator.GenerateContent(sb);

					generator = new SQLSelectComponentByPrimaryKeyTemplate(_model, component);
					generator.GenerateContent(sb);

					generator = new SQLSelectComponentByFieldTemplate(_model, component);
					generator.GenerateContent(sb);

					if (component.Parent.AllowCreateAudit)
					{
						generator = new SQLSelectComponentByCreatedDateTemplate(_model, component);
						generator.GenerateContent(sb);
					}

					if (component.Parent.AllowModifiedAudit)
					{
						generator = new SQLSelectComponentByModifiedDateTemplate(_model, component);
						generator.GenerateContent(sb);
					}

					generator = new SqlSelectComponentTemplate(_model, component);
					generator.GenerateContent(sb);

					generator = new SQLUpdateComponentTemplate(_model, component);
					generator.GenerateContent(sb);
				}


				foreach (CustomRetrieveRule rule in _model.Database.CustomRetrieveRules)
				{
					Table table = (Table)rule.ParentTableRef.Object;
					if (table == _table)
					{
						if (rule.Generated && table.Generated)
						{
							generator = new SQLSelectRetrieveRuleTemplate(_model, rule);
							generator.GenerateContent(sb);
						}
					}
				}

			}
			catch (Exception ex)
			{
				throw;
			}
		}
        private void GenerateContent()
        {
            try
            {
                ISQLGenerate generator = null;

                sb.AppendLine("--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.");
                sb.AppendLine("--Data Schema For Version " + _model.Version);
                ValidationHelper.AppendCopyrightInSQL(sb, _model);

                generator = new SQLDeleteBusinessObjectTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLSelectBusinessObjectByPrimaryKeyTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLInsertBusinessObjectTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLPagedSelectBusinessObjectTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLSelectBusinessObjectByAndTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLSelectBusinessObjectByFieldTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLUpdateBusinessObjectTemplate(_model, _table);
                generator.GenerateContent(sb);

                if (_table.AllowCreateAudit)
                {
                    generator = new SQLSelectBusinessObjectByCreatedDateTemplate(_model, _table);
                    generator.GenerateContent(sb);
                }

                if (_table.AllowModifiedAudit)
                {
                    generator = new SQLSelectBusinessObjectByModifiedDateTemplate(_model, _table);
                    generator.GenerateContent(sb);
                }

                generator = new SQLSelectBusinessObjectByOrTemplate(_model, _table);
                generator.GenerateContent(sb);

                generator = new SQLSelectBusinessObjectTemplate(_model, _table);
                generator.GenerateContent(sb);


                //All parent relationships
                foreach (Relation relation in _table.ParentRoleRelations.Where(x => x.IsGenerated))
                {
                    if (!relation.IsPrimaryKeyRelation())
                    {
                        generator = new SQLSelectBusinessObjectByRelationTemplate(_model, _table, relation);
                        generator.GenerateContent(sb);
                    }
                }

                foreach (Relation relation in _table.GetChildRoleRelationsFullHierarchy().Where(x => x.IsGenerated))
                {
                    generator = new SQLSelectBusinessObjectByForeignKeyTemplate(_model, relation, _table);
                    generator.GenerateContent(sb);
                }

                //All Components for this table
                foreach (TableComponent component in _table.ComponentList)
                {
                    generator = new SQLPagedSelectComponentTemplate(_model, component);
                    generator.GenerateContent(sb);

                    generator = new SQLSelectComponentByPrimaryKeyTemplate(_model, component);
                    generator.GenerateContent(sb);

                    generator = new SQLSelectComponentByFieldTemplate(_model, component);
                    generator.GenerateContent(sb);

                    if (component.Parent.AllowCreateAudit)
                    {
                        generator = new SQLSelectComponentByCreatedDateTemplate(_model, component);
                        generator.GenerateContent(sb);
                    }

                    if (component.Parent.AllowModifiedAudit)
                    {
                        generator = new SQLSelectComponentByModifiedDateTemplate(_model, component);
                        generator.GenerateContent(sb);
                    }

                    generator = new SqlSelectComponentTemplate(_model, component);
                    generator.GenerateContent(sb);

                    generator = new SQLUpdateComponentTemplate(_model, component);
                    generator.GenerateContent(sb);
                }


                foreach (CustomRetrieveRule rule in _model.Database.CustomRetrieveRules)
                {
                    Table table = (Table)rule.ParentTableRef.Object;
                    if (table == _table)
                    {
                        if (rule.Generated && table.Generated)
                        {
                            generator = new SQLSelectRetrieveRuleTemplate(_model, rule);
                            generator.GenerateContent(sb);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }