I have a wpf application with multiple pro开发者_运维问答jects. I'm wondering if it's best to have one project that handles all the web services and have each project reference this one project. Is this even possible, or does each project need to handle its own web services?
This is possible and would be a great way to seperate your web services to be used by other parts of your system.
If you create one project that has WCF, ASMX or any other type of service you can add a web service reference to your other projects or hook it all up manually! The individual projects can pass in configuration properties (URLs, or any other pieces of data) or defaults could be set in the web service project itself!
You can absolutely do that! In fact, I'd say it's preferred - that way your single web service project can be re-used by different clients, whether it be WPF, Silverlight, or ASP.NET MVC (using AJAX). For example:
- WebServiceProject
- WpfProject
- SilverlightProject
Projects 2 and 3 would have a Service Reference back to project 1, thus eliminating the need to possibly duplicate data access code.
Here is the MSDN reference page for adding Web References in Visual Studio.
Hope this helps!
精彩评论