mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 修复 IAdo.Query\<object\> 字段名重复的 bug;#162
This commit is contained in:
		@@ -84,6 +84,17 @@ namespace FreeSql.Tests
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            fsql = ib.Get("db3");
 | 
					            fsql = ib.Get("db3");
 | 
				
			||||||
            fsql.Select<ut3_t1>().Limit(10).ToList();
 | 
					            fsql.Select<ut3_t1>().Limit(10).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            fsql = g.sqlserver;
 | 
				
			||||||
 | 
					            fsql.Insert<OrderMain>(new OrderMain { OrderNo = "1001", OrderTime = new DateTime(2019, 12, 01) }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1001", ItemNo = "I001", Qty = 1 }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1001", ItemNo = "I002", Qty = 1 }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1001", ItemNo = "I003", Qty = 1 }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderMain>(new OrderMain { OrderNo = "1002", OrderTime = new DateTime(2019, 12, 02) }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I011", Qty = 1 }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I012", Qty = 1 }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I013", Qty = 1 }).ExecuteAffrows();
 | 
				
			||||||
 | 
					            fsql.Ado.Query<object>("select * from orderdetail left join ordermain on orderdetail.orderno=ordermain.orderno where ordermain.orderno='1001'");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        class TestByte
 | 
					        class TestByte
 | 
				
			||||||
@@ -106,6 +117,19 @@ namespace FreeSql.Tests
 | 
				
			|||||||
            public int id { get; set; }
 | 
					            public int id { get; set; }
 | 
				
			||||||
            public string name { get; set; }
 | 
					            public string name { get; set; }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public class OrderMain
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            public string OrderNo { get; set; }
 | 
				
			||||||
 | 
					            public DateTime OrderTime { get; set; }
 | 
				
			||||||
 | 
					            public decimal Amount { get; set; }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public class OrderDetail
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            public string OrderNo { get; set; }
 | 
				
			||||||
 | 
					            public string ItemNo { get; set; }
 | 
				
			||||||
 | 
					            public decimal Qty { get; set; }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1331,8 +1331,12 @@ namespace FreeSql.Internal
 | 
				
			|||||||
                            var expandodic = new Dictionary<string, object>();// (IDictionary<string, object>)expando;
 | 
					                            var expandodic = new Dictionary<string, object>();// (IDictionary<string, object>)expando;
 | 
				
			||||||
                            var fc = row2.FieldCount;
 | 
					                            var fc = row2.FieldCount;
 | 
				
			||||||
                            for (var a = 0; a < fc; a++)
 | 
					                            for (var a = 0; a < fc; a++)
 | 
				
			||||||
                                //expando[row2.GetName(a)] = row2.GetValue(a);
 | 
					                            {
 | 
				
			||||||
                                expandodic.Add(row2.GetName(a), row2.GetValue(a));
 | 
					                                var name = row2.GetName(a);
 | 
				
			||||||
 | 
					                                //expando[name] = row2.GetValue(a);
 | 
				
			||||||
 | 
					                                if (expandodic.ContainsKey(name)) continue;
 | 
				
			||||||
 | 
					                                expandodic.Add(name, row2.GetValue(a));
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                            //expando = expandodic;
 | 
					                            //expando = expandodic;
 | 
				
			||||||
                            return new RowInfo(expandodic, fc);
 | 
					                            return new RowInfo(expandodic, fc);
 | 
				
			||||||
                        };
 | 
					                        };
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user