Presenter:Mike Taulty
WCF services can be singletons, they can be single-call objects or they can have a lifetime that is tied to the session. Let's dive into how we make this work.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
And s session it while the series of sessions which then 10 minutes or so looking at how we can do things with his young net framework minus m Tolkien I work in the developer and platform group in Microsoft in the UK and this is one of a series of sessions about the Windows limitation foundation is a part of Fx which is concerned with building distributed applications and in particular session where they look at how you can make use of different instant singles for the types that you build an expose as WTF services are in average or you are five and working with the September preview or Filofax are built to simple applications in one of the console application and the like so many of the examples in this series it has incredibly simple service contract which just exposes one operation to print messages to the console now announcement about its implementation class
Minute 1
And has the printing of messages to the castle is fairly standard fairly different thing are doing here is we are giving each instance of this class are of his creative it gets its very own instance number as part of dumping the centre console including instance numbers we can see how many of these things being created we have posted this over the service host is redone and the other examples and we ve make this available at the moment over the basic HTTP day with another plan for advice is just a Windows form and what I m delighted it is too in this very basic UI specify a certain number of threads start and running in Scotland running analyst at the running all we do is we just lived through the number of specified strengths and we run this function here on that number of different threats and all these things do is a great instance of the proxy they run around until it told the star
Minute 2
From this particular thread and has to identify themselves this and the thread identifier over to the circus and that it has declined in a circus who is reduced to run these two things that bring up these services are you consort screen and then if we go ahead and run the client to a Cisco run that and bring out onto the screen and volunteers just start was to throw Scotland s originally to be overly ambitious because already tried to see is that as we make these calls across goal from a number of different thread series 3 and 5 and every single call to the service is being answered by a new instance of the object so every single message that goes across that service gets a brand new instance of that object was that cold finished the object is presumably eligible to garbage collection This amateur should at the service
Minute 3
Say that the reason why this is how then is the overrun of service we haven t specified for this class any kind of instant a behaviour and the way we would do that is through the service behaviour attributes and one of the things we can do is control instance and and the available value to got for this per coal per session shareable and single suckler cull the former doing at the moment because every single goal is answered by a new object to is just rich that a single word or all single and mode analysts this is a behaviour of our local implementation and nothing to do the contract doesn t be Council shall wire anything like that and if we rebuild that Andorran rerun
Minute 4
Veterans service and bring our client or five is easily forget his finest red sitting against this is then every single one of those calls will be handled by instance number one the one and only am instance of service type that a service hosted into processing others or you can understand of course if we doing there such a start this thread is over here if we are doing this we need to be pretty careful because this organ can do the whole idea of a multithreading because we potentially have a number of threads wandering through this are single function on the service at the same time in Paisley were okay with that in most cases you have to do is extra work will come back and took were threatening in another session never next month we ve got to play with John Singleton is close
Minute 5
Should everything survive a video session which we talked about in one of his previous nuggets and different kind of it at the moment and to run service will find is that of Alan with the findings and support sessions we need to switch a binding summer is just over a figure client for the same type bindings on the clients argue it is switched basic to US fuel again was configured itself I consideration of specify what that finding looks like once again until it matches a service at Security Austria and on the client side were also going to go ahead
Minute 6
And specify the today s address that the client will listen on superior service and the client listening on HTTP on the client side will go for the overstating 81 client are now in a position where we should able to build and run and begun develop five and a sit with his five hurdles others are running on what we found is that we will see up to five instances of the service type responding to the five threats require 20 was a
Minute 7
Eras are five communications lessons from the client and the service and free for other communication sessions with mark the separate incidents on the server side presented at a shut this down and stop the service when we re saying back in the service code only one per session was only three communications and that the lines opened at the service will crave the new one of these things it will handle the interaction with that one session and when the session goes away and you can look at the details of and the other nugget session and when I session goes away will get rid of the implementation class at that point to us that her session instance in you wouldn t not this one will do shareable man and what it is saying it is just like that her sessions are a climactic or grasses can get his own dedicated instance of this type however what I climb to do with the county and ask for a specific address identifies
Minute 8
One instance in speaking to it can then take them address and share it with some other choir who will then be able to speak to the same instance there is also a way of introducing a friend into conversation in a private conversation gruesomely them and that s really what this is doing inclined to demonstrate that let s go and visit me Here I will do is we ll add a private address and a scoreless son instance addressed to this class pound will have a function that could get address I will pass it one of these proxies all of whose work will just lock for a moment and will so that if the instance addressed is still no
Minute 9
Then we ll asked the proxy to resolve the instance addressed for us or the object it s thinking to and worries and ultimately will return that it is a cheaper way of using one of the proxy is the first one of considering it was and listens to us without delay for doers will change this may cause function as passer and bully into this as a soprano to select pass as a parameter or password accounts divided by two equal zero an hour to and fro every other one of these objects will do something different so what doers will interpret in here whether we should use the instance addressed on art as the parameter passed to us and then if we re going to use the instance addressed them will say that
Minute 10
The proxy address is equal to the results of gas addressed passing that proxy always then is that very other objects or every other thread that goes round the loop half of them are going to share one particular address and the restaurant is individual addresses logistics is obvious by which we can should be I then we should be in business alerts built and let s run the service I must go ahead and on the client and we should see it as we start of the client again has just run up
Minute 11
And if we stock it down again what we would notice it was as the run went through we can see that thread three and thread and I am throughout 12 are all sharing instance and one wearers thread seven is speaking to him to am we have thread town registry includes that I was very some ultimately than that with three instances here while allegedly shared amongst three clients and the other two are each individually servicing to clients so we managed it do that rather congregated scenario there within reflects both fundamentally what the manager do it is by using the resolve incidents core back in the form here by using this resolve is
Minute 12
For organiser is yet the real address one of his live instances and then share it with other friends and allow them to speak to the same instance after service title with victory at fundamental to justice and rivalry soon a short session was in the England thing is all about controlling the lifetime of the type you exposed as a easier service and as for ways of doing it we conduct a call in which case we didn t you object every single time the call comes in we live by the singledom loaded with one object for all the calls and everybody there was a lot of private session which means that will have one object to handle the calls from a particular client would go away when the quangos away and finally the same survey in that share session will recondition out an address in Passat second client which can then make use of the same instance we can share an instant article of clients okay where would
Minute 13
Or if you want to get more information on Windows communication foundation or the best place to start is theMSDN Microsoft com when effects and if you want to find more information about the protocols the Web service open standard protocols of the communication foundation is capable of using a good place to go without the MSDN Microsoft com web services and that particularly we have of the society understanding that a great document that specifies how all these things sit together to make a distribution platform as opposed to just a random set of specifications and finally he won t follow with anything you saw a little session feel free to drop me an e mail on my address is there on the screen is just and healthier Microsoft com the man had very little is that
Click here to go to original video page
Thursday, July 24, 2008
Video: Windows Communication Foundation: Instancing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment