コード例 #1
0
ファイル: Serializer.cs プロジェクト: hsmith/Migrant
        internal static ReadMethods GetReflectionBasedReadMethods(bool treatCollectionAsUserObject)
        {
            ReadMethods readMethods = new ReadMethods();

            readMethods.readMethodsProvider = new DynamicMethodProvider <ReadMethodDelegate>(t =>
            {
                return(ObjectReader.ReadObjectInnerUsingReflection);
            });

            readMethods.touchInlinedObjectMethodsProvider = new DynamicMethodProvider <TouchInlinedObjectMethodDelegate>(t =>
            {
                return((or, refId) => or.TryTouchInlinedObjectUsingReflection(t, refId));
            });

            readMethods.completeMethodsProvider = new DynamicMethodProvider <CompleteMethodDelegate>(t =>
            {
                return((or, refId) => or.CompletedInnerUsingReflection(refId));
            });

            readMethods.createObjectMethodsProvider = new DynamicMethodProvider <CreateObjectMethodDelegate>(t =>
            {
                return(() => ObjectReader.CreateObjectUsingReflection(t, treatCollectionAsUserObject));
            });
            return(readMethods);
        }