Esempio n. 1
0
        /// <summary>
        /// Deserializes a string expression for the inferred type. This type should contain a "string name" parameter that will come from the expression: "A" + "B"
        /// </summary>
        /// <param name="expression">Expressin as string</param>
        /// <param name="factory">This factory is necessary for the creation of entities. You can inherit this class and add new methods to be used in the string expression: "A" + NewMethod()</param>
        /// <returns>Return a circular entity</returns>
        public async Task <T> DeserializeAsync(string expression, CircularEntityFactory <T> factory)
        {
            var roslyn = new RoslynExpressionDeserializer <T>();
            var runner = roslyn.GetDelegateExpression(expression, factory.GetType());

            return(await runner(factory));
        }
Esempio n. 2
0
        /// <summary>
        /// Deserializes a string expression for the inferred type. This type should contain a "string name" parameter that will come from the expression: "A" + "B"
        /// </summary>
        /// <param name="expression">Expressin as string</param>
        /// <returns>Return a circular entity</returns>
        public async Task <T> DeserializeAsync(string expression)
        {
            Validation.ArgumentNotNull(expression, nameof(expression));

            var factory = new CircularEntityFactory <T>(null, new Dictionary <string, T>());

            return(await DeserializeAsync(expression, factory));
        }
Esempio n. 3
0
 /// <summary>
 /// Deserializes a string expression for the inferred type. This type should contain a "string name" parameter that will come from the expression: "A" + "B"
 /// </summary>
 /// <param name="expression">Expressin as string</param>
 /// <param name="factory">This factory is necessary for the creation of entities. You can inherit this class and add new methods to be used in the string expression: "A" + NewMethod()</param>
 /// <returns>Return a circular entity</returns>
 public T Deserialize(string expression, CircularEntityFactory <T> factory)
 {
     return(DeserializeAsync(expression, factory).Result);
 }