Êǵģ¬Äú¿ÉÒÔ½ûÓÃÅú´¦Àí¡£Òª½ûÓÃÅú´¦Àí£¬ÐèÒªÐÞ¸ÄMaxBatchSizeÑ¡ÏÄú¿ÉÒÔÔÚOnConfiguring·½·¨ÖнøÐÐÅäÖá£
protected override void OnConfiguring(DbContextOptionsBuilder optionbuilder) { string sConnString = @"Server=localhost;Database=EFSampleDB;Trusted_Connection=true;"; optionbuilder.UseSqlServer(sConnString , b => b.MaxBatchSize(1)); }ÕâÀ½«×î´óÅúÁ¿´óСÉèÖÃΪ1£¬ÕâÒâζ×ÅÅú´¦ÀíÏÖÔÚÖ»ÄÜÊǵ¥Ìõ²éѯ¡£»»¾ä»°Ëµ£¬ËüµÄÐÐΪÀàËÆÓÚEF 6£¬Òª²åÈë3¸ö¼Ç¼£¬½«ÓÐ3¸öµ¥¶ÀµÄ²åÈëÓï¾ä¡£Ê¹ÓôËÑ¡Ïî¿ÉÒÔ¶¨Òå×î´óÅúÁ¿´óС¡£
×ܽáÅú´¦ÀíÊÇÆÚ´ýÒѾõŦÄÜ£¬²¢ÇÒÉçÇøÒ²¶à´ÎÌá³ö£¬ÏÖÔÚEF CoreÒѾ֧³Ö£¬È·ÊµºÜ°ô£¬Ëü¿ÉÒÔÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄܺÍËٶȡ£ÏÖÔÚ£¬EF Core±¾Éí»¹²»ÏñEF 6ÄÇôǿ´ó£¬µ«Ëæ×Åʱ¼äµÄÍÆÒÆ£¬Ëü½«»áÔ½À´Ô½³ÉÊì¡£
ÔÎÄ£º¡¶What is Batching of Statement in Entity Framework Core?¡·
·Ò룺Sweet Tang
±¾ÎĵØÖ·£º
»¶ÓתÔØ£¬ÇëÔÚÃ÷ÏÔλÖøø³ö³ö´¦¼°Á´½Ó¡£
posted on
¡¡