Пример #1
0
        internal void GenerateSql(CSourceWriter sw)
        {
            sw.WriteLn("create table dbo." + this.Name + "(");
            bool primero = true;

            sw.AddTab();
            foreach (CFieldM f in this.lFieldAll)
            {
                f.GeneraSql(sw, ref primero);
            }
            if (this.lFieldPk.Count > 0)
            {
                sw.WriteLn(",CONSTRAINT PK_" + this.Name + " PRIMARY KEY (");
                primero = true;
                sw.AddTab();
                foreach (CFieldM f in this.lFieldPk)
                {
                    sw.Write("");
                    sw.WriteComma(ref primero);
                    sw.WriteLn(f.Name);
                }
                sw.DelTab();
                sw.WriteLn(")");
            }
            foreach (CUniqueConstraintM u in this.LUniqueConstraint)
            {
                u.GeneraSql(sw);
            }
            sw.DelTab();
            sw.WriteLn(")");

            sw.EndLine();
            sw.WriteLn("GO");
            //Genera las unique constraints
        }
Пример #2
0
 internal void GeneraSql(CSourceWriter sw)
 {
     sw.WriteLn(string.Format("alter table dbo.{0} add constraint {1} foreign key(", this.tableSource.Name, this.Name));
     sw.AddTab();
     sw.WriteCommaStringList(this.lFieldSource);
     sw.DelTab();
     sw.WriteLn(") references dbo." + this.tableDestination + " (");
     sw.AddTab();
     sw.WriteCommaStringList(this.lFieldDestination);
     sw.DelTab();
     sw.WriteLn(")");
     sw.WriteLn("GO");
 }
        public override void Generate(CSourceWriter sw)
        {
            CSharpProject.WriteVisibility(sw, this.Visibility);
            sw.Space();
            if (this.IsStatic)
            {
                sw.Write("static");
                sw.Space();
            }
            if (this.IsOverride)
            {
                sw.Write("override");
                sw.Space();
            }
            this.Type.Generate(sw);
            sw.Space();
            sw.Write(this.Name);
            sw.Write("(");
            bool Primero = true;

            foreach (CParam p in this.lParam)
            {
                sw.WriteComma(ref Primero);
                p.Generate(sw);
            }
            sw.Write(")");
            sw.WriteLn("{");
            sw.AddTab();
            foreach (CSentence sen in lSentence)
            {
                sen.Generate(sw);
            }
            sw.DelTab();
            sw.WriteLn("}");
        }
        public override void Generate(CSourceWriter sw)
        {
            CSharpProject.WriteVisibility(sw, this.Visibility);
            sw.Space();
            if (this.Class == null)
            {
                throw new NullReferenceException("El constructor ha de tener una clase.");
            }
            sw.Write(this.Class.Name);
            sw.Write("(");
            bool Primero = true;

            foreach (CParam p in this.lParam)
            {
                sw.WriteComma(ref Primero);
                p.Generate(sw);
            }
            sw.Write(")");
            sw.OpenBracesLn();
            sw.AddTab();
            foreach (CSentence sen in lSentence)
            {
                sen.Generate(sw);
            }
            sw.DelTab();
            sw.CloseBracesLn();
        }
 public override void Generate(CSourceWriter sw)
 {
     CSharpProject.WriteVisibility(sw, this.CSharpVisibility);
     sw.Space();
     if (this.IsStatic)
     {
         sw.Write("static");
         sw.Space();
     }
     if (this.IsPartial)
     {
         sw.Write("partial");
         sw.Space();
     }
     sw.Write("class");
     sw.Space();
     sw.Write(this.Name);
     if (!string.IsNullOrWhiteSpace(this.ParentClassName))
     {
         sw.Write(" : ");
         sw.Write(this.ParentClassName);
     }
     //*** Interfaces
     sw.OpenBracesLn();
     sw.AddTab();
     foreach (CClassElement item in this.lElement)
     {
         item.Generate(sw);
     }
     sw.DelTab();
     sw.CloseBracesLn();
 }
Пример #6
0
        internal void GeneraSql(CSourceWriter sw)
        {
            bool primero = true;

            //CONSTRAINT AK_TransactionID UNIQUE(TransactionID)
            sw.WriteLn(",constraint " + this.Nombre + " unique (");
            sw.AddTab();
            foreach (CFieldM f in this.LFields)
            {
                sw.WriteComma(ref primero);
                sw.WriteLn("" + f.Name);
            }
            sw.DelTab();
            sw.WriteLn(")");
        }
 public override void Generate(CSourceWriter sw)
 {
     CSharpProject.WriteVisibility(sw, this.Visibility);
     sw.Space();
     if (this.Override)
     {
         sw.Write("override");
         sw.Space();
     }
     this.Type.Generate(sw);
     sw.Space();
     sw.Write(this.Name);
     sw.OpenBracesLn();
     sw.AddTab();
     if (this.HasGet)
     {
         if (this.Visibility != this.GetVisibility)
         {
             CSharpProject.WriteVisibility(sw, this.GetVisibility);
             sw.Space();
         }
         sw.Write("get");
         if (this.lSentenceGet.Count > 0)
         {
             sw.OpenBracesLn();
             sw.AddTab();
             foreach (CSentence s in this.lSentenceGet)
             {
                 s.Generate(sw);
             }
             sw.DelTab();
             sw.CloseBracesLn();
         }
         else
         {
             sw.SemicolonLn();
         }
     }
     if (this.HasSet)
     {
         if (this.Visibility != this.SetVisibility)
         {
             CSharpProject.WriteVisibility(sw, this.SetVisibility);
             sw.Space();
         }
         sw.Write("set");
         if (this.lSentenceSet.Count > 0)
         {
             sw.OpenBracesLn();
             sw.AddTab();
             foreach (CSentence s in this.lSentenceSet)
             {
                 s.Generate(sw);
             }
             sw.DelTab();
             sw.CloseBracesLn();
         }
         else
         {
             sw.SemicolonLn();
         }
     }
     sw.DelTab();
     sw.CloseBracesLn();
 }
 private void GenerateEndNamespace(CSourceWriter sw)
 {
     sw.DelTab();
     sw.CloseBracesLn();
 }