Пример #1
0
            public (Type Type, string ContainerName) GetSerializeInfo(ComplexEntityExpressionSerializer serializer, EntityItem <object> item)
            {
                var cast = (MethodEntity)item;

                return(
                    item.Entity?.GetType(),
                    $"{cast.MethodInfo.Name}({string.Join(",", cast.Parameters)})"
                    );
            }
Пример #2
0
        public void SerializationComplex1()
        {
            // create a simple object
            var model = new
            {
                A = "A",
                B = "B",
                C = "C",
                D = "D",
                E = "E",
            };

            var expression         = model.AsExpression();
            var serialization      = new ComplexEntityExpressionSerializer(expression);
            var expressionAsString = serialization.Serialize();

            System.Console.WriteLine(expressionAsString);
        }
Пример #3
0
        public void SerializationComplex2()
        {
            // create a simple object
            var model = new
            {
                A = "A",
                B = "B",
                C = "C",
                D = "D",
                E = "BIG VALUE",
            };

            var expression    = model.AsExpression();
            var serialization = new ComplexEntityExpressionSerializer(expression);

            serialization.EncloseParenthesisInRoot = true;
            serialization.ValueFormatter           = new TruncateFormatter(3);
            serialization.ShowType = ShowTypeOptions.TypeName;
            var expressionAsString = serialization.Serialize();

            System.Console.WriteLine(expressionAsString);
        }
Пример #4
0
 public bool CanSerialize(ComplexEntityExpressionSerializer serializer, EntityItem <object> item)
 {
     return(item is MethodEntity);
 }