Пример #1
0
 public OracleGeometryQueryBuilder(Type type, SimpleMapping mapping, DBEntity entity, string geometryField)
 {
     _type          = type;
     _mapping       = mapping;
     _entity        = entity;
     _geometryField = geometryField;
 }
Пример #2
0
 protected GeometryCommand(ElectronSymbol entity, SimpleMapping mapping, RDBManagerBase dbManager, DbConnection conn)
 {
     Entity     = entity;
     DbManager  = dbManager;
     Mapping    = mapping;
     Connection = conn;
 }
Пример #3
0
        private void Initialize()
        {
            var path = Path.Combine(Assembly.GetExecutingAssembly().GetPhysicalDirectory(), SimpleMapping.MAP_FILE);

            _mapping = SimpleMapping.Load(path);

            OnInitialize();
        }
Пример #4
0
 public QueryBuilder(Type type, IEnumerable <string> avoidFields, SimpleMapping mapping, GeometryQuery geometryQuery, Expression expr, bool selectSingle)
 {
     Type          = type;
     AvoidFields   = avoidFields;
     Mapping       = mapping;
     GeometryQuery = geometryQuery;
     Expr          = expr;
     SelectSingle  = selectSingle;
 }
Пример #5
0
 public GeometryCommand GetUpdateCommand(ElectronSymbol entity, SimpleMapping mapping, RDBManagerBase dbManager, bool byView, DbConnection conn)
 {
     if (byView)
     {
         return(new GeometryUpdateViewCommand(entity, mapping, dbManager, conn));
     }
     else
     {
         return(new GeometryUpdateTableCommand(entity, mapping, dbManager, conn));
     }
 }
Пример #6
0
        //protected virtual IEnumerable<MyTable> GetTables()
        //{
        //    using (MySqlConnection conn = new MySqlConnection(_connectString))
        //    {

        //        MySqlCommand cmd = new MySqlCommand("show tables", conn);
        //        conn.Open();
        //        var reader = cmd.ExecuteReader();
        //        while (reader.Read())
        //        {
        //            var tablename = reader[0].ToString();
        //            if ( !tablename.EndsWith("tb") ) continue;
        //            tablename = tablename.Replace("_tb",string.Empty);
        //            var className = tablename.ToLower();
        //            className = className.Replace("b_",string.Empty);
        //            className = (className[0] + string.Empty).ToUpper() + className.Substring(1);
        //            yield return new MyTable { ClassName = className , Name = tablename};
        //        }
        //    }
        //}
        //protected virtual void FillTableDescription(MyTable table)
        //{
        //    using (MySqlConnection conn = new MySqlConnection(_connectString))
        //    {
        //        MySqlCommand cmd = new MySqlCommand("select colname,coltype,isnull from "+table.Name+"_tb", conn);
        //        try
        //        {
        //            conn.Open();
        //            var reader = cmd.ExecuteReader();
        //            while (reader.Read())
        //            {
        //                var typename = reader[1].ToString();
        //                if (typename == "GEOMETRY") typename = "Geometry";
        //                table.Columns.Add(new MyColumn { Name = reader[0].ToString(), TypeName = typename, IsNullable = reader[2].ToString() == "Y" && typename != "Geometry" });
        //            }
        //        }
        //        catch (MySqlException e)
        //        {
        //            Console.WriteLine(table.Name);
        //        }
        //    }
        //}

        public void GenerateAll()
        {
            SimpleMapping mapping = new SimpleMapping();

            foreach (var table in GetTables())
            {
                FillTableDescription(table);
                Generate(table);
                mapping.Add(new SimpleMappingPair {
                    TableName = table.Name, ClassName = table.ClassName, UpdateView = table.UpdateView
                });
            }
            mapping.Save(SimpleMapping.MAP_FILE);
        }
Пример #7
0
        public MappingApiElement(SimpleMapping simpleMapping)
        {
            if (string.IsNullOrEmpty(simpleMapping.Parent))
            {
                AttributeName = simpleMapping.Name;
            }
            else
            {
                AttributeName = simpleMapping.Parent + "." + simpleMapping.Name;
            }

            if (string.IsNullOrEmpty(simpleMapping.Type))
            {
                Type = "object";
            }
            else
            {
                Type = simpleMapping.Type;
            }
        }
 public QueryBuilder Create(QueryVersion version, Type type, IEnumerable <string> avoidFields, SimpleMapping mapping, GeometryQuery geometryQuery, Expression expr, bool selectSingle)
 {
     if (version == QueryVersion.V10)
     {
         return(new SelectQueryBuilder(type, avoidFields, mapping, geometryQuery, expr, selectSingle));
     }
     else
     {
         return(new SelectQueryBuilderV94(type, avoidFields, mapping, geometryQuery, expr, selectSingle));
     }
 }
 public QueryBuilder Create(QueryVersion version, Type type, IEnumerable <string> avoidFields, SimpleMapping mapping, GeometryQuery geometryQuery, Expression expr, bool selectSingle)
 {
     return(_implement.Create(version, type, avoidFields, mapping, geometryQuery, expr, selectSingle));
 }
Пример #10
0
 public GeometryInsertTableCommand(ElectronSymbol entity, SimpleMapping mapping, RDBManagerBase dbManager, DbConnection conn)
     : base(entity, mapping, dbManager, conn)
 {
 }
 public InsertPlainGeometryQueryBuilder(ElectronSymbol symbol, IEnumerable <string> avoidFields,
                                        SimpleMapping mapping)
     : base(symbol, avoidFields, mapping)
 {
 }
Пример #12
0
 public DeleteQueryBuilder(object entity, Type type, SimpleMapping mapping, bool byView)
     : base(type, new string[] {}, mapping, null, null, true)
 {
     _byView = byView;
 }
Пример #13
0
 public GeometryCommand GetUpdateCommand(ElectronSymbol entity, SimpleMapping mapping, RDBManagerBase dbManager, bool byView, DbConnection conn)
 {
     return(_factory.GetUpdateCommand(entity, mapping, dbManager, byView, conn));
 }
Пример #14
0
 //public IList<string> Fields {
 //    get { return _fields; }
 //    private set { _fields = value; }
 //}
 public UpdateQueryBuilder(object entity, Type type, IEnumerable <string> avoidFields, SimpleMapping mapping, GeometryQuery geometryQuery, bool byView) : base(type, avoidFields, mapping, geometryQuery, null, true)
 {
     _entity = entity;
     _byView = byView;
 }
Пример #15
0
 public SelectQueryBuilder(Type type, IEnumerable <string> avoidFields, SimpleMapping mapping, GeometryQuery geometryQuery, Expression expr, bool selectSingle)
     : base(type, avoidFields, mapping, geometryQuery, expr, selectSingle)
 {
 }
Пример #16
0
 protected GeometryQueryBuilder(ElectronSymbol symbol, IEnumerable <string> avoidFields, SimpleMapping mapping)
     : base(symbol.GetType(), avoidFields, mapping, null, null, true)
 {
     Symbol = symbol;
 }