mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 增加 FreeSql.Extensions.JsonMap FluentApi 扩展方法;#279
This commit is contained in:
		@@ -1,16 +1,22 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.DataAnnotations
 | 
			
		||||
{
 | 
			
		||||
    public class ColumnFluent
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public ColumnFluent(ColumnAttribute column)
 | 
			
		||||
        public ColumnFluent(ColumnAttribute column, PropertyInfo property, Type entityType)
 | 
			
		||||
        {
 | 
			
		||||
            _column = column;
 | 
			
		||||
            _property = property;
 | 
			
		||||
            _entityType = entityType;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ColumnAttribute _column;
 | 
			
		||||
        public ColumnAttribute _column;
 | 
			
		||||
        public PropertyInfo _property;
 | 
			
		||||
        public Type _entityType;
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 数据库列名
 | 
			
		||||
        /// </summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -47,9 +47,9 @@ namespace FreeSql.DataAnnotations
 | 
			
		||||
 | 
			
		||||
        public ColumnFluent Property(string proto)
 | 
			
		||||
        {
 | 
			
		||||
            if (_properties.ContainsKey(proto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}");
 | 
			
		||||
            var col = _table._columns.GetOrAdd(proto, name => new ColumnAttribute { Name = proto });
 | 
			
		||||
            return new ColumnFluent(col);
 | 
			
		||||
            if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}");
 | 
			
		||||
            var col = _table._columns.GetOrAdd(tryProto.Name, name => new ColumnAttribute { Name = proto });
 | 
			
		||||
            return new ColumnFluent(col, tryProto, _entityType);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@@ -131,7 +131,7 @@ namespace FreeSql.DataAnnotations
 | 
			
		||||
        {
 | 
			
		||||
            if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}");
 | 
			
		||||
            var col = _table._columns.GetOrAdd(tryProto.Name, name => new ColumnAttribute { Name = proto });
 | 
			
		||||
            return new ColumnFluent(col);
 | 
			
		||||
            return new ColumnFluent(col, tryProto, typeof(T));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user