예제 #1
0
            public void WithMany(Expression <Func <T2, IEnumerable <T> > > many, Type middleType)
            {
                if (many?.Body == null)
                {
                    throw new ArgumentException("参数错误 many 不能为 null");
                }
                var exp = many.Body;

                switch (exp.NodeType)
                {
                case ExpressionType.MemberAccess:
                    _withManyProperty = (exp as MemberExpression).Member.Name;
                    break;
                }
                if (string.IsNullOrEmpty(_withManyProperty))
                {
                    throw new ArgumentException("参数错误 many");
                }

                _tf.Navigate(_selfProperty, null, middleType);
                _tf.ConfigEntity <T2>(eb2 => eb2.Navigate(_withManyProperty, null, middleType));
            }
예제 #2
0
            public HasOneFluent <T2> WithMany <TMany>(Expression <Func <T2, TMany> > many)
            {
                if (many?.Body == null)
                {
                    throw new ArgumentException("参数错误 many 不能为 null");
                }
                var exp = many.Body;

                switch (exp.NodeType)
                {
                case ExpressionType.MemberAccess:
                    _withManyProperty = (exp as MemberExpression).Member.Name;
                    break;
                }
                if (string.IsNullOrEmpty(_withManyProperty))
                {
                    throw new ArgumentException("参数错误 many");
                }
                if (string.IsNullOrEmpty(_selfBind) == false)
                {
                    _tf.ConfigEntity <T2>(eb2 => eb2.Navigate(_withManyProperty, _selfBind));
                }
                return(this);
            }