mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 01:05:27 +08:00 
			
		
		
		
	- 优化 string IsNullable = false 时插入 null 自动转为 "" #445;
This commit is contained in:
		@@ -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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,6 +92,8 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                    if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
 | 
					                    if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
 | 
				
			||||||
                        changedDict.Add(col.Attribute.Name, true);
 | 
					                        changedDict.Add(col.Attribute.Name, true);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
 | 
				
			||||||
 | 
					                    col.SetValue(data, val = "");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,6 +171,8 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                            col.SetValue(data, val = FreeUtil.NewMongodbId());
 | 
					                            col.SetValue(data, val = FreeUtil.NewMongodbId());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
 | 
				
			||||||
 | 
					                    col.SetValue(data, val = "");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -359,6 +359,8 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                        if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
 | 
					                        if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
 | 
				
			||||||
                            changedDict.Add(col.Attribute.Name, true);
 | 
					                            changedDict.Add(col.Attribute.Name, true);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
 | 
				
			||||||
 | 
					                        col.SetValue(data, val = "");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -379,6 +381,8 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                    if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
 | 
					                    if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
 | 
				
			||||||
                        changedDict.Add(col.Attribute.Name, true);
 | 
					                        changedDict.Add(col.Attribute.Name, true);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
 | 
				
			||||||
 | 
					                    col.SetValue(data, val = "");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user