Example #1
0
        private void ReadSchema()
        {
            if (!DoneSchema)
            {
                using (var api = new EntityApi(_Name)) {
                    Formater       = api.Formater;
                    TableSchemas   = api.Builder.TableSchemas;
                    ViewSchemas    = api.Builder.ViewSchemas;
                    PackageSchemas = api.Builder.PackageSchemas;
                }
                DoneSchema = true;
            }

            if (InvokeRequired)
            {
                Invoke(
                    new MethodInvoker(ReadSchema)
                    );
            }
            else
            {
                try {
                    foreach (var one in TableSchemas)
                    {
                        if (Skip(one.TableName))
                        {
                            continue;
                        }
                        lbxTables.Items.Add(one.TableName);
                    }

                    foreach (var one in ViewSchemas)
                    {
                        if (Skip(one.ViewName))
                        {
                            continue;
                        }
                        lbxTables.Items.Add(one.ViewName);
                    }

                    foreach (var one in PackageSchemas)
                    {
                        if (Skip(one.PackageName))
                        {
                            continue;
                        }
                        lbxPackages.Items.Add(one.PackageName);
                    }
                } catch (Exception ex) {
                    MessageBox.Show(
                        ex.Message,
                        frmMain._Name,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                        );
                } finally {
                    this.BackColor = SystemColors.Control;
                }
            }
        }
Example #2
0
        public string ToOutFormatMethod(ISqlFormater formater)
        {
            var count = Outs.IsNullOrEmpty()
                                ? 0
                                : Outs.Count();

            switch (count)
            {
            case 0:
                return(string.Empty);

            case 1:
                return(string.Concat(
                           ".To",
                           Outs
                           .FirstOrDefault()
                           .ToTypeName(formater)
                           .ToPascalCasing(),
                           "()"
                           ));

            default:
                return(".ToDynamics()");
            }
        }
Example #3
0
 public string ToMethodArgument(ISqlFormater formater)
 {
     return(string.Concat(
                ToTypeName(formater),
                " ",
                ArgumentName
                ));
 }
Example #4
0
 public string ToTypeName(ISqlFormater formater)
 {
     var ef = EnumCache.Get<DataFormat>();
     var format = formater.ToDataFormat(DataType);
     var ei = ef.Get(format.ToStringX());
     var type = ei.Description;
     return type;
 }
Example #5
0
 public string ToMethodArgument(ISqlFormater formater)
 {
     return string.Concat(
         ToTypeName(formater),
         " ",
         ArgumentName
     );
 }
Example #6
0
 /// <summary>
 /// ctor
 /// </summary>
 public SqlBuilder(DatabaseType databaseType)
 {
     _TableAlias = new List <string> {
         "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
     };
     _QueueTableAlias = new Queue <string>(_TableAlias);
     _DatabaseType    = databaseType;
     _SqlFormater     = FormaterFactory.SqlFormater(_DatabaseType);
 }
Example #7
0
        public string ToTypeName(ISqlFormater formater)
        {
            var ef     = EnumCache.Get <DataFormat>();
            var format = formater.ToDataFormat(DataType);
            var ei     = ef.Get(format.ToStringX());
            var type   = ei.Description;

            return(type);
        }
Example #8
0
        public string ToOutType(ISqlFormater formater)
        {
            var count = Outs.IsNullOrEmpty()
                                ? 0
                                : Outs.Count();

            switch (count)
            {
            case 0:
                return("DataResult");

            case 1:
                return(Outs.FirstOrDefault().ToTypeName(formater));

            default:
                return("List<dynamic>[]");
            }
        }