Currently I am working on an ERP Project, Using Entity FrameWork and WCF at server side and WPF at client side. Since it is a big project , we have a lot of entities.What we did so far is, Created Service contracts for each Entities and exposed with multiple endpoints.The Problem is we had to add Service Reference for each Service and we are feeling difficult to manage these web services.
1.Is this a proper way ?
if yes,
2.Is there any way to allocate these web services (in classes or folders)..?
Thanks in advance.
You don't want to keep generating the proxy classes in the client.
Just move the POCO classes and contracts to single assembly which you can reference in the server and client. Then create the necessary channels in the client with ChannelFactory.
ChannelFactory(TChannel)
If you are dealing with many services you can create routing service which will behave like facade. Once you have routing service defined then all requests are going to be sent towards routing service and then, based on some criteria, provided to specific service. You are dealing with only one service so if any change in sub-services occures, for instance endpoint's address is altered, then such a change needs to be reflected only in routing service.
Finally i got how to deal with multiple Services
i am considering to use svcutil.exe in order to create proxy classes.
so that we can arrange those classes in folders, and also we can
get more control over proxies
Related
I make use of the SQL Server Reporting Service's web services api to render reports using the ReportExecutionService proxy in an asp.net web application.
My question is: should I be creating a new instance of the ReportExecutionService proxy each time I generate a report, or is using a singleton instance the recommended approach? (eg. for performance reasons, etc).
What wcf bindings you are going to use? In general - you can reuse proxy, and in single-user single thread application it is a good idea.
But singleton is a bad idea in ASP.NET application - by itself proxies are not thread-safe.
Therefore, you can create proxy and cache it on session layer (is one session = one thread, as I remember this is configurable in ASP.NET).
I have an iOS app that currently stores and pulls its data in/from SharePoint lists via a web service. I want to have the option in settings for the app to also use another database or cloud database i.e. parse.com
I don't want to have to put if statements all throughout my code to test whether the app is set up to use either of the repositories.
What's the best way in an iOS app to architect it to use multiple repositories/databases to store and retrieve the data used in the app?
Build a data manager class that handles the logic. I would go so far as to create one for each service you are attaching to. They can all inherit from a single base class and share the local cache code (which I am assuming is Core Data based on your tags). Then on launch you can instantiate the one you want to use.
I would NOT use a Singleton as suggested. Better to use Dependency Injection and be able to tear down and build up a new data manager if you switch between services while your application is running. Using a singleton would be a poor design decision.
If you localize all of your network code into a single class (something I was speaking about last year as a Network Controller) you can then easily switch between services by keeping your interfaces the same.
reading this days about backbone.js (documentation, examples, etc), and as far as i have understood, this framework lets you code directly on the front-end, almost all the back-end engine, since you can structure a MVC architecture. You can create your data model, controllers, etc.
My question is: if you already have the MVC architecture built on the Front-End (engine), you just need a DataBase (SQL) in the cloud from where you can fetch or store data, why do you need a back-end engine (RoR3,Java,etc) to persist document data?
thanks in advance
You are confusing two different meanings of front end, the model in the backbone framework is not able to connect to a database directly, this model are designed to connect to an API (that would be your backend) that is connected to a database
Things you still need to do on the server:
authentication
authorization
data sanitation and filtering
Possiby
interact to third parties
business logic that involves modules other than UI
etc.
Front-End MVC frameworks (Backbone, Angular, etc) all rely on a backend service to provide the data that, say Backbone, would then use as its model.
You could have an entire MVC pattern on the backend that accepts requests and spits out some JSON for a frontend MVC framework to use.
If you just want a database without creating a server, I would recommend using Google FusionTables - but you need OAuth and maybe even ClientLogin (depending) on top of that.
Because as far as I know Backbone works with RESTful services and it needs a server to handle the requests:
get: to list data from the db
post: to add new stuff to the db
put: to update current data
delete: to remove data from the db.
.. and also perform all sorts of server related stuff if you like
For instance I'm using Restful server based on Code Igniter to handle that stuff. From there you can choose the DB you want to work with. I already tried using MySQL and MongoDB
I want to send simple data (geolocation data to be precise) from Windows Phone 7 application to a windows forms application and use it, as I'm a total beginner in this field I don't know which tools to use.
I searched about wcf services and tested this method but there's some issues: the data is sent from the phone application but isn't sent to the winforms application (guess something is missing)
If your know how to do this in a quick way, or have good tutorials I'll be thankful.
EDIT
I found this tutorial, it show how to connect directly wp7 application and desktop application without using sockets neither wcf service, I'm wondering if it is really works if the application isn't in localhost.
the like for the tutorial: wp7 tutorial
I had a similar problem and so I created a REST/JSON WCF service hosted in IIS with AppHarbor to provide the data. There's hundreds of ways to do it (Ruby/Heroku, etc..), but that particular one fits well within the Microsoft stack. I also needed to share route data and I used the WCF service to wrap the BingMaps services so that route computations are cached and shared. Considering that I had already created a local model, moving it out of my phone project into a service took less than a few hours (including the usual config hiccups, and forgetting to add the appharbor user to my bitbucket repo).
Consuming the service from WinForms (or any client) shouldn't be an issue as the service knows nothing about the client implementation.
Here's a tutorial from code project. REST WCF Service with JSON
I think you would need to implement some sort of server side solution which you could upload to on your Windows Phone and download from on your Windows Form application. This could be achieved using a WCF service which was connected to a server side database.
Another option would be to use sockets and communicate directly with your WinForms application. Check this tutorial on how to use basic sockets on WP7.
I'm working on an application that uses WPF and WCF. As it stands now, for each WPF page, a WCF connection is created for that page to use. Is this good practice? Or should I create a Singleton object to contain a WCF connection that's passed around to my pages as needed?
Thanks!
If the connection parameters and various authorization aspects are the same throughout the app, the i'd definitely suggest to use a single connection. Creating different connections might have sense probably when your pages are like browser tabs - they connect to different servers and are basically independent.
Moreover, consider not using the WCF connection in you UI logic at all, create some middle-layer, that gets data via WCF and make your UI independent of where actually the data comes from technically. Your UI logic should work with objects provided by that middle (business) layer.