mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	Merge pull request #450 from luoyunchong/master
FreeSqlDbContextExtensions remove test code
This commit is contained in:
		
							
								
								
									
										48
									
								
								Examples/efcore_to_freesql/Entitys/Song.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								Examples/efcore_to_freesql/Entitys/Song.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					using FreeSql.DataAnnotations;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace efcore_to_freesql.Entitys
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class SongType
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public int Id { get; set; }
 | 
				
			||||||
 | 
					        public string Name { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<Song> Songs { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class Song
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        [Column(IsIdentity = true)]
 | 
				
			||||||
 | 
					        public int Id { get; set; }
 | 
				
			||||||
 | 
					        public string Title { get; set; }
 | 
				
			||||||
 | 
					        public string Url { get; set; }
 | 
				
			||||||
 | 
					        public DateTime CreateTime { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public int TypeId { get; set; }
 | 
				
			||||||
 | 
					        public SongType Type { get; set; }
 | 
				
			||||||
 | 
					        public List<Tag> Tags { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public int Field1 { get; set; }
 | 
				
			||||||
 | 
					        public long RowVersion { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public class Song_tag
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public int Song_id { get; set; }
 | 
				
			||||||
 | 
					        public Song Song { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public int Tag_id { get; set; }
 | 
				
			||||||
 | 
					        public Tag Tag { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class Tag
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        [Column(IsIdentity = true)]
 | 
				
			||||||
 | 
					        public int Id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public string Name { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<Song> Songs { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
using FreeSql;
 | 
					using efcore_to_freesql.Entitys;
 | 
				
			||||||
 | 
					using FreeSql;
 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					using Microsoft.EntityFrameworkCore;
 | 
				
			||||||
using Microsoft.EntityFrameworkCore.Metadata;
 | 
					using Microsoft.EntityFrameworkCore.Metadata;
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
@@ -69,4 +70,112 @@ public static class CodeFirstExtensions
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void EfCoreFluentApiTestGeneric(this ICodeFirst cf)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        cf.Entity<Song>(eb =>
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            eb.ToTable("tb_song1");
 | 
				
			||||||
 | 
					            eb.Ignore(a => a.Field1);
 | 
				
			||||||
 | 
					            eb.Property(a => a.Title).HasColumnType("varchar(50)").IsRequired();
 | 
				
			||||||
 | 
					            eb.Property(a => a.Url).HasMaxLength(100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            eb.Property(a => a.RowVersion).IsRowVersion();
 | 
				
			||||||
 | 
					            eb.Property(a => a.CreateTime).HasDefaultValueSql("current_timestamp");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            eb.HasKey(a => a.Id);
 | 
				
			||||||
 | 
					            eb.HasIndex(a => a.Title).IsUnique().HasName("idx_tb_song1111");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //一对多、多对一
 | 
				
			||||||
 | 
					            eb.HasOne(a => a.Type).HasForeignKey(a => a.TypeId).WithMany(a => a.Songs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //多对多
 | 
				
			||||||
 | 
					            eb.HasMany(a => a.Tags).WithMany(a => a.Songs, typeof(Song_tag));
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        cf.Entity<SongType>(eb =>
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            eb.ToTable("tb_songtype1");
 | 
				
			||||||
 | 
					            eb.HasMany(a => a.Songs).WithOne(a => a.Type).HasForeignKey(a => a.TypeId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            eb.HasData(new[]
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                new SongType
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Id = 1,
 | 
				
			||||||
 | 
					                    Name = "流行",
 | 
				
			||||||
 | 
					                    Songs = new List<Song>(new[]
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        new Song{ Title = "真的爱你" },
 | 
				
			||||||
 | 
					                        new Song{ Title = "爱你一万年" },
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                new SongType
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Id = 2,
 | 
				
			||||||
 | 
					                    Name = "乡村",
 | 
				
			||||||
 | 
					                    Songs = new List<Song>(new[]
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        new Song{ Title = "乡里乡亲" },
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cf.SyncStructure<SongType>();
 | 
				
			||||||
 | 
					        cf.SyncStructure<Song>();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void EfCoreFluentApiTestDynamic(this ICodeFirst cf)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        cf.Entity(typeof(Song), eb =>
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            eb.ToTable("tb_song2");
 | 
				
			||||||
 | 
					            eb.Ignore("Field1");
 | 
				
			||||||
 | 
					            eb.Property("Title").HasColumnType("varchar(50)").IsRequired();
 | 
				
			||||||
 | 
					            eb.Property("Url").HasMaxLength(100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            eb.Property("RowVersion").IsRowVersion();
 | 
				
			||||||
 | 
					            eb.Property("CreateTime").HasDefaultValueSql("current_timestamp");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            eb.HasKey("Id");
 | 
				
			||||||
 | 
					            eb.HasIndex("Title").IsUnique().HasName("idx_tb_song2222");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //一对多、多对一
 | 
				
			||||||
 | 
					            eb.HasOne("Type").HasForeignKey("TypeId").WithMany("Songs");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //多对多
 | 
				
			||||||
 | 
					            eb.HasMany("Tags").WithMany("Songs", typeof(Song_tag));
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        cf.Entity(typeof(SongType), eb =>
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            eb.ToTable("tb_songtype2");
 | 
				
			||||||
 | 
					            eb.HasMany("Songs").WithOne("Type").HasForeignKey("TypeId");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            eb.HasData(new[]
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                new SongType
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Id = 1,
 | 
				
			||||||
 | 
					                    Name = "流行",
 | 
				
			||||||
 | 
					                    Songs = new List<Song>(new[]
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        new Song{ Title = "真的爱你" },
 | 
				
			||||||
 | 
					                        new Song{ Title = "爱你一万年" },
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                new SongType
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Id = 2,
 | 
				
			||||||
 | 
					                    Name = "乡村",
 | 
				
			||||||
 | 
					                    Songs = new List<Song>(new[]
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        new Song{ Title = "乡里乡亲" },
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cf.SyncStructure<SongType>();
 | 
				
			||||||
 | 
					        cf.SyncStructure<Song>();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -27,10 +27,10 @@ namespace efcore_to_freesql
 | 
				
			|||||||
                .UseAutoSyncStructure(true)
 | 
					                .UseAutoSyncStructure(true)
 | 
				
			||||||
                .Build();
 | 
					                .Build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //FreeSqlDbContextExtensions.EfCoreFluentApiTestGeneric(Fsql);
 | 
					            //Fsql.CodeFirst.EfCoreFluentApiTestGeneric();
 | 
				
			||||||
            FreeSqlDbContextExtensions.EfCoreFluentApiTestDynamic(Fsql);
 | 
					            Fsql.CodeFirst.EfCoreFluentApiTestDynamic();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DBContexts.BaseDBContext.Fsql = Fsql;
 | 
					            BaseDBContext.Fsql = Fsql;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var sql11 = Fsql.Select<Topic1>().ToSql();
 | 
					            var sql11 = Fsql.Select<Topic1>().ToSql();
 | 
				
			||||||
            //SELECT a."Id", a."Title", a."CreateTime" FROM "Topic1" a
 | 
					            //SELECT a."Id", a."Title", a."CreateTime" FROM "Topic1" a
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,156 +34,4 @@ partial class FreeSqlDbContextExtensions
 | 
				
			|||||||
        codeFirst.ConfigEntity(entityType, tf => modelBuilder(new EfCoreTableFluent(cf._orm, tf, entityType)));
 | 
					        codeFirst.ConfigEntity(entityType, tf => modelBuilder(new EfCoreTableFluent(cf._orm, tf, entityType)));
 | 
				
			||||||
        return codeFirst;
 | 
					        return codeFirst;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static void EfCoreFluentApiTestGeneric(IFreeSql fsql)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        var cf = fsql.CodeFirst;
 | 
					 | 
				
			||||||
        cf.Entity<Song>(eb =>
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            eb.ToTable("tb_song1");
 | 
					 | 
				
			||||||
            eb.Ignore(a => a.Field1);
 | 
					 | 
				
			||||||
            eb.Property(a => a.Title).HasColumnType("varchar(50)").IsRequired();
 | 
					 | 
				
			||||||
            eb.Property(a => a.Url).HasMaxLength(100);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            eb.Property(a => a.RowVersion).IsRowVersion();
 | 
					 | 
				
			||||||
            eb.Property(a => a.CreateTime).HasDefaultValueSql("current_timestamp");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            eb.HasKey(a => a.Id);
 | 
					 | 
				
			||||||
            eb.HasIndex(a => a.Title).IsUnique().HasName("idx_tb_song1111");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //一对多、多对一
 | 
					 | 
				
			||||||
            eb.HasOne(a => a.Type).HasForeignKey(a => a.TypeId).WithMany(a => a.Songs);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //多对多
 | 
					 | 
				
			||||||
            eb.HasMany(a => a.Tags).WithMany(a => a.Songs, typeof(Song_tag));
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        cf.Entity<SongType>(eb =>
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            eb.ToTable("tb_songtype1");
 | 
					 | 
				
			||||||
            eb.HasMany(a => a.Songs).WithOne(a => a.Type).HasForeignKey(a => a.TypeId);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            eb.HasData(new[]
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                new SongType
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = 1,
 | 
					 | 
				
			||||||
                    Name = "流行",
 | 
					 | 
				
			||||||
                    Songs = new List<Song>(new[]
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        new Song{ Title = "真的爱你" },
 | 
					 | 
				
			||||||
                        new Song{ Title = "爱你一万年" },
 | 
					 | 
				
			||||||
                    })
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                new SongType
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = 2,
 | 
					 | 
				
			||||||
                    Name = "乡村",
 | 
					 | 
				
			||||||
                    Songs = new List<Song>(new[]
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        new Song{ Title = "乡里乡亲" },
 | 
					 | 
				
			||||||
                    })
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        cf.SyncStructure<SongType>();
 | 
					 | 
				
			||||||
        cf.SyncStructure<Song>();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static void EfCoreFluentApiTestDynamic(IFreeSql fsql)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        var cf = fsql.CodeFirst;
 | 
					 | 
				
			||||||
        cf.Entity(typeof(Song), eb =>
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            eb.ToTable("tb_song2");
 | 
					 | 
				
			||||||
            eb.Ignore("Field1");
 | 
					 | 
				
			||||||
            eb.Property("Title").HasColumnType("varchar(50)").IsRequired();
 | 
					 | 
				
			||||||
            eb.Property("Url").HasMaxLength(100);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            eb.Property("RowVersion").IsRowVersion();
 | 
					 | 
				
			||||||
            eb.Property("CreateTime").HasDefaultValueSql("current_timestamp");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            eb.HasKey("Id");
 | 
					 | 
				
			||||||
            eb.HasIndex("Title").IsUnique().HasName("idx_tb_song2222");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //一对多、多对一
 | 
					 | 
				
			||||||
            eb.HasOne("Type").HasForeignKey("TypeId").WithMany("Songs");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //多对多
 | 
					 | 
				
			||||||
            eb.HasMany("Tags").WithMany("Songs", typeof(Song_tag));
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        cf.Entity(typeof(SongType), eb =>
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            eb.ToTable("tb_songtype2");
 | 
					 | 
				
			||||||
            eb.HasMany("Songs").WithOne("Type").HasForeignKey("TypeId");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            eb.HasData(new[]
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                new SongType
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = 1,
 | 
					 | 
				
			||||||
                    Name = "流行",
 | 
					 | 
				
			||||||
                    Songs = new List<Song>(new[]
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        new Song{ Title = "真的爱你" },
 | 
					 | 
				
			||||||
                        new Song{ Title = "爱你一万年" },
 | 
					 | 
				
			||||||
                    })
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                new SongType
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Id = 2,
 | 
					 | 
				
			||||||
                    Name = "乡村",
 | 
					 | 
				
			||||||
                    Songs = new List<Song>(new[]
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        new Song{ Title = "乡里乡亲" },
 | 
					 | 
				
			||||||
                    })
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        cf.SyncStructure<SongType>();
 | 
					 | 
				
			||||||
        cf.SyncStructure<Song>();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public class SongType
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        public int Id { get; set; }
 | 
					 | 
				
			||||||
        public string Name { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public List<Song> Songs { get; set; }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public class Song
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        [Column(IsIdentity = true)]
 | 
					 | 
				
			||||||
        public int Id { get; set; }
 | 
					 | 
				
			||||||
        public string Title { get; set; }
 | 
					 | 
				
			||||||
        public string Url { get; set; }
 | 
					 | 
				
			||||||
        public DateTime CreateTime { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public int TypeId { get; set; }
 | 
					 | 
				
			||||||
        public SongType Type { get; set; }
 | 
					 | 
				
			||||||
        public List<Tag> Tags { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public int Field1 { get; set; }
 | 
					 | 
				
			||||||
        public long RowVersion { get; set; }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    public class Song_tag
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        public int Song_id { get; set; }
 | 
					 | 
				
			||||||
        public Song Song { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public int Tag_id { get; set; }
 | 
					 | 
				
			||||||
        public Tag Tag { get; set; }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public class Tag
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        [Column(IsIdentity = true)]
 | 
					 | 
				
			||||||
        public int Id { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public string Name { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public List<Song> Songs { get; set; }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -532,5 +532,14 @@
 | 
				
			|||||||
            <param name="that"></param>
 | 
					            <param name="that"></param>
 | 
				
			||||||
            <returns></returns>
 | 
					            <returns></returns>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
 | 
					        <member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
 | 
				
			||||||
 | 
					            <summary>
 | 
				
			||||||
 | 
					            批量注入 Repository,可以参考代码自行调整
 | 
				
			||||||
 | 
					            </summary>
 | 
				
			||||||
 | 
					            <param name="services"></param>
 | 
				
			||||||
 | 
					            <param name="globalDataFilter"></param>
 | 
				
			||||||
 | 
					            <param name="assemblies"></param>
 | 
				
			||||||
 | 
					            <returns></returns>
 | 
				
			||||||
 | 
					        </member>
 | 
				
			||||||
    </members>
 | 
					    </members>
 | 
				
			||||||
</doc>
 | 
					</doc>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
namespace FreeSql.Extensions.EntityUtil
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public static class TempExtensions
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -2983,153 +2983,6 @@
 | 
				
			|||||||
            <param name="parms"></param>
 | 
					            <param name="parms"></param>
 | 
				
			||||||
            <returns></returns>
 | 
					            <returns></returns>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteConnectTestAsync">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            测试数据库是否连接正确,本方法执行如下命令:<para></para>
 | 
					 | 
				
			||||||
            MySql/SqlServer/PostgreSQL/达梦/人大金仓/神通: SELECT 1<para></para>
 | 
					 | 
				
			||||||
            Oracle: SELECT 1 FROM dual<para></para>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <returns>true: 成功, false: 失败</returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteReaderAsync(System.Func{FreeSql.Internal.Model.FetchCallbackArgs{System.Data.Common.DbDataReader},System.Threading.Tasks.Task},System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="readerHander"></param>
 | 
					 | 
				
			||||||
            <param name="cmdType"></param>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteReaderAsync(System.Func{FreeSql.Internal.Model.FetchCallbackArgs{System.Data.Common.DbDataReader},System.Threading.Tasks.Task},System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询,ExecuteReaderAsync(dr => {}, "select * from user where age > ?age", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteArrayAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteArrayAsync(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询,ExecuteArrayAsync("select * from user where age > ?age", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteDataSetAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteDataSetAsync(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询,ExecuteDataSetAsync("select * from user where age > ?age; select 2", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteDataTableAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteDataTableAsync(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            查询,ExecuteDataTableAsync("select * from user where age > ?age", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteNonQueryAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            在【主库】执行
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdType"></param>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteNonQueryAsync(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            在【主库】执行,ExecuteNonQueryAsync("delete from user where age > ?age", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteScalarAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            在【主库】执行
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdType"></param>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.ExecuteScalarAsync(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            在【主库】执行,ExecuteScalarAsync("select 1 from user where age > ?age", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.QueryAsync``1(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new SqlParameter { ParameterName = "age", Value = 25 })
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <typeparam name="T"></typeparam>
 | 
					 | 
				
			||||||
            <param name="cmdType"></param>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.QueryAsync``1(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <typeparam name="T"></typeparam>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.QueryAsync``2(System.Data.CommandType,System.String,System.Data.Common.DbParameter[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <typeparam name="T1"></typeparam>
 | 
					 | 
				
			||||||
            <param name="cmdType"></param>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="cmdParms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.IAdo.QueryAsync``2(System.String,System.Object)">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            执行SQL返回对象集合,Query<User, Address>("select * from user where age > ?age; select * from address", new { age = 25 })<para></para>
 | 
					 | 
				
			||||||
            提示:parms 参数还可以传 Dictionary<string, object>
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <typeparam name="T1"></typeparam>
 | 
					 | 
				
			||||||
            <param name="cmdText"></param>
 | 
					 | 
				
			||||||
            <param name="parms"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="E:FreeSql.IAop.ParseExpression">
 | 
					        <member name="E:FreeSql.IAop.ParseExpression">
 | 
				
			||||||
            <summary>
 | 
					            <summary>
 | 
				
			||||||
            可自定义解析表达式
 | 
					            可自定义解析表达式
 | 
				
			||||||
@@ -3886,12 +3739,6 @@
 | 
				
			|||||||
            <param name="timeout">超时</param>
 | 
					            <param name="timeout">超时</param>
 | 
				
			||||||
            <returns></returns>
 | 
					            <returns></returns>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:FreeSql.Internal.ObjectPool.IObjectPool`1.GetAsync">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            获取资源
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.Internal.ObjectPool.IObjectPool`1.Return(FreeSql.Internal.ObjectPool.Object{`0},System.Boolean)">
 | 
					        <member name="M:FreeSql.Internal.ObjectPool.IObjectPool`1.Return(FreeSql.Internal.ObjectPool.Object{`0},System.Boolean)">
 | 
				
			||||||
            <summary>
 | 
					            <summary>
 | 
				
			||||||
            使用完毕后,归还资源
 | 
					            使用完毕后,归还资源
 | 
				
			||||||
@@ -3962,12 +3809,6 @@
 | 
				
			|||||||
            </summary>
 | 
					            </summary>
 | 
				
			||||||
            <param name="obj">资源对象</param>
 | 
					            <param name="obj">资源对象</param>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:FreeSql.Internal.ObjectPool.IPolicy`1.OnGetAsync(FreeSql.Internal.ObjectPool.Object{`0})">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            从对象池获取对象成功的时候触发,通过该方法统计或初始化对象
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="obj">资源对象</param>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.Internal.ObjectPool.IPolicy`1.OnReturn(FreeSql.Internal.ObjectPool.Object{`0})">
 | 
					        <member name="M:FreeSql.Internal.ObjectPool.IPolicy`1.OnReturn(FreeSql.Internal.ObjectPool.Object{`0})">
 | 
				
			||||||
            <summary>
 | 
					            <summary>
 | 
				
			||||||
            归还对象给对象池的时候触发
 | 
					            归还对象给对象池的时候触发
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user