mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	update
This commit is contained in:
		@@ -201,7 +201,7 @@ namespace FreeSql.Tests {
 | 
				
			|||||||
			.Having(a => a.Count() > 0 && a.Avg(a.Key.mod4) > 0 && a.Max(a.Key.mod4) > 0)
 | 
								.Having(a => a.Count() > 0 && a.Avg(a.Key.mod4) > 0 && a.Max(a.Key.mod4) > 0)
 | 
				
			||||||
			.Having(a => a.Count() < 300 || a.Avg(a.Key.mod4) < 100)
 | 
								.Having(a => a.Count() < 300 || a.Avg(a.Key.mod4) < 100)
 | 
				
			||||||
			.OrderBy(a => a.Key.tt2)
 | 
								.OrderBy(a => a.Key.tt2)
 | 
				
			||||||
			.OrderByDescending(a => a.Count()).ToSql(a => new { a.Key.mod4, a.Key.tt2 });
 | 
								.OrderByDescending(a => a.Count()).ToSql(a => new { a.Key.mod4, a.Key.tt2, max = a.Max("a.id"), max2 = Convert.ToInt64("max(a.id)") });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var groupbysql2 = g.mysql.Select<TestInfo>().From<TestTypeInfo, TestTypeParentInfo>((s, b, c) => s
 | 
								var groupbysql2 = g.mysql.Select<TestInfo>().From<TestTypeInfo, TestTypeParentInfo>((s, b, c) => s
 | 
				
			||||||
				.Where(a => a.Id == 1)
 | 
									.Where(a => a.Id == 1)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -345,6 +345,14 @@ namespace FreeSql.Internal {
 | 
				
			|||||||
						return $"{tmpleft} {tmptryoper} {tmpright}";
 | 
											return $"{tmpleft} {tmptryoper} {tmpright}";
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					if (callType.FullName.StartsWith("FreeSql.ISelectGroupingAggregate`")) {
 | 
										if (callType.FullName.StartsWith("FreeSql.ISelectGroupingAggregate`")) {
 | 
				
			||||||
 | 
											//if (exp3.Type == typeof(string) && exp3.Arguments.Any() && exp3.Arguments[0].NodeType == ExpressionType.Constant) {
 | 
				
			||||||
 | 
											//	switch (exp3.Method.Name) {
 | 
				
			||||||
 | 
											//		case "Sum": return $"sum({(exp3.Arguments[0] as ConstantExpression)?.Value})";
 | 
				
			||||||
 | 
											//		case "Avg": return $"avg({(exp3.Arguments[0] as ConstantExpression)?.Value})";
 | 
				
			||||||
 | 
											//		case "Max": return $"max({(exp3.Arguments[0] as ConstantExpression)?.Value})";
 | 
				
			||||||
 | 
											//		case "Min": return $"min({(exp3.Arguments[0] as ConstantExpression)?.Value})";
 | 
				
			||||||
 | 
											//	}
 | 
				
			||||||
 | 
											//}
 | 
				
			||||||
						switch (exp3.Method.Name) {
 | 
											switch (exp3.Method.Name) {
 | 
				
			||||||
							case "Count": return "count(1)";
 | 
												case "Count": return "count(1)";
 | 
				
			||||||
							case "Sum": return $"sum({ExpressionLambdaToSql(exp3.Arguments[0], _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)})";
 | 
												case "Sum": return $"sum({ExpressionLambdaToSql(exp3.Arguments[0], _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)})";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,7 +114,7 @@ using (var uow = fsql.CreateUnitOfWork()) {
 | 
				
			|||||||
public class SongContext : DbContext {
 | 
					public class SongContext : DbContext {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public DbSet<Song> Songs { get; set; }
 | 
					    public DbSet<Song> Songs { get; set; }
 | 
				
			||||||
    public DbSet<Song> Tags { get; set; }
 | 
					    public DbSet<Tag> Tags { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected override void OnConfiguring(DbContextOptionsBuilder builder) {
 | 
					    protected override void OnConfiguring(DbContextOptionsBuilder builder) {
 | 
				
			||||||
        builder.UseFreeSql(fsql);
 | 
					        builder.UseFreeSql(fsql);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user