예제 #1
0
		public RemoteProvider(WebHttpClient<IQueryService> client)
		{
			this.client = client;
			this.visitor = new StripQuoteVisitor();
			this.resolver = new TypeResolver(assemblies: null, knownTypes: client.knownTypes ?? new Type[0]);
			CustomExpressionXmlConverter queryconverter = new QueryExpressionXmlConverter(creator: null, resolver: resolver);
			CustomExpressionXmlConverter knowntypeconverter = new KnownTypeExpressionXmlConverter(resolver);			
			this.serializer = new ExpressionSerializer(resolver, new CustomExpressionXmlConverter[] { queryconverter, knowntypeconverter });
		}
        public RemoteProvider(WebHttpClient <IQueryService> client)
        {
            this.client = client;
            visitor     = new StripQuoteVisitor();
            resolver    = new TypeResolver(null, client.knownTypes ?? new Type[0]);
            CustomExpressionXmlConverter queryconverter     = new QueryExpressionXmlConverter(null, resolver);
            CustomExpressionXmlConverter knowntypeconverter = new KnownTypeExpressionXmlConverter(resolver);

            serializer = new ExpressionSerializer(resolver, new[] { queryconverter, knowntypeconverter });
        }
예제 #3
0
		static ExpressionSerializer CreateSerializer()
		{
			var assemblies = new Assembly[] { typeof(Customer).Assembly, typeof(ExpressionType).Assembly, typeof(IQueryable).Assembly };
			var resolver = new TypeResolver(assemblies, new Type[] 
			{ 
				typeof(Customer), typeof(Order), typeof(Product), 
				typeof(Supplier), typeof(Shipper) 
			});
			//var creator = new QueryCreator();
			CustomExpressionXmlConverter queryconverter = new QueryExpressionXmlConverter(creator: null, resolver: resolver);
			CustomExpressionXmlConverter knowntypeconverter = new KnownTypeExpressionXmlConverter(resolver);
			ExpressionSerializer serializer = new ExpressionSerializer(resolver, new CustomExpressionXmlConverter[] { queryconverter, knowntypeconverter });
			return serializer;
			//ExpressionSerializer serializer = new ExpressionSerializer()
		}
		public NorthwindService()
		{
			var connectionStrings = System.Configuration.ConfigurationManager.ConnectionStrings;
			this.connectionString = connectionStrings["northwind"].ConnectionString;
			this.creator = new QueryCreator(this.FnGetDatabaseObjects);
			this.assemblies = new Assembly[] { typeof(Customer).Assembly, typeof(ExpressionType).Assembly, typeof(IQueryable).Assembly };
			this.resolver = new TypeResolver(assemblies, new Type[] 
			{ 
				typeof(Customer), typeof(Order), typeof(Product), 
				typeof(Supplier), typeof(Shipper) 
			});			
			CustomExpressionXmlConverter queryconverter = new QueryExpressionXmlConverter(creator, this.resolver);
			CustomExpressionXmlConverter knowntypeconverter = new KnownTypeExpressionXmlConverter(this.resolver);
			this.serializer = new ExpressionSerializer(resolver, new CustomExpressionXmlConverter[] { queryconverter, knowntypeconverter });			
		}
예제 #5
0
        private static ExpressionSerializer CreateSerializer(IEnumerable <Type> knownTypes = null)
        {
            if (knownTypes == null || !knownTypes.Any())
            {
                return(new ExpressionSerializer());
            }
            var assemblies = new List <Assembly> {
                typeof(ExpressionType).Assembly, typeof(IQueryable).Assembly
            };

            knownTypes.ToList().ForEach(type => assemblies.Add(type.Assembly));
            var resolver           = new TypeResolver(assemblies, knownTypes);
            var knownTypeConverter = new KnownTypeExpressionXmlConverter(resolver);
            var serializer         = new ExpressionSerializer(resolver, new CustomExpressionXmlConverter[] { knownTypeConverter });

            return(serializer);
        }