<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8208318962885155485</id><updated>2011-11-28T02:34:53.883+02:00</updated><category term='C#'/><category term='Visual Studio'/><category term='Sql Server Compact'/><category term='Net Framework'/><category term='configuration'/><category term='WCF'/><category term='Database'/><category term='Linq'/><category term='anonymous types'/><category term='Sql Server'/><category term='NHibernate'/><category term='asp.net'/><category term='.net'/><category term='Market Data'/><category term='class library'/><category term='Xmpp'/><category term='Fix'/><category term='Sql Server 2005'/><category term='Entity Framework'/><category term='Add Ins'/><category term='.Net Framework'/><category term='NetTcpBinding'/><category term='Excel'/><title type='text'>Mavritsaki's blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-22742535931925388</id><published>2009-08-19T00:37:00.003+03:00</published><updated>2009-08-19T00:43:53.094+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='anonymous types'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Linq'/><title type='text'>The simplest Month generator with c#, linq and anonymous types!</title><content type='html'>Just come up with a nice solution which i would like to share.&lt;br /&gt;&lt;br /&gt;Lets say you want to generate a list of Month names in order to bind them to a DropDownList in an asp.net page.&lt;br /&gt;&lt;br /&gt;The simplest way i came up with is the following:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;pre style="margin: 0px;"&gt;DropDownListMonth.DataTextField = &lt;span style="color: #a31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;DropDownListMonth.DataValueField = &lt;span style="color: #a31515;"&gt;&amp;quot;Number&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;DropDownListMonth.DataSource = Numbers(1,12).Select(Number=&amp;gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Number,&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = (&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;DateTime&lt;/span&gt;(2000,Number,1)).ToString(&lt;span style="color: #a31515;"&gt;&amp;quot;MMMM&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;});&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;DropDownListMonth.DataBind();&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;int&lt;/span&gt;&amp;gt; Numbers(&lt;span style="color: blue;"&gt;int&lt;/span&gt; from, &lt;span style="color: blue;"&gt;int&lt;/span&gt; to)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt; (&lt;span style="color: blue;"&gt;int&lt;/span&gt; i = from; i &amp;lt;= to; i++)&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;yield&lt;/span&gt; &lt;span style="color: blue;"&gt;return&lt;/span&gt; i;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, Linq and anonymous types rocks!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-22742535931925388?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/22742535931925388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2009/08/simplest-month-generator-with-c-linq.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/22742535931925388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/22742535931925388'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2009/08/simplest-month-generator-with-c-linq.html' title='The simplest Month generator with c#, linq and anonymous types!'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-8807788137756868265</id><published>2009-06-14T12:53:00.005+03:00</published><updated>2009-06-14T14:01:31.288+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='class library'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><title type='text'>.Net Class Library Configuration Files</title><content type='html'>So, you have a .net class library (or any library which has an file extension .dll) or even an executable file (.exe) that you want to reference in an executable.&lt;br /&gt;&lt;br /&gt;In this referenced project you have some configuration settings that you use inside that project but when you run the application you cannot find an easy way to set the settings with the main application (the surrogate app).&lt;br /&gt;&lt;br /&gt;For this there are some ways to do (found on web) which has to do with coding, redirecting application configuration files etc and generally reinventing the wheel.&lt;br /&gt;&lt;br /&gt;The following is the best solution, which I am using in my projects (and it is strange enough that i couldn't find anyone doing that in the net).&lt;br /&gt;&lt;br /&gt;For the demonstration I will be using Visual Studio 2008 (this solution is tested on .Net 2 and .Net 3.5).&lt;br /&gt;&lt;br /&gt;Lets say we have a windows forms application named "MyApp", with the following configuration settings:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_9tm0uwxf10o/SjTSuymmPPI/AAAAAAAAAFM/KBsflyakL-A/s1600-h/1.gif"&gt;&lt;img style="cursor: pointer; width: 394px; height: 101px;" src="http://4.bp.blogspot.com/_9tm0uwxf10o/SjTSuymmPPI/AAAAAAAAAFM/KBsflyakL-A/s400/1.gif" alt="" id="BLOGGER_PHOTO_ID_5347130358895099122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The configuration file of the application should be as follows:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: georgia;font-family:Courier New;font-size:10pt;color:black;"&gt; &lt;div style="background: white none repeat scroll 0% 0%; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;userSettings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyApp.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyApp.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;test1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;serializeAs&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;String&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;                &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;2323&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyApp.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt; &lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;color:blue;"&gt;&lt;span style="color:blue;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;color:blue;"&gt;&lt;span style="font-family: georgia;font-size:130%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Also lets say we have a dll project named "MyClassLibrary",&lt;br /&gt;with the following settings:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;span style="font-family: georgia;font-size:100%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;pre style="margin: 0px; font-family: georgia;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9tm0uwxf10o/SjTTjJCIbRI/AAAAAAAAAFU/mR28rEHJaxI/s1600-h/2.gif"&gt;&lt;img style="cursor: pointer; width: 400px; height: 115px;" src="http://3.bp.blogspot.com/_9tm0uwxf10o/SjTTjJCIbRI/AAAAAAAAAFU/mR28rEHJaxI/s400/2.gif" alt="" id="BLOGGER_PHOTO_ID_5347131258269363474" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: georgia;font-size:100%;" &gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Its configuration file should be as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; &lt;div style="background: white none repeat scroll 0% 0%; font-family: georgia; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;userSettings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyDllProject.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyDllProject.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;ClassLibraryProperty1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;serializeAs&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;String&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;                &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;a property&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyDllProject.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0); font-family: courier new;font-size:130%;" &gt;Now, in order to access the class library's (MyDllProject) settings from for the surrogate project (MyApp) all we have to do is&lt;br /&gt;copy from the class library configuration file the section:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyDllProject.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;font-size:130%;" &gt;And append it into the surrogate's configuration sections as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="background: white none repeat scroll 0% 0%; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;userSettings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyApp.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyDllProject.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyApp.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;test1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;serializeAs&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;String&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;                &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;2323&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyApp.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt; &lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt; &lt;span style="font-family: georgia;font-size:100%;" &gt;&lt;span style="color: rgb(0, 0, 0); font-family: courier new;font-size:100%;" &gt;After that we will copy the sections properties from the class library configuration file into the surrogate's &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: rgb(0, 0, 0); font-family: courier new;font-size:100%;" &gt;configuration file as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;div style="background: white none repeat scroll 0% 0%; font-family: georgia; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;userSettings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyApp.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MyDllProject.Properties.Settings&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;allowExeDefinition&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;MachineToLocalUser&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;requirePermission&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;sectionGroup&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyApp.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;test1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;serializeAs&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;String&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;                &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;2323&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyApp.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyDllProject.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;ClassLibraryProperty1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;serializeAs&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;String&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;                &lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;a property&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;            &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;setting&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;        &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MyDllProject.Properties.Settings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;    &lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;userSettings&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt; &lt;span style="font-family: georgia;font-size:100%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;That's it!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;Now, the dll that is references inside our application will be able to read it's settings from the surrogate's configuration file from its seperate section.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;br /&gt;You can test the previous approach be changing the default settings inside the sections settings and see that when your application runs it will load the settings from the surrogate' file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;I have used this approach for Windows Forms applications and ASP.NET apps and it works perfectly.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-8807788137756868265?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/8807788137756868265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2009/06/net-class-library-configuration-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/8807788137756868265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/8807788137756868265'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2009/06/net-class-library-configuration-files.html' title='.Net Class Library Configuration Files'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_9tm0uwxf10o/SjTSuymmPPI/AAAAAAAAAFM/KBsflyakL-A/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-6519664676456271768</id><published>2009-01-02T00:37:00.007+02:00</published><updated>2009-01-02T00:53:27.236+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Add Ins'/><category scheme='http://www.blogger.com/atom/ns#' term='Net Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>CopySourceAsHtml (CSAH) Visual Sudio Add In</title><content type='html'>For those of us using Visual Studio there are some unique Addins that boost very much the productivity.&lt;br /&gt;One of them is &lt;a style="font-weight: bold;" href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/"&gt;CopySourceAsHtml from Colin Coller&lt;/a&gt; that does exactly what it says,&lt;br /&gt;it copies the source code with formatting included into the clipboard as HTML so that it can be pasted with full formatting.&lt;br /&gt;&lt;br /&gt;I have tested this both in &lt;span style="font-weight: bold;"&gt;Visual Studio 2005&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;2008&lt;/span&gt; and it is working perfect.&lt;br /&gt;&lt;br /&gt;Here are some settings i prefer in order for the output to be perfect.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_9tm0uwxf10o/SV1HlK5YjZI/AAAAAAAAAEM/SDNedBls_SQ/s1600-h/5.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 253px;" src="http://4.bp.blogspot.com/_9tm0uwxf10o/SV1HlK5YjZI/AAAAAAAAAEM/SDNedBls_SQ/s400/5.jpg" alt="" id="BLOGGER_PHOTO_ID_5286460241508601234" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;An example of copy pasting:&lt;br /&gt;Original image:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_9tm0uwxf10o/SV1H_5XpgWI/AAAAAAAAAEU/PG1q4qU934E/s1600-h/6.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 248px;" src="http://4.bp.blogspot.com/_9tm0uwxf10o/SV1H_5XpgWI/AAAAAAAAAEU/PG1q4qU934E/s400/6.jpg" alt="" id="BLOGGER_PHOTO_ID_5286460700660171106" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Pasted html:&lt;br /&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;string&lt;/span&gt; sDirectory = &lt;span style="color: rgb(43, 145, 175);"&gt;Path&lt;/span&gt;.GetDirectoryName(txtFileName.Text);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;string&lt;/span&gt; sFileName = &lt;span style="color: rgb(43, 145, 175);"&gt;Path&lt;/span&gt;.GetFileName(txtFileName.Text);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;string&lt;/span&gt; sNewFilePath = txtFileName.Text+&lt;span style="color: rgb(163, 21, 21);"&gt;"_old"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;                &lt;span style="color: rgb(43, 145, 175);"&gt;File&lt;/span&gt;.Delete(sNewFilePath);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;File&lt;/span&gt;.Move(txtFileName.Text,sNewFilePath);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;SqlCeEngine&lt;/span&gt; eng = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;SqlCeEngine&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"Data Source="&lt;/span&gt; + sNewFilePath);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            eng.Shrink();&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            eng.Verify(&lt;span style="color: rgb(43, 145, 175);"&gt;VerifyOption&lt;/span&gt;.Enhanced);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            eng.Compact(&lt;span style="color: rgb(163, 21, 21);"&gt;"Data Source="&lt;/span&gt; + txtFileName.Text);&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-6519664676456271768?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/6519664676456271768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2009/01/copysourceashtml-csah-visual-sudio-add.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/6519664676456271768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/6519664676456271768'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2009/01/copysourceashtml-csah-visual-sudio-add.html' title='CopySourceAsHtml (CSAH) Visual Sudio Add In'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_9tm0uwxf10o/SV1HlK5YjZI/AAAAAAAAAEM/SDNedBls_SQ/s72-c/5.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-8739874035301955378</id><published>2009-01-01T19:12:00.008+02:00</published><updated>2009-01-07T13:55:37.295+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server Compact'/><category scheme='http://www.blogger.com/atom/ns#' term='NetTcpBinding'/><title type='text'>Reduce Sql Server Compact Database Size</title><content type='html'>In most of the cases, the use of Sql Server Compact edition has to do with a Desktop Application where size of the redistributed data do matter.&lt;br /&gt;Having that in mind, we need a way to reduce the size of the database file, so that deployment procedures (possibly through ClickOnce Deployment)  wont't need to download a huge amount of data.&lt;br /&gt;&lt;br /&gt;As Microsoft states &lt;a href="http://technet.microsoft.com/en-us/library/bb896140.aspx"&gt;here&lt;/a&gt; data Compression on Sql Server Compact is not supported.&lt;br /&gt;&lt;br /&gt;Trying to find an alternate way to reduce the database's size i ended up on these functions that Sql Server Compact engine offers through the &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.compact%28VS.80%29.aspx"&gt;SqlCeEngine&lt;/a&gt; class.&lt;br /&gt;These are the Shrink and the Compact functions.&lt;br /&gt;According to Microsoft:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Shrink&lt;/span&gt;: &lt;span style="font-style: italic;"&gt;Reclaims wasted space in the SQL Server Mobile database by moving empty pages to the end of the file, and then truncating the file. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Compact&lt;/span&gt;:&lt;span style="font-style: italic;"&gt;Reclaims wasted space in the SQL Server Mobile database by creating a new database file from the existing file. This method is also used to change the collating order, encryption, or password settings of the database.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Also:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Unlike the&lt;/span&gt;&lt;span style="font-style: italic;"&gt; &lt;span style="font-weight: bold;"&gt;Compact&lt;/span&gt; method, the &lt;/span&gt;&lt;b style="font-style: italic;"&gt;Shrink&lt;/b&gt;&lt;span style="font-style: italic;"&gt; method does not create a temporary database file. Instead, all empty and unallocated pages are moved to the end of the file and are then truncated, reducing the overall database size.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background: orange none repeat scroll 0% 0%; font-style: italic; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-size:85%;" &gt;One must note though that these functions do not compress data, they will just remove unnecessary space claimed from the database system when querying  or changing database's schema.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Having that in mind here is a snippet of both the functions&lt;br /&gt;&lt;br /&gt;&lt;div    style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;string&lt;/span&gt; sDirectory = &lt;span style="color: rgb(43, 145, 175);"&gt;Path&lt;/span&gt;.GetDirectoryName(txtFileName.Text);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;string&lt;/span&gt; sFileName = &lt;span style="color: rgb(43, 145, 175);"&gt;Path&lt;/span&gt;.GetFileName(txtFileName.Text);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;string&lt;/span&gt; sNewFilePath = txtFileName.Text+&lt;span style="color: rgb(163, 21, 21);"&gt;"_old"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;                &lt;span style="color: rgb(43, 145, 175);"&gt;File&lt;/span&gt;.Delete(sNewFilePath);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color:blue;"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            {&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            }&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;File&lt;/span&gt;.Move(txtFileName.Text,sNewFilePath);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;SqlCeEngine&lt;/span&gt; eng = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;SqlCeEngine&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"Data Source="&lt;/span&gt; + sNewFilePath);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            eng.Shrink();&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            eng.Verify(&lt;span style="color: rgb(43, 145, 175);"&gt;VerifyOption&lt;/span&gt;.Enhanced);&lt;/pre&gt;&lt;pre style="margin: 0px;"&gt;            eng.Compact(&lt;span style="color: rgb(163, 21, 21);"&gt;"Data Source="&lt;/span&gt; + txtFileName.Text);&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-8739874035301955378?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/8739874035301955378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2009/01/reduce-sql-server-compact-database-size.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/8739874035301955378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/8739874035301955378'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2009/01/reduce-sql-server-compact-database-size.html' title='Reduce Sql Server Compact Database Size'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-6896480907334428732</id><published>2009-01-01T13:17:00.012+02:00</published><updated>2009-01-01T19:24:59.224+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>Sql Server 2005 Excel Import Error</title><content type='html'>Today, &lt;span style="font-style: italic;"&gt;the first day of the year&lt;/span&gt;,&lt;br /&gt;unfortunately i am working on a project which needs to import a large amount of data from excel into an Sql Server 2005 database.&lt;br /&gt;&lt;br /&gt;I selected the Sheet i wanted to import ...&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9tm0uwxf10o/SVynwxb0WnI/AAAAAAAAADk/jCujwU7G4e0/s1600-h/Untitled.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 379px;" src="http://2.bp.blogspot.com/_9tm0uwxf10o/SVynwxb0WnI/AAAAAAAAADk/jCujwU7G4e0/s400/Untitled.jpg" alt="" id="BLOGGER_PHOTO_ID_5286284518971693682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And these were the table's mappings ...&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9tm0uwxf10o/SVyoVdzpgBI/AAAAAAAAADs/uA8Er1xSAog/s1600-h/1.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 327px;" src="http://1.bp.blogspot.com/_9tm0uwxf10o/SVyoVdzpgBI/AAAAAAAAADs/uA8Er1xSAog/s400/1.jpg" alt="" id="BLOGGER_PHOTO_ID_5286285149358096402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Notice the Desc field which displays 255 size.&lt;br /&gt;&lt;br /&gt;After that when i tried to finish importing data i got the following errors:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9tm0uwxf10o/SVyo9VT1pyI/AAAAAAAAAD0/qge9AOmQKug/s1600-h/2.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 239px;" src="http://1.bp.blogspot.com/_9tm0uwxf10o/SVyo9VT1pyI/AAAAAAAAAD0/qge9AOmQKug/s400/2.jpg" alt="" id="BLOGGER_PHOTO_ID_5286285834271958818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;Error 0xc020901c: Data Flow Task: There was an error with output column "Desc" (21) on output "Excel Source Output" (9). The column status returned was: "Text was truncated or one or more characters had no match in the target code page.".&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; (SQL Server Import and Export Wizard)&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; &lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Error 0xc020902a: Data Flow Task: The "output column "Desc" (21)" failed because truncation occurred, and the truncation row disposition on "output column "Desc" (21)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; (SQL Server Import and Export Wizard)&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; &lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Error 0xc0047038: Data Flow Task: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Source - Sheet1$" (1) returned error code 0xC020902A.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; (SQL Server Import and Export Wizard)&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; &lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Error 0xc0047021: Data Flow Task: SSIS Error Code DTS_E_THREADFAILED.  Thread "SourceThread0" has exited with error code 0xC0047038.  There may be error messages posted before this with more information on why the thread has exited.&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; (SQL Server Import and Export Wizard)&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; &lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Error 0xc0047039: Data Flow Task: SSIS Error Code DTS_E_THREADCANCELLED.  Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.  There may be error messages posted before this with more information on why the thread was cancelled.&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; (SQL Server Import and Export Wizard)&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; &lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Error 0xc0047021: Data Flow Task: SSIS Error Code DTS_E_THREADFAILED.  Thread "WorkThread0" has exited with error code 0xC0047039.  There may be error messages posted before this with more information on why the thread has exited.&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; (SQL Server Import and Export Wizard)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Trying to figure out the problem i found &lt;a href="http://support.microsoft.com/kb/281517/EN-US/"&gt;this &lt;/a&gt; were Microsoft actually says that when importing data from Excel into Sql Server it checks by default only the first 8 rows of the Excel Sheet.&lt;br /&gt;To change this you have to dig into registry and change the &lt;span style="font-weight: bold;"&gt;TypeGuessRows&lt;/span&gt; key in the path &lt;b&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel&lt;/b&gt;,&lt;br /&gt;as follows ...&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9tm0uwxf10o/SVyq5su240I/AAAAAAAAAD8/nz7Uiqtdg5I/s1600-h/3.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 203px;" src="http://3.bp.blogspot.com/_9tm0uwxf10o/SVyq5su240I/AAAAAAAAAD8/nz7Uiqtdg5I/s400/3.jpg" alt="" id="BLOGGER_PHOTO_ID_5286287970863080258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have changed this value from 8 to 0, which means 16384 rows to scan (if available).&lt;br /&gt;&lt;br /&gt;Be aware, you should notice this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 0, 153);"&gt;"The valid range of values for the &lt;/span&gt;&lt;b style="font-style: italic; color: rgb(0, 0, 153);"&gt;TypeGuessRows&lt;/b&gt;&lt;span style="font-style: italic; color: rgb(0, 0, 153);"&gt; key is 0 to 16. However, if the value is 0, the number of source rows scanned is 16384. Keep in mind that a value of zero may cause a small performance hit if the source file is very large.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;After these changes the mappings now for the over sized column "Desc" have changed to max as seen here ...&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9tm0uwxf10o/SVysSuBqLrI/AAAAAAAAAEE/7qV26lcIalY/s1600-h/4.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 327px;" src="http://3.bp.blogspot.com/_9tm0uwxf10o/SVysSuBqLrI/AAAAAAAAAEE/7qV26lcIalY/s400/4.jpg" alt="" id="BLOGGER_PHOTO_ID_5286289500218732210" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After that the data import worked just fine.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Performance&lt;/span&gt; was indeed&lt;span style="font-weight: bold;"&gt; much worse&lt;/span&gt; as &lt;a href="http://support.microsoft.com/kb/281517/EN-US/"&gt;Microsoft mentioned&lt;/a&gt;, but this is not such a problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-6896480907334428732?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/6896480907334428732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2009/01/sql-server-2005-excell-import-error.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/6896480907334428732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/6896480907334428732'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2009/01/sql-server-2005-excell-import-error.html' title='Sql Server 2005 Excel Import Error'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_9tm0uwxf10o/SVynwxb0WnI/AAAAAAAAADk/jCujwU7G4e0/s72-c/Untitled.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-7447503974882504968</id><published>2008-12-21T11:48:00.009+02:00</published><updated>2009-01-01T19:34:44.291+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='Fix'/><category scheme='http://www.blogger.com/atom/ns#' term='Xmpp'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><category scheme='http://www.blogger.com/atom/ns#' term='NetTcpBinding'/><category scheme='http://www.blogger.com/atom/ns#' term='Market Data'/><title type='text'>Realtime Market Data with WCF NetTcpBinding and Observer Pattern</title><content type='html'>Recently i needed a communication protocol in order to develop a .Net 3.5 windows forms Market Data Hybrid Client/Server system model, where using the Publish/Subscribe model (&lt;a href="http://en.wikipedia.org/wiki/Observer_pattern"&gt;Observer pattern&lt;/a&gt;) the client would subscribe to real time feeds on the server and the server would update the client with these feeds real time-no delay which should travel back to the client with rapid speed.&lt;br /&gt;&lt;br /&gt;For this i ended up using for the communication model WCF with &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.nettcpbinding.aspx"&gt;NetTcpBinding&lt;/a&gt;,&lt;br /&gt;&lt;ul&gt;&lt;li&gt;session-full (based on the TCP's session, if the session drops then subscription is aborted, no need to retain a virtual session though pooling),&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;multi threaded (no build in synchronization so that the server response would have light speed),&lt;br /&gt;&lt;/li&gt;&lt;li&gt;not Order (problematic for distributed environments),&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;not Secured (didn't need that)&lt;/li&gt;&lt;/ul&gt;and for the client i used &lt;a href="http://www.janusys.com/controls/"&gt;Janus Systems Controls&lt;/a&gt; (the feeds was projected into a Janus GridEx for windows forms).&lt;br /&gt;&lt;br /&gt;Starting this project i had many qualms regarding the use of Wcf &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.nettcpbinding.aspx"&gt;NetTcpBinding&lt;/a&gt; over Internet as from what &lt;a href="http://webmail.ibg.gr/exchweb/bin/redir.asp?URL=http://msdn.microsoft.com/en-us/library/bb875951.aspx"&gt;&lt;span style="font-style: italic;"&gt;microsoft says&lt;/span&gt;&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"In Windows only intranet environment and when all the service clients are WCF clients, the service can be deployed with the NetTCPBinding and Transport level security for achieving  maximum performance. NetTCPBinding by default uses transport level security over a TCP channel along with binary message encoding. In a Windows only intranet environment, ClientCredentialType can be set to Windows to enable Windows authentication."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"For a WCF service &lt;b&gt;that has to be exposed over internet&lt;/b&gt; or deployed in a heterogeneous environment and needs to potentially interact with the clients on non-windows platforms, &lt;b&gt;BasicHttpBinding or WSHttpBinding&lt;/b&gt; can be used depending upon the level of conformance required with the commonly used security standards."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.wshttpbinding.aspx"&gt;WSHttpBinding &lt;/a&gt;couldn't satisfy my needs for performance and NetTcpBinding couldn't satisfy my needs for stability.&lt;br /&gt;&lt;br /&gt;Other thoughts i had was:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;To use &lt;a href="http://www.jabber.org/web/Main_Page"&gt;Xmpp (jabber)&lt;/a&gt; protocol with the build in support for publish/subscribe functionality (&lt;a href="http://xmpp.org/extensions/"&gt;XEP-0060&lt;/a&gt;), the very good wrapper from &lt;a href="http://www.ag-software.de/index.php?page=agsxmpp-sdk"&gt;agsXMPP SDK&lt;/a&gt; and the best &lt;a href="http://en.wikipedia.org/wiki/List_of_Jabber_server_software"&gt;Xmpp Server&lt;/a&gt; from &lt;a href="http://www.igniterealtime.org/projects/openfire/index.jsp"&gt;ignite realtime openfire&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;To use &lt;a href="http://www.fixprotocol.org/specifications/fix4.2spec"&gt;Fix 4.2 protocol&lt;/a&gt; with the add on of &lt;a href="http://www.onixs.biz/FIXEngines/fast.php"&gt;FAST&lt;/a&gt; which advances performance and the engine of &lt;a href="http://www.onixs.biz/"&gt;Onix Solutions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;To develop a proprietary protocol based on plain TCP/IP and many cups of frape!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Xmpp was a good and mature solution and although it is very well used in communication systems it is just trying to enter the group of financial applications. The XML perspective it has also would be a big problem. One other problem would raise from my "Hybrid" need, that is although the system basically would be "Client/Server" sometimes i needed Client Clustering so that groups of clients would be server by an auto configured local server ( hierarchical structure) and this leads to clients being servers too. In that case i would use a different central xmpp server and different sub-servers (it would be impossible to use openfire as a middle server).&lt;br /&gt;&lt;br /&gt;Fix protocol would be a good solution too but extensibility was one concern of mine as also the "Hybrid" needs i mentioned before.&lt;br /&gt;&lt;br /&gt;Proprietary protocols are very good as long as you have a good stomach and mine couldn't stand overnight drinking coffee and smoking.&lt;br /&gt;&lt;br /&gt;Finally i gave a chance to NetTcpBinding with my&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;fingers crossed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After some moths of the system being released i have to admit that NetTcpBinding is working just fine with no drops and very good transfer rates (real time updates).&lt;br /&gt;&lt;br /&gt;Currently my only problem is Janus GridEx performance as for real time updates their Grid is using the most of the processor time and there is no way you can avoid that, except if timing the updates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-7447503974882504968?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/7447503974882504968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2008/12/realtime-market-data-with-wcf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/7447503974882504968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/7447503974882504968'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2008/12/realtime-market-data-with-wcf.html' title='Realtime Market Data with WCF NetTcpBinding and Observer Pattern'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8208318962885155485.post-8435807331595842779</id><published>2008-12-21T10:56:00.009+02:00</published><updated>2009-01-01T19:35:16.512+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.Net Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='NHibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server Compact'/><category scheme='http://www.blogger.com/atom/ns#' term='Linq'/><category scheme='http://www.blogger.com/atom/ns#' term='Entity Framework'/><title type='text'>Sql Server Compact 3.5 Sp1 with Entity Framework</title><content type='html'>Writing for C# and .Net Framework 3.5, recently i needed a local database for a Desktop Application.&lt;br /&gt;&lt;br /&gt;I tried to figure out which Database system is best for my case.&lt;br /&gt;My needs was a small footprint database system with good interaction with Visual Studio or with good Tools which should have a .Net Sql provider and it would be Free or cost minimum.&lt;br /&gt;There was a good article (i will update here when i find it again) referring&lt;br /&gt;Sql Server Compact (CE),&lt;br /&gt;Sql Server Express,&lt;br /&gt;Vista DB,&lt;br /&gt;Firebird,&lt;br /&gt;SqlClient and more.&lt;br /&gt;&lt;br /&gt;I ended to the 2 Microsoft's database systems, Sql Server Compact and Sql Express.&lt;br /&gt;There is a &lt;a href="http://download.microsoft.com/download/A/4/7/A47B7B0E-976D-4F49-B15D-F02ADE638EBE/Compact_Express_Comparison.doc"&gt;good article &lt;/a&gt;(MS Word Document) from MSDN comparing these two database systems.&lt;br /&gt;&lt;br /&gt;After reading that too i ended up to the Sql Server Compact as it runs in process with my desktop app, it uses a small memory footprint, it does not need an installation procedure (X-Copy) and it seems fast enough for my needs.&lt;br /&gt;One think it doesn't have is stored procedures and views.&lt;br /&gt;As i needed a factor of abstraction into my database system i searched for some DAL (&lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping"&gt;OR/M&lt;/a&gt;) components to sit on top of my Database.&lt;br /&gt;Currently there are these three choices:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx"&gt;LINQ to SQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb399572.aspx"&gt;Entity Framework&lt;/a&gt; and &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.hibernate.org/343.html"&gt;NHibernate&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;NHibernate seems to be a good solution and compared to Entity Framework it is more mature, but for me being a Microsoft lover (&lt;a href="http://blogs.msdn.com/dsimmons/archive/2008/05/17/why-use-the-entity-framework.aspx"&gt;Why use the Entity Framework?&lt;/a&gt;), i preferred  to give a chance to Entity Framework with the add on of the Linq queries i like very much.&lt;br /&gt;Linq to Sql seems more like a "Queries simplifier" to me than a real OR/M system.&lt;br /&gt;&lt;br /&gt;So, i ended up using Sql Server Compact with Entity Framework and Linq queries.&lt;br /&gt;Trying to harness these beasts the following links seemed most useful to me:&lt;br /&gt;&lt;br /&gt;Regarding Sql Server Compact&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blogs.msdn.com/stevelasker/default.aspx"&gt;Steve Lasker's Web Log&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.windows-tech.info/15/cdd16670fdb83520.php"&gt;Renaming tables&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeplex.com/ExportSqlCE"&gt;Exporting Database as script&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://erikej.blogspot.com/2008/10/accessing-sql-compact-from-sql-server.html"&gt;Accessing SQL Compact from SQL Server "Linked Server"&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blogs.msdn.com/matt/archive/2008/09/26/sql-ce-3-5-with-linq-to-sql-revisited.aspx"&gt;Multithreaded Sql Server Compact&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Regarding Entity Framework:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blogs.msdn.com/dsimmons/pages/entity-framework-faq.aspx"&gt;Entity Framework FAQ&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blogs.msdn.com/smartclientdata/archive/2005/08/26/456886.aspx"&gt;The problemativ |Data Directory| feature&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blogs.msdn.com/adonet/archive/2008/03/27/ado-net-entity-framework-performance-comparison.aspx"&gt;ADO.NET Entity Framework Performance Comparison&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blogs.teamb.com/craigstuntz/2008/07/17/37825/"&gt;The ADO.NET Entity Framework vs. NHibernate and Other ORMs&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8208318962885155485-8435807331595842779?l=mavritsakis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavritsakis.blogspot.com/feeds/8435807331595842779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavritsakis.blogspot.com/2008/12/sql-server-compact-35-sp1-with-entity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/8435807331595842779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8208318962885155485/posts/default/8435807331595842779'/><link rel='alternate' type='text/html' href='http://mavritsakis.blogspot.com/2008/12/sql-server-compact-35-sp1-with-entity.html' title='Sql Server Compact 3.5 Sp1 with Entity Framework'/><author><name>George Mavritsakis</name><uri>http://www.blogger.com/profile/08647986970549250084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_9tm0uwxf10o/SU1RY3XQzPI/AAAAAAAAAAM/UqgDSDYmvcc/S220/DSC00532.JPG'/></author><thr:total>0</thr:total></entry></feed>
