Esempio n. 1
0
            public FromClass FullOuterJoin(Entity to, FilterBase where)
            {
                var result = new FromClass(this);

                result._joins.Add(new Join(to, where, "full outer"));
                return(result);
            }
Esempio n. 2
0
            public FromClass InnerJoin(Entity to, WhereItem where)
            {
                var result = new FromClass(this);

                result._joins.Add(new Join(to, where));
                return(result);
            }
Esempio n. 3
0
            public FromClass From(params FromItem[] entities)
            {
                var r = new FromClass(this);

                r._from.AddRange(entities);
                return(r);
            }
    public void TestDestSrcReadOperation()
    {
        var message2 = new ReadWriteSimple
        {
            Source = new MemberDescriptor(
                new[]
            {
                typeof(FromClass).GetMember(nameof(FromClass.Inner))[0],
                typeof(FromClass.InnerClass).GetMember(nameof(FromClass.InnerClass.GetMessage2))[0]
            }),
            Destination = new MemberDescriptor(
                new[] { typeof(ToClass).GetMember(nameof(ToClass.Message2))[0] })
        };

        var message = new DestSrcReadOperation
        {
            ValueProcessor = (f, t, o) =>
            {
                _testOutputHelper.WriteLine(f?.ToString());
                _testOutputHelper.WriteLine(t?.ToString());

                // _testOutputHelper.WriteLine(o?.ToString());
                // var source = f as FromClass;
                // var dest = t as ToClass;
                // dest.Message = source.Inner.Message;
            },
            Source = new MemberDescriptor(
                new[]
            {
                typeof(FromClass).GetMember(nameof(FromClass.Inner))[0],
                typeof(FromClass.InnerClass).GetMember(nameof(FromClass.Inner.Message))[0]
            }),
            Destination = new MemberDescriptor(
                new[] { typeof(ToClass).GetMember(nameof(ToClass.Message))[0] })
        };

        var mapper = Mapper.Default.GetMapper <FromClass, ToClass>(
            new CustomMapConfig {
            GetMappingOperationFunc = (from, to) => new IMappingOperation[] { message, message2 }
        });

        var b = new FromClass();
        var a = mapper.Map(b);

        // b.Inner.Message.ShouldBe(a.Message);
        // b.Inner.GetMessage2().ShouldBe(a.Message2);
    }
Esempio n. 5
0
        static void Main(string[] args)
        {
            FromClass fromClass = new FromClass();

            fromClass.exam();

            SimpleLinq simpleLinq = new SimpleLinq();

            simpleLinq.exam();

            FromFrom fromFrom = new FromFrom();

            fromFrom.exam();

            GroupByClass groupByClass = new GroupByClass();

            groupByClass.exam();

            JoinClass joinClass = new JoinClass();

            joinClass.exam();
        }
Esempio n. 6
0
        /** Convert
         */
        public static JsonItem Convert(System.Object a_from_object, System.Type a_from_type, ConvertToJsonItemOption a_from_option, WorkPool a_workpool, int a_nest)
        {
            WorkPool t_workpool = a_workpool;

            if (t_workpool == null)
            {
                t_workpool = new WorkPool();
            }

            JsonItem t_to_jsonitem = null;

            {
                if (a_from_object != null)
                {
                    switch (a_from_type.FullName)
                    {
                    case "System." + nameof(System.String):
                    {
                        System.String t_value = a_from_object as System.String;

                        if (t_value != null)
                        {
                            t_to_jsonitem = new JsonItem(new Value_StringData(t_value));
                        }
                        else
                        {
                            //NULL処理。
                            t_to_jsonitem = null;
                        }
                    } break;

                    case "System." + nameof(System.Char):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Char>((System.Char)a_from_object));
                    } break;

                    case "System." + nameof(System.SByte):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.SByte>((System.SByte)a_from_object));
                    } break;

                    case "System." + nameof(System.Byte):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Byte>((System.Byte)a_from_object));
                    } break;

                    case "System." + nameof(System.Int16):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Int16>((System.Int16)a_from_object));
                    } break;

                    case "System." + nameof(System.UInt16):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.UInt16>((System.UInt16)a_from_object));
                    } break;

                    case "System." + nameof(System.Int32):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Int32>((System.Int32)a_from_object));
                    } break;

                    case "System." + nameof(System.UInt32):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.UInt32>((System.UInt32)a_from_object));
                    } break;

                    case "System." + nameof(System.Int64):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Int64>((System.Int64)a_from_object));
                    } break;

                    case "System." + nameof(System.UInt64):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.UInt64>((System.UInt64)a_from_object));
                    } break;

                    case "System." + nameof(System.Single):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Single>((System.Single)a_from_object));
                    } break;

                    case "System." + nameof(System.Double):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Double>((System.Double)a_from_object));
                    } break;

                    case "System." + nameof(System.Boolean):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Boolean>((System.Boolean)a_from_object));
                    } break;

                    case "System." + nameof(System.Decimal):
                    {
                        t_to_jsonitem = new JsonItem(new Value_Number <System.Decimal>((System.Decimal)a_from_object));
                    } break;

                    default:
                    {
                        if (a_from_type.IsArray == true)
                        {
                            //[]
                            t_to_jsonitem = FromArray.Convert(a_from_object, a_from_type, a_from_option, t_workpool, a_nest);
                        }
                        else if (a_from_type.IsEnum == true)
                        {
                            //Enum
                            t_to_jsonitem = FromEnum.Convert(a_from_object, a_from_option);
                        }
                        else
                        {
                            //class struct generic
                            t_to_jsonitem = FromClass.Convert(a_from_object, a_from_type, a_from_option, t_workpool, a_nest);
                        }
                    } break;
                    }
                }
                else
                {
                    //NULL処理。
                }
            }

            //再起呼び出し。
            if (a_workpool == null)
            {
                t_workpool.Main();
            }

            return(t_to_jsonitem);
        }