Пример #1
0
        protected Field(MemberInfo[] members)
        {
            Members = members;
            MemberName = members.Select(x => x.Name).Join("");

            MemberType = members.Last().GetMemberType();

            PgType = TypeMappings.GetPgType(MemberType);
        }
Пример #2
0
        protected Field(MemberInfo[] members)
        {
            Members = members;
            MemberName = members.Select(x => x.Name).Join("");

            MemberType = members.Last().GetMemberType();

            if (MemberType.IsEnum)
            {
                PgType = "integer";
            }
            else
            {
                PgType = TypeMappings.PgTypes[MemberType];
            }
        }
Пример #3
0
        public static IWhereFragment SimpleArrayContains(MemberInfo[] members, ISerializer serializer, Expression @from, object value)
        {
            if (value != null)
            {
                var array = Array.CreateInstance(value.GetType(), 1);
                array.SetValue(value, 0);

                var dict = new Dictionary<string, object> {{members.Last().Name, array}};

                members.Reverse().Skip(1).Each(m => { dict = new Dictionary<string, object> {{m.Name, dict}}; });

                return new ContainmentWhereFragment(serializer, dict);
            }


            throw new NotSupportedException();
        }