Esempio n. 1
0
        private void ParseType(ClassField tmpfield)
        {
            switch (tmpfield.TypeClass.ToLower())
            {
                case "integer":
                    tmpfield.SystemType = typeof(int);
                    break;
                case "decimal":
                    tmpfield.SystemType = typeof(decimal);
                    break;
                case "double":
                    tmpfield.SystemType = typeof(double);
                    break;
                case "string":
                    tmpfield.SystemType = typeof(string);
                    break;
                case "date":
                case "datetime":
                    tmpfield.SystemType = typeof(DateTime);
                    break;
                case "bool":
                case "boolean":
                    tmpfield.SystemType = typeof(bool);
                    break;

            }
        }
Esempio n. 2
0
 public bool ParseFields()
 {
     if (classFields.Where(x=>x.ToLower().Contains("id")).Count()==0)
     {
         // add an Id field for default identifier
         fields.Add(new ClassField() { Name = "Id", SystemType = typeof(int), TypeClass = "integer" });
     }
     foreach (string field in classFields)
     {
         string[] parts = field.Split(':');
         var tmpfield=new ClassField() { Name = parts[0], TypeClass = parts[1] };
         ParseType(tmpfield);
         fields.Add(tmpfield);
     }
     return true;
 }
Esempio n. 3
0
 public bool ParseFields()
 {
     if (classFields.Where(x=>x.ToLower().Contains("id")).Count()==0)
     {
         // add an Id field for default identifier
         var idfield=new ClassField() { Name = "Id", TypeClass = "integer", PrimaryKey=true };
         ParseType(idfield);
         fields.Add(idfield);
     }
     foreach (string field in classFields)
     {
         string[] parts = field.Split(':');
         var tmpfield=new ClassField() { Name = parts[0], TypeClass = parts[1] ,PrimaryKey=parts[0].Equals("id", StringComparison.InvariantCultureIgnoreCase)?true:false};
         ParseType(tmpfield);
         fields.Add(tmpfield);
     }
     return true;
 }
Esempio n. 4
0
        private void ParseType(ClassField tmpfield)
        {
            switch (tmpfield.TypeClass.ToLower())
            {
                case "integer":
                    tmpfield.SystemType = typeof(int);
                    tmpfield.MigrationColSyntax = "AsInt32()";
                    break;
                case "binary":
                case "bytes":
                case "blob":
                    tmpfield.SystemType = typeof(byte[]);
                    tmpfield.MigrationColSyntax = "AsBinary()";
                    break;
                case "guid":
                        tmpfield.SystemType = typeof(Guid);
                        tmpfield.MigrationColSyntax = "AsGuid()";
                    break;
                case "decimal":
                    tmpfield.SystemType = typeof(decimal);
                    tmpfield.MigrationColSyntax = "AsDecimal()";
                    break;
                case "double":
                    tmpfield.SystemType = typeof(double);
                    tmpfield.MigrationColSyntax = "AsDouble()";
                    break;
                case "string":
                    tmpfield.SystemType = typeof(string);
                    tmpfield.MigrationColSyntax = "AsString()";
                    break;
                case "date":
                case "datetime":
                    tmpfield.SystemType = typeof(DateTime);
                    tmpfield.MigrationColSyntax = "AsDateTime()";
                    break;
                case "bool":
                case "boolean":
                    tmpfield.SystemType = typeof(bool);
                    tmpfield.MigrationColSyntax = "AsBoolean()";
                    break;

            }
        }