<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx</link><description>Occasionally the question of whether to use the TeamFoundationServerFactory . GetServer() method or the TeamFoundationServer constructor comes up, and someone recently asked this question on an internal list. The answer depends on the needs of the application</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#755355</link><pubDate>Fri, 15 Sep 2006 08:52:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:755355</guid><dc:creator>curedone</dc:creator><description>Buck,&lt;br&gt;&lt;br&gt;Could you clarify something for me? Let's say I use TeamFoundationServerFactory GetServer method several time with same URL. Does the internal caching result in &amp;quot;same&amp;quot; object returned? &lt;br&gt;&lt;br&gt;For example, if I retrieve VersionControlServer using GetService method of TeamFoundationServer (first instance), and then hook up on VersionControlServer event, does that mean that VersionControlServer from second instance of TeamFoundationServer will have that event hook already in place?&lt;br&gt;&lt;br&gt;Here is some pseudo code (wont compile :):&lt;br&gt;&lt;br&gt;// first place&lt;br&gt;tfs1 = TeamFoundationServerFactory.GetServer(url);&lt;br&gt;vc1 = tfs1.GetService();&lt;br&gt;vc1.NewPendingChange += event1;&lt;br&gt;&lt;br&gt;// second place&lt;br&gt;tfs2 = TeamFoundationServerFactory.GetServer(url);&lt;br&gt;vc2 = tfs2.GetService();&lt;br&gt;vc2.NewPendingChange += event1;&lt;br&gt;&lt;br&gt;Thanks.</description></item><item><title>re: TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#755895</link><pubDate>Fri, 15 Sep 2006 16:05:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:755895</guid><dc:creator>buckh</dc:creator><description>Yes, that is correct. &amp;nbsp;So long as the url is the same, the same TFS object is returned, and the event handler shown in your code will already have been added (vc2 and vc1 reference the same VersionControlServer object).&lt;br&gt;&lt;br&gt;Note that it's literally requires the URL to match to get the same object. &amp;nbsp;If you provide an URL using the name and then specify an URL using the IP address, you won't get the same object.&lt;br&gt;&lt;br&gt;Buck</description></item><item><title>VSTS Links - 09/15/2006</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#755908</link><pubDate>Fri, 15 Sep 2006 16:10:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:755908</guid><dc:creator>Team System News</dc:creator><description>D'Arcy Lussier on Storyboarding for Team System. Rob Caron talks about it as well.&lt;br&gt;&lt;br&gt;Tan on Customizing...</description></item><item><title>WorkItemTracking object model primer</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#756171</link><pubDate>Fri, 15 Sep 2006 19:44:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:756171</guid><dc:creator>Naren's Blog</dc:creator><description>For those who never used work item tracking object model and want to start:&amp;amp;amp;nbsp;I saw a nice post that...</description></item><item><title>re: TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#756384</link><pubDate>Fri, 15 Sep 2006 22:22:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:756384</guid><dc:creator>Ravi Terala</dc:creator><description>I recommand the obtaining services from TFS OM for all services except the WorkItemStore. It is not thread safe, where as all other services you obtain from TFS OM are. To work around this issue, create a new WorkItemStore object and pass the credentials that you get from the TFS OM.</description></item><item><title>re: TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#761489</link><pubDate>Tue, 19 Sep 2006 06:22:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:761489</guid><dc:creator>buckh</dc:creator><description>Ravi, while that may be true (I don't remember -- there were changes made to address at least some of the issues), it only matters when making calls from multiple threads. &amp;nbsp;Folks writing single-threaded apps certainly don't have to worry about it and can get the WorkItemStore object via the usual TeamFoundationServer.GetService() method.&lt;br&gt;&lt;br&gt;Buck</description></item><item><title>re: TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#9931013</link><pubDate>Tue, 01 Dec 2009 19:22:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931013</guid><dc:creator>J Sawyer</dc:creator><description>&lt;p&gt;Don't call Dispose() on the TeamFoundationServer object that you get from the TeamFoundationServerFactory. Because it's the same instance for each URL, this will result in the cached instance being disposed and causing some mysterious errors; any call to GetService() will raise a NullReferenceException. There don't seem to be any checks in the TFS object to see if it has been disposed so it won't throw an ObjectDisposedException. &lt;/p&gt;
</description></item><item><title>re: TFS API: How to choose between TeamFoundationServerFactory.GetServer()  and the TeamFoundationServer constructor</title><link>http://blogs.msdn.com/buckh/archive/2006/09/14/factory-vs-constructor.aspx#9931243</link><pubDate>Wed, 02 Dec 2009 04:23:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931243</guid><dc:creator>buckh</dc:creator><description>&lt;p&gt;J Sawyer, yes, that is a good point.&lt;/p&gt;
&lt;p&gt;Buck&lt;/p&gt;
</description></item></channel></rss>