mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 增加 EfCoreFluentApi HasData 设定 CodeFirst 种子数据;
- 完善 EfCoreFluentApi 功能测试; - 增加 DbContextOptions.NoneParameter 设置是否使用参数化执行 Insert/Update;
This commit is contained in:
		@@ -17,9 +17,9 @@ namespace FreeSql.Internal.CommonProvider
 | 
			
		||||
    public abstract partial class CodeFirstProvider : ICodeFirst
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        protected IFreeSql _orm;
 | 
			
		||||
        protected CommonUtils _commonUtils;
 | 
			
		||||
        protected CommonExpression _commonExpression;
 | 
			
		||||
        public IFreeSql _orm;
 | 
			
		||||
        public CommonUtils _commonUtils;
 | 
			
		||||
        public CommonExpression _commonExpression;
 | 
			
		||||
        public CodeFirstProvider(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression)
 | 
			
		||||
        {
 | 
			
		||||
            _orm = orm;
 | 
			
		||||
 
 | 
			
		||||
@@ -134,6 +134,8 @@ namespace FreeSql.Internal.CommonProvider
 | 
			
		||||
        public static void AuditDataValue(object sender, T1 data, IFreeSql orm, TableInfo table, Dictionary<string, bool> changedDict)
 | 
			
		||||
        {
 | 
			
		||||
            if (data == null) return;
 | 
			
		||||
            if (typeof(T1) == typeof(object) && data.GetType() != table.Type)
 | 
			
		||||
                throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。");
 | 
			
		||||
            foreach (var col in table.Columns.Values)
 | 
			
		||||
            {
 | 
			
		||||
                object val = col.GetMapValue(data);
 | 
			
		||||
 
 | 
			
		||||
@@ -351,6 +351,8 @@ namespace FreeSql.Internal.CommonProvider
 | 
			
		||||
        {
 | 
			
		||||
            if (orm.Aop.AuditValueHandler == null) return;
 | 
			
		||||
            if (data == null) return;
 | 
			
		||||
            if (typeof(T1) == typeof(object) && data.GetType() != table.Type) 
 | 
			
		||||
                throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。");
 | 
			
		||||
            foreach (var col in table.Columns.Values)
 | 
			
		||||
            {
 | 
			
		||||
                object val = col.GetMapValue(data);
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ namespace FreeSql.Internal
 | 
			
		||||
            if (entity == null) return _orm.CodeFirst;
 | 
			
		||||
            var type = typeof(T);
 | 
			
		||||
            var table = dicConfigEntity.GetOrAdd(type, new TableAttribute());
 | 
			
		||||
            var fluent = new TableFluent<T>(CodeFirst, table);
 | 
			
		||||
            var fluent = new TableFluent<T>(table);
 | 
			
		||||
            entity.Invoke(fluent);
 | 
			
		||||
            Utils.RemoveTableByEntity(type, this); //remove cache
 | 
			
		||||
            return _orm.CodeFirst;
 | 
			
		||||
@@ -88,7 +88,7 @@ namespace FreeSql.Internal
 | 
			
		||||
        {
 | 
			
		||||
            if (entity == null) return _orm.CodeFirst;
 | 
			
		||||
            var table = dicConfigEntity.GetOrAdd(type, new TableAttribute());
 | 
			
		||||
            var fluent = new TableFluent(CodeFirst, type, table);
 | 
			
		||||
            var fluent = new TableFluent(type, table);
 | 
			
		||||
            entity.Invoke(fluent);
 | 
			
		||||
            Utils.RemoveTableByEntity(type, this); //remove cache
 | 
			
		||||
            return _orm.CodeFirst;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user