<?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:blogger='http://schemas.google.com/blogger/2008' 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-3455888999808240896</id><updated>2026-08-31T09:25:08.378+01:00</updated><category term="running"/><category term="C#"/><category term="marathon"/><category term="Entity Framework"/><category term="MVC"/><category term="clyde stride"/><category term="clyde walkway"/><category term="Ajax"/><category term="MongoDb"/><category term="SQL Server"/><category term="404"/><category term="Exception"/><category term="Garmin"/><category term="Intellipad"/><category term="JQuery"/><category term="MVC MVC3 Ajax RenderAction"/><category term="MVC Validation"/><category term="MVC3"/><category term="MVC3 Ajax Themes"/><category term="MVC3 MVC"/><category term="Node.js"/><category term="Oslo"/><category term="Task"/><category term="Temp Tables"/><category term="Triathlon"/><category term="TypeScript"/><category term="Umbraco"/><category term="WSE"/><category term="WSE 2010"/><category term="WSE 2012"/><category term="Woff"/><category term="cooking"/><category term="crystal reports"/><category term="cycle Clyde tunnel"/><category term="forerunner 305"/><category term="gps"/><category term="heart rate monitor"/><category term="reporting Services"/><title type='text'>Run Dev Run</title><subtitle type='html'>Frank the C# Developer that Runs and Bikes.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>67</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-4427923708378031818</id><published>2017-02-22T11:17:00.000+00:00</published><updated>2017-02-22T11:17:56.455+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="404"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="Umbraco"/><category scheme="http://www.blogger.com/atom/ns#" term="Woff"/><title type='text'>404 Not Loading Woff on Azure WebApp gett</title><content type='html'>Came across this with an Umbraco site where fonts and other assets where not getting loaded as expected. The path is correct and still not getting loaded.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Add this to Web.Config under the&amp;nbsp;&lt;system .webserver=&quot;&quot;&gt;&lt;/system&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;staticcontent&gt;&lt;/staticcontent&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;remove fileextension=&quot;.woff&quot;&gt;&lt;/remove&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;remove fileextension=&quot;.woff2&quot;&gt;&lt;/remove&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;mimemap fileextension=&quot;.woff&quot; mimetype=&quot;application/x-font-woff&quot;&gt;&lt;/mimemap&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;mimemap fileextension=&quot;.woff2&quot; font=&quot;&quot; mimetype=&quot;application/x-font-woff2&quot; nbsp=&quot;&quot;&gt;&lt;/mimemap&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Azure WebApp Quirk: &lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;Restart the WebApp&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Even though I did a deployment ,manual hack &amp;nbsp;of the web.config to test stuff it still refused find the Woff files. The deployment and the manual changing of the Web.Config should in traditional IIS restarted the app pool and reloaded the whole app. &amp;nbsp;Even hacking the web.config so it brought down the app with 500 &amp;nbsp;errors and changing it back still didn&#39;t fix it. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Only restarting the web app worked. &amp;nbsp;Burned an hour on a trivial fix.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/4427923708378031818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2017/02/404-not-loading-woff-on-azure-webapp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/4427923708378031818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/4427923708378031818'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2017/02/404-not-loading-woff-on-azure-webapp.html' title='404 Not Loading Woff on Azure WebApp gett'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-3166477709854221779</id><published>2017-01-17T14:37:00.001+00:00</published><updated>2017-01-17T14:37:11.344+00:00</updated><title type='text'>Umbraco 7.X  Get Prevalues from NodeId and Property Alias </title><content type='html'>&lt;br /&gt;
Prevalues are where you can store configuration details you may want to use in backend code, such as url for a particular service etc....&lt;br /&gt;
&lt;br /&gt;
Well this is how to get the Prevalues in C#.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;var node = ApplicationContext.Services.ContentService.GetById(nodeId);&lt;/pre&gt;
&lt;pre&gt;var propertyTypeTextExtractor = node.PropertyTypes.First(x =&amp;gt; x.PropertyEditorAlias == &quot;MyAlias&quot;);&lt;/pre&gt;
&lt;pre&gt;int DataTypeID = propertyTypeTextExtractor.DataTypeDefinitionId;&lt;/pre&gt;
&lt;pre&gt;XPathNodeIterator preValueIterator = umbraco.library.GetPreValues(DataTypeID);&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/3166477709854221779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2017/01/umbraco-7x-get-prevalues-from-nodeid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/3166477709854221779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/3166477709854221779'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2017/01/umbraco-7x-get-prevalues-from-nodeid.html' title='Umbraco 7.X  Get Prevalues from NodeId and Property Alias '/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-8341404787762479348</id><published>2016-02-01T13:01:00.001+00:00</published><updated>2016-02-01T13:03:21.679+00:00</updated><title type='text'>Start and Stop Windows Services on Visual Studio Build.</title><content type='html'>&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you have a windows service it is handle to get Visual Studio build to stop the service before build then restart it after it completes the build.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;b&gt;Setup your service&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
run this from an admin dos command prompt&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;sc.exe create myService binpath= &quot;C:\services\MyService.exe&quot; DisplayName= MyService&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Pre-Build Event&lt;/b&gt;&lt;br /&gt;
Its in the project properties in Visual Studio, Build Events tab.&lt;br /&gt;
&lt;br /&gt;
This will stop the service.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;set svcname=MyService&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;net stop %svcname%&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;EXIT 0&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Post-Build&lt;/b&gt;&lt;br /&gt;
Its in the project properties in Visual Studio, Build Events tab.&lt;br /&gt;
&lt;br /&gt;
This copy the files built and start the service. Will also create the c:\services directory if it doesn&#39;t exist.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;IF NOT EXIST &quot;C:\services&quot; MD &quot;C:\services\&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;attrib -r &quot;C:\services\*.*&quot; /s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;:while1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;Copy &quot;$(TargetDir)*.*&quot; &quot;C:\services&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;IF ERRORLEVEL 1 goto :while1&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;To Debug The service&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Attach to the process number (PID) in the Services Tab in Windows Task Manager I&#39;ve found to be the easiest way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/8341404787762479348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2016/02/start-and-stop-windows-services-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/8341404787762479348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/8341404787762479348'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2016/02/start-and-stop-windows-services-on.html' title='Start and Stop Windows Services on Visual Studio Build.'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-7800668060330707762</id><published>2015-12-16T11:51:00.000+00:00</published><updated>2016-02-05T12:01:52.739+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Exception"/><category scheme="http://www.blogger.com/atom/ns#" term="Task"/><title type='text'>C# Handle Exceptions on TASK </title><content type='html'>Tasks are great, run stuff in the background and let the UI without any bad freezing or usual problems with calling webservices or intensive tasks.&lt;br /&gt;
&lt;br /&gt;
But Handling exceptions in called Task is easy enough when you know how&lt;br /&gt;
&lt;br /&gt;
The Key is looking at the &lt;b&gt;Task.IsFaulted&lt;/b&gt;&amp;nbsp;bool.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Task.IsFaulted&lt;/b&gt;&amp;nbsp; is true : &amp;nbsp; &amp;nbsp;The task was ended on an exception.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Task.IsFaulted&lt;/b&gt;&amp;nbsp; is false: &amp;nbsp; &amp;nbsp;The task was ended normally (no exception)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Exceptions Returned by Task&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The exceptions are returned as a collection, the top exception is fairly useless and you have look at the innerException to find the real cause for the issue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What if I don&#39;t handle Exceptions&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Well!! you code will run as the Task was run successfully and your calling layer/ui may be in a state that is less than ideal and your application may stop working and it may (read will) &amp;nbsp;take a long time for you to find out or debug the exact issue. &amp;nbsp;Tasks without exception handling are black holes waiting to happen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;CODE&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; // Run Stuff in BackGround
 Task.Factory.StartNew(() =&amp;gt;;
 {
     //Do this in the background
      SomeIntensiveJob();
                
  }).ContinueWith(task =&amp;gt;;
   {
     //Check to see if there was a exception on the task handle it.
     if (task.IsFaulted)
      {
        string exMessage = &quot;unknown error&quot;;
        string exStack = &quot;unknow Exception is null&quot;;

        if (task.Exception != null)
         {
                       
          //Log all the Exceptions (maybe lots)
          foreach (var ex in task.Exception.InnerExceptions)
          {
             exMessage = ex.Message;
             exStack = ex.StackTrace;
             string errlog = $&quot;Stuff , Exception : {exMessage} ,  Stack :  {exStack} &quot;;
             og(errlog);
           }

         }

       //Update Your UI here with Errors
       Label.Text = $&quot;Error on stuff {exMessage}, with stack {exStack}&quot;;
       return; // exit on error 
  } //////////////////////////  end exception handling ///////////////////////////////////

  // do this on the UI thread once the task has finished..
  // The task has completed without any issues so do your stuff
  runPostTaksStuff();

 }, System.Threading.CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

&lt;/code&gt;&lt;/pre&gt;
&lt;code&gt;
&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/7800668060330707762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2015/12/c-handle-exceptions-on-task.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7800668060330707762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7800668060330707762'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2015/12/c-handle-exceptions-on-task.html' title='C# Handle Exceptions on TASK '/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-1148149030976380107</id><published>2015-11-19T10:56:00.002+00:00</published><updated>2015-11-19T10:56:35.693+00:00</updated><title type='text'>C# WPF Window to be Dialogue to Win32 </title><content type='html'>&lt;br /&gt;
&lt;b&gt;The Windows Form Method&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is how its done on Windows Forms forms, fairly straight forward.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;b&gt;//apphandle &amp;nbsp;is the application handle for your Win32 application&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;IntPtr windowHandle = new IntPtr(Convert.ToInt32(apphandle));&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;WindowHandleWrapper windowWrapper = new WindowHandleWrapper(windowHandle);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;MyWinForm = new MyForm();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;MyWinForm.ShowDialog(windowWrapper);&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;But WPF forms don&#39;t support&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;public DialogResult ShowDialog(IWin32Window owner);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Doing this for WPF Forms&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You do this by setting the owner of the WPF window/form.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;b&gt;//&amp;nbsp;&lt;/b&gt;&lt;b&gt;apphandle &amp;nbsp;is the application handle for&amp;nbsp;your Win32 application&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;IntPtr&amp;nbsp;FormHandle&amp;nbsp;= new IntPtr(Convert.ToInt32(apphandle));&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: #660000;&quot;&gt;// Create new WPF Form&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;var app = new MyWpfWindow();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: #660000;&quot;&gt;// New Helper&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;var helper = new WindowInteropHelper(app);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;b&gt;// Point the FormHandle to owner of the&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;helper.Owner = FormHandle;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;app.ShowDialog();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
Easy eh ? &amp;nbsp;&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/1148149030976380107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2015/11/c-wpf-window-to-be-dialogue-to-win32.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/1148149030976380107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/1148149030976380107'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2015/11/c-wpf-window-to-be-dialogue-to-win32.html' title='C# WPF Window to be Dialogue to Win32 '/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-5809566965325561914</id><published>2015-06-24T12:40:00.000+01:00</published><updated>2015-06-24T12:40:11.837+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Getting Non Escaped Double Quotes in Strings </title><content type='html'>&lt;br /&gt;
I discovered this today by sheer chance and trying it will trying to build some dynamic Oracle scripts I was building.&lt;br /&gt;
&lt;br /&gt;
Use single quotes in a StringBuilder to enclose a double quote &amp;nbsp;Single&lt;b&gt;Double&lt;/b&gt;Single : &lt;span style=&quot;font-size: x-large;&quot;&gt;&amp;nbsp;&#39;&quot;&#39;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;StringBuilder sb = new StringBuilder();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var col = &quot;NameCol&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sb.Append(&#39;&quot;&#39; + col + &#39;&quot;&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sb.Append(&quot; = @NAME &quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So easy when you know how!&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/5809566965325561914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2015/06/getting-non-escaped-double-quotes-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/5809566965325561914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/5809566965325561914'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2015/06/getting-non-escaped-double-quotes-in.html' title='Getting Non Escaped Double Quotes in Strings '/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-8368824020104156366</id><published>2015-05-15T15:32:00.003+01:00</published><updated>2015-05-15T15:32:57.665+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Persist Server side Object Between PostBacks on ASP.NET</title><content type='html'>This is handy if you want a collection to persist between postback, good for general prototyping or testing.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Set the Item to static as shown below.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private &lt;b style=&quot;background-color: yellow;&quot;&gt;static &lt;/b&gt;MyData &amp;nbsp;DAL { get; set; }&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (IsPostBack)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DAL = new MyData();&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; grid1.DataSource = DAL.Customers;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; grid1.DataBind();&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/8368824020104156366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2015/05/persist-server-side-object-between.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/8368824020104156366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/8368824020104156366'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2015/05/persist-server-side-object-between.html' title='Persist Server side Object Between PostBacks on ASP.NET'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-490108504651327550</id><published>2015-04-20T09:43:00.002+01:00</published><updated>2015-04-20T09:44:34.892+01:00</updated><title type='text'>Telerik RadSpell Stop Spell Dialogue from Moving</title><content type='html'>&lt;h2&gt;
Problem&lt;/h2&gt;
This control (and other in Telerik) control set have a quirk that on dialogue drop it enables all other iframes. So if you have a hidden iframe or dialogue then this will pop up as visible. &lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
What it should really do is only enable items that are not hidden before it starts the drag.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The drag is not limited so it can be dragged off your application&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;br /&gt;Stop the Drag&lt;/h2&gt;
&lt;div&gt;
To stop the drag do this.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; $(&#39;.rwTitlebar&#39;).prop(&quot;disabled&quot;, true);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/490108504651327550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2015/04/telerik-radspell-stop-spell-dialogue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/490108504651327550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/490108504651327550'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2015/04/telerik-radspell-stop-spell-dialogue.html' title='Telerik RadSpell Stop Spell Dialogue from Moving'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-1751940136002690505</id><published>2015-02-23T21:14:00.001+00:00</published><updated>2015-02-23T21:14:15.962+00:00</updated><title type='text'>Raspberry PI Snappy Unbuntu Username and Password</title><content type='html'>&lt;br /&gt;
&lt;h2&gt;
OK What is it???&lt;/h2&gt;
&lt;br /&gt;
I&#39;m sure its not a big secret but it seems so when you look for it.&lt;br /&gt;
&lt;br /&gt;
Username : unbuntu&lt;br /&gt;
password:&amp;nbsp;&amp;nbsp; unbuntu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is not&amp;nbsp; pi / raspberry that for Raspbian.&lt;br /&gt;
&lt;br /&gt;
I&#39;m really only waiting for the Windows 10 core to be released....</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/1751940136002690505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2015/02/raspberry-pi-snappy-unbuntu-username.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/1751940136002690505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/1751940136002690505'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2015/02/raspberry-pi-snappy-unbuntu-username.html' title='Raspberry PI Snappy Unbuntu Username and Password'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-3972406497800959965</id><published>2014-10-20T23:45:00.002+01:00</published><updated>2014-10-21T20:24:44.875+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Classic Developer mistakes that makes applications slow down</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
So you write a system or inherit a system from a previous incumbent that has long since fled and things are doing fine. The system runs and there are a few small issues but nothing serious, but as the systems beds in and ages things start to slow down. The test system is fine but the live system gets slower and slower until it starts to break. Managers are in a rage users are mutterings and you are pulling your hair out. Servers get upgraded and things are fine again, for a while. Then after a while things start to slow again and you start a cycle of server upgrades.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Below is a list of Common issues that make code go slow.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
VLO : &amp;nbsp;Very Large Objects&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
VLO is quite common in my experience where a objects (C#) can be thousands of lines long and have all sorts of unused data and oddles of business logic in the object. &amp;nbsp;Keep you data away from your business logic and keep your movable objects light. Serializing a VLO with lots of embedded objects, state and logic and passing this between layers is just daft.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
See a previous post on Light Weight Object Pattern&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
Reporting On Live Systems&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Managers like reports and quite a few like the same reports every 15mins as if this will increase their teams performance or ease their paranoia. &amp;nbsp;Also having 100 people running the same report every morning at 9am is also not good as your user base is is trying to sign on at the same time. Replicate the database and feed the reporting from the replicated data is a good start, for very common reports, email it out once daily or download load and place on a link for users. Poor reporting setup can kill your application.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
Silly Loops&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Look at the GetCustomer method below.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;private Customer GetCustomer(int customerid)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;Customer mycustomer;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; var getallcustomers = dallayer.getcustomers();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;foreach(customer in getallcustomers)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (customer.id = customerid)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mycustomer = &amp;nbsp;customer;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // or&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // return customer;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;return mycustomer;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
You might very well laugh but I&#39;ve seen this in a few systems in a few different combinations. So for ever customer you cycle through all customers till you find the one you are looking for. This problem does not seem to go away with linq and lambda expressions, it just gets hidden a bit better. This &amp;nbsp;also applies to internal collections big and small.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
Not Fetching Efficiently From Storage&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This is getting much more common with the advent of ORMs (Castle, Entity Framework etc..) where data fetches are inefficient, developers are now increasingly separated from the data layer to such an extent that they don&#39;t understand the power of the database. Code First development is also has a part to play here as it further separates storage from the developer as they believe that storage is thing they don&#39;t have to worry about. But with older systems running classic ADO code this is still a problem where badly formed queries or badly designed data can make fetches slow.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Go back to old fashioned normalization of your data layer, it was used for good reason and look at the queries run on the database. That means looking at the queries generated by the ORM to ensure that are running as expected and produce SQL you&#39;d expect.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
Use the Power of your Database&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Back when I was a lad (.NET 1.1~2.0 days) a lot of business logic was driven by the database, this at time was an acceptable method and strongly encouraged. Now this is out of favor and the database is seen as storage only. I did have a discussion with a developer at the time who was having performance problems with a system for processing a large amount of data via object. He&#39;d load thousands of objects &amp;nbsp;from the database to code, process the objects and save them back to the database. The issue was it was very slow and the data levels were just going to get larger overtime. I suggested that he process the data on the database server rather than in code. So he tried this and was shocked at how much things sped up as the database could crunch his data a lot quicker than the code version.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Databases are very good at processing large amount of data quickly and efficiently, they are after all designed for this task. So consider taking you pain points of data processing and seeing of they could be done on the database.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
I&#39;ve heard arguments that all applications should be database agnostic and &quot;we could switch the layer at anytime&quot;; this is very noble and sounds great, but really unless you are selling a product targeting multiple databases, the database layer almost never changes. It does get switched due to cost or performance but this is quite rare in my experience.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
Fail To Cache Common Items&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This is likely one most common issues for performance and is in almost every system.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Take for example Titles for forms (Mr, Miss, Mrs etc...) these are usually stored on a database and can be used on different forms and used for almost every transaction. It is very common that every time the Title collection (i.e. from a database table) is used it is loaded from the database. Other similar collections (Country, Area, City, Occupation etc..) can also add unwanted load.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
If you have common list/collections it is better to cache them at an application level to reduce the toll on the database and calling layers.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
tbc.. &amp;nbsp; I&#39;ll add more to this later&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/3972406497800959965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/10/classic-developer-mistakes-that-makes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/3972406497800959965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/3972406497800959965'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/10/classic-developer-mistakes-that-makes.html' title='Classic Developer mistakes that makes applications slow down'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-6666992490613474132</id><published>2014-10-20T00:30:00.001+01:00</published><updated>2014-10-20T00:30:39.803+01:00</updated><title type='text'>Design Pattern : Light Weight Object </title><content type='html'>&lt;h2&gt;
Introduction&lt;/h2&gt;
This design pattern is one I use a lot and have done so for a long time, this might be similar to other patterns, if so please tell me so I can reference them. Although this looks like &quot;yeah.. how else would you do this&quot; &amp;nbsp;take a look at you objects for passing data and see if they contain bloat that would be better to be reduced.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Description&lt;/h2&gt;
The Light Weight Object design pattern takes an object and reduces it to the absolute minimum for its intended purpose to increase speed and performance for systems. This means that you only pass the absolute bare object essentials rather than an object which is bloated with extra data and functionality that you might need (but most of the time don&#39;t). If you are passing large objects around in your application then it can be bad for performance, if you are passing hundreds or even thousands these between layers or are subject to serialization then this can have a very adverse effect on performance. This comes about by either design or function creep (or a mix of both).&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Design&lt;/h4&gt;
Large object by design are very common as all the functionality and methods to support the data (properties) is kept in a single place and its fairly easy to create large function rich objects that serve your business requirements well. Large objects are self descriptive and looks impressive and have all the functionality required to perform functions over the object life-cycle.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Function Creep&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You start with an object, business or functionality changes come in; additional code added, &amp;nbsp;after a couple of major changes the object starts to bloat, functions are added to make calling calls easier to use the objects and old methods are often not removed. The objects starts to bloat and bloat as new functions and products are added to the application.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;b&gt;Classic Design&amp;nbsp;&lt;/b&gt;&lt;/h2&gt;
One thing I&#39;ve seem a lot in my development career is large objects, really large objects, C# classes with hundreds and even thousands of lines which carry a lot data and internal functionality.&lt;br /&gt;
&lt;br /&gt;
Object- 1,000l+ lines&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |______ &amp;nbsp; Properties&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |______ &amp;nbsp; Methods&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |______ Data Layer&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |______ Serialization&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |______ Business Logic&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |______ Other Stuff...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
I&#39;ve seen large objects with as seen above with a mix or all of &amp;nbsp;the items mentioned.( and some with even more than you could imagine). This is extra baggage and is carried and supported by the system by functions that might be used or only used at initialization or used rarely.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Light Object Pattern&lt;/h3&gt;
Keep the object you are passing around as small as possible and use service classes or layers to get data or perform functions as you need it. &lt;br /&gt;
&lt;br /&gt;
Light Object -- &amp;nbsp;50 lines&lt;br /&gt;
&lt;br /&gt;
Data Layer &amp;nbsp;-- 300 lines&lt;br /&gt;
Business Logic -- 300 lines&lt;br /&gt;
Other Stuf -- &amp;nbsp; &amp;nbsp;nnn lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Rules&lt;/h2&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Keep the object as small as possible&lt;/li&gt;
&lt;li&gt;Remove methods to service layers&lt;/li&gt;
&lt;li&gt;Only have a single use for the object (split if dual functions)&lt;/li&gt;
&lt;li&gt;Remove unused &amp;nbsp;properties&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
When To Use&lt;/h2&gt;
Use when you need to keep objects small and light ( you really should be doing this by default as good practice). if they are going to be placed in collection or used in large volumes. If you are running very large volumes of data in memory than this can make huge difference to your capacity and the performance of you systems. &amp;nbsp;Although &amp;nbsp;know your scale, will I have 100 users or 1 Million users on this system.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Pros&lt;/h3&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Lots of objects take up less memory&lt;/li&gt;
&lt;li&gt;Quicker proccessing&lt;/li&gt;
&lt;li&gt;Better OOP : &amp;nbsp;encapsulation, single use,&lt;/li&gt;
&lt;li&gt;Better Testing&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Cons&lt;/h2&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;More complex code&lt;/li&gt;
&lt;li&gt;More re-factoring required&lt;/li&gt;
&lt;li&gt;Objects are not as self descriptive&lt;/li&gt;
&lt;li&gt;Developer has to know how to process the object&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;b&gt;Example&lt;/b&gt;&lt;/h2&gt;
&lt;br /&gt;
Bob has a user object that contain the following which is created at login and held in session with the user. This is fairly standard and not as bloated as we think with of very large objects. Bob has noticed that each user only takes up a few kb &amp;nbsp;(kilo-bytes) of memory per user, but this is not really much but the amount of users is starting to hurt.&lt;br /&gt;
&lt;br /&gt;
The user object&lt;br /&gt;
&lt;br /&gt;
public class User&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string SessionId &amp;nbsp;{ get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public int UserId { get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string UserName &amp;nbsp;{get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string FullName &amp;nbsp;{ get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Email { get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Password { get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Address CurrentAddress { get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public DateTime LastLogin { get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public DateTimecDateJoined &amp;nbsp;{get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public Bool AccountActive {get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public Bool LoggedIn { get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Address[] &amp;nbsp;PreviousAddress { get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string SecretQuestion { get; set; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Secret Answer {get; set; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void &amp;nbsp; Log (string message }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void Dispose()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public bool Validate()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void Logout()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; private Log _log&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This looks like a standard object, not too big with a few standard &amp;nbsp;methods you would expect.&lt;br /&gt;
&lt;br /&gt;
But Bob has a problem, his user base is getting close to 250K users and the cost of his cloud bill seems to be going up a lot faster than the users on the system. &amp;nbsp;So Bob starts with the user object which is held in session for every user.&lt;br /&gt;
&lt;br /&gt;
What can go or stay and why&lt;br /&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;SessionId &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Not Needed, copy of system session field&lt;/li&gt;
&lt;li&gt;UserId &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Keep used in code&lt;/li&gt;
&lt;li&gt;UsedName &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Keep used for display&lt;/li&gt;
&lt;li&gt;FullName &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lose : &amp;nbsp;used rarely&lt;/li&gt;
&lt;li&gt;Email &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;lose : &amp;nbsp;used rarely&lt;/li&gt;
&lt;li&gt;Password &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delete not required in this&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Address x 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lose : &amp;nbsp;used rarely&lt;/li&gt;
&lt;li&gt;Last Login &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete not used&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Date Joined &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delete not used&lt;/li&gt;
&lt;li&gt;AccountActive &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delete: If not active then it this object can&#39;t exist in session&lt;/li&gt;
&lt;li&gt;Logged In &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delete: &amp;nbsp;if not logged in then object not in session&lt;/li&gt;
&lt;li&gt;Previous Address &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delete: &amp;nbsp;never used&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Secret Question &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete : never used after login, only on lost password&lt;/li&gt;
&lt;li&gt;Secret Answer &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete : never used after login, only on lost password&lt;/li&gt;
&lt;li&gt;Method : &amp;nbsp;Log &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; move to service class&lt;/li&gt;
&lt;li&gt;Method : &amp;nbsp;Dispose &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; move dispose to service class as can be handled by session end or logout&lt;/li&gt;
&lt;li&gt;Method : &amp;nbsp;Validate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;move to service class&lt;/li&gt;
&lt;li&gt;Method : &amp;nbsp;Logout &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;move to service class&lt;/li&gt;
&lt;li&gt;Method : &amp;nbsp;Other &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; move to service class&lt;/li&gt;
&lt;li&gt;Object: &amp;nbsp; Log &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;remove embedded logging object (NLOG, Log4Net etc..)&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As can be seen you can reduce the user object for session storage to something like this&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class LightUser&lt;/div&gt;
&lt;div&gt;
{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;public int &amp;nbsp;UserId &amp;nbsp; &amp;nbsp; &amp;nbsp;{ get; set; } &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;public string UsedName &amp;nbsp; &amp;nbsp; { get; set; }&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Although this does not represent the full user object/details it does cover &amp;nbsp;the user object used in 99% of the cases 99% of the time.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now bob can squeeze more session user objects in the &amp;nbsp;same memory space, he may have to make more calls to the service layers but this is a lot less cpu than the storage and service of the larger object footprint.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/6666992490613474132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/10/design-pattern-light-weight-object.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6666992490613474132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6666992490613474132'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/10/design-pattern-light-weight-object.html' title='Design Pattern : Light Weight Object '/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-7210579249874403612</id><published>2014-10-05T22:42:00.001+01:00</published><updated>2014-10-05T22:47:03.806+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="MongoDb"/><title type='text'>C# Simple DAL Layer with MongoDB</title><content type='html'>&lt;br /&gt;
&lt;h2&gt;
Introduction&lt;/h2&gt;
&lt;h4&gt;
See Post 1 in the series&lt;br /&gt;&lt;a href=&quot;http://rundevrun.blogspot.co.uk/2012/11/setup-mongodb-on-windows-8.html&quot;&gt;http://rundevrun.blogspot.co.uk/2012/11/setup-mongodb-on-windows-8.html&lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MongoDB is a NoSQL database that stores &quot;documents&quot;. The documents are in effect JSON serialised objects. These objects can (and often will) be a concatenation of other object, that is objects with a nested objects in them.&lt;br /&gt;
&lt;br /&gt;
This DAL layer will focus on saving and retrieving C# objects to and from a MongoDB database. The core storage of MongoDB of&amp;nbsp; Json objects will be ignored as we are only interested C# objects. &lt;br /&gt;
&lt;br /&gt;
Example of Customer with Embedded Address object (which is a collection).&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;ObjectId&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Id { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; CustomerId { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; CustomerShortName { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; CustomerLongName { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Address&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; Addresses { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; HomeAddress { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; WorkAddress { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;[] PreviousAddress { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;}&lt;br /&gt;


&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Address&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; AddressIndex { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Address1 { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Address2 { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Address3 { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Address4 { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Address5 { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Address6 { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
Why Create a DAL &lt;/h3&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;Well this could be a long conversation (or rant), but basically you may well want to encapsulate the database access to a single place within your code. Also you may not want the calling layers (you website, logic) to know or care which database is used. It is not uncommon for products to support multiple databases and having a distant layer removes a lot of pain when you want to replace the database used. &lt;br /&gt;
&lt;br /&gt;
In traditional databases (SQL type) we would have to create a table for customer and a table for addresses then link then via database&amp;nbsp;foreign keys or with code. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;
Creating A Simple DAL (Data Access Layer)&lt;/h2&gt;
The DAL we will create will be to service the customer class as shown above.&lt;br /&gt;
First we will create an empty class and add methods for the dal.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoDal&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
Create Single Database&amp;nbsp; &lt;/h3&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;Create a Database connection that can be used in the whole class. This will return a the same MongoDatabase object with the same parameters. The connectionString and the database should be located within a configuration file, but here are hardcoded for simplicity. This is a private method as we don&#39;t want to expose this to calling layer, no point creating methods that can be skipped past.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoDatabase&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Database&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{ &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; connectionString = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;mongodb://localhost&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MongoClient&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; client = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoClient&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;(connectionString);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MongoServer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; server = client.GetServer();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MongoDatabase&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; database = server.GetDatabase(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;); &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; database;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; } &lt;br /&gt;

}&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
Create Customer Method &lt;/h3&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;strong&gt;SQL Equivalent :&amp;nbsp; Insert&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Create a method to creates a customer onto the database, note that the get collection is hardcoded to &quot;Customers&quot;, this could be supplied to the dal layer at runtime or&amp;nbsp;supplied with configuration file. &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; CreateCustomer(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; collection.Insert(customer);&lt;br /&gt;
}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;
Get Customer Method&lt;/h3&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;strong&gt;SQL Equivalent :&amp;nbsp;Select&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
This method will get a customer object with the objectid within the customer class.&lt;br /&gt;
&lt;br /&gt;
1. Define Query&lt;br /&gt;
2. Get Collection (customers)&lt;br /&gt;
3. FindOne (single) customer&lt;br /&gt;
4. Get the Bson document (json)&lt;br /&gt;
5. Deserialize back to a Customer object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; GetCustomer(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;ObjectId&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; objectid)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //Query: Get Customer.id == supported objected&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Query&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;.EQ(e =&amp;gt; e.Id, objectid);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; BsonDocument&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; bsonCustomer =  collection.FindOne(query);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsonCustomer);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
This is the&amp;nbsp;core&amp;nbsp;of getting ALL getting all objects from MongoDB.&amp;nbsp;In this example the Query to the database is fixed rather than having a dynamic query supplied by the calling layer. We will touch on this later. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
Delete a Customer&lt;/h3&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;strong&gt;SQL Equivalent :&amp;nbsp;Delete&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
You might at some point want to delete a customer from the database, this follows the same core method as getting a customer where a delete query is created and run againist the collection. This is very powerful and needs careful consideration.&lt;br /&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; DeleteCustomer(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;ObjectId&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; objectId)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Query&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;.EQ(e =&amp;gt; e.Id, objectId);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; collection.Remove(query);&lt;br /&gt;
}&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
Get All Customers&lt;/h3&gt;
&lt;strong&gt;SQL Equivalent :&amp;nbsp;Select&lt;/strong&gt;&amp;nbsp; * &lt;br /&gt;
&lt;br /&gt;
This will get all customers from the collection. If&amp;nbsp; you have a very large database with millions of customers this is likely not to make you friends with operations or your boss. But for simple smaller collections it is quite useful. &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; GetAllCustomer()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; MongoCursor&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonDocument&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; Bsoncustomers = collection.FindAll();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; customers = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; foreach&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; bsoncustomer &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;in&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Bsoncustomers&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; cus = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsoncustomer);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customers.Add(cus);&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; return customer;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You could in the example above use a linq-expression statement in place of the foreach, I&#39;ve shown this below.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Bsoncustomers.Select(bsoncustomer =&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsoncustomer)).ToList();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
A Wee Bit More Advanced&lt;/h3&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;You may have noticed that previous example have a lot code that was very similar. Below we have two methods GetByAddress6 and GetByQuery. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;GetByQuery &lt;/strong&gt;will get a collection of Customers by the query supplied, this query could be anything from getting by name or something more complex.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;GetByAddress6&lt;/strong&gt; forms a query and passed to GetByQuery to execute it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; GetByAddress6(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; address)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; IMongoQuery&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Query&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;.EQ(x =&amp;gt; x.Addresses[0].Address6 == address);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; GetByQuery(query);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; GetByQuery(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;IMongoQuery&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{ &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; MongoCursor&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonDocument&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; Bsoncustomers = collection.Find(query);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; customers = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; foreach&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; bsoncustomer &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;in&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Bsoncustomers)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; { &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; cus = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsoncustomer);    &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customers.Add(cus);&lt;br /&gt;

&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customers;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Why do this? &lt;/h4&gt;
It makes the code a lot more maintainable and reduces the time to add additions to code later and concentrates the same code in the a single place. &lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;
Using The Code&lt;/h2&gt;
Example of creating an instance of the dal and adding a customer, &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Sample()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Address&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; addy = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Address&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Address1 = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;123 High Street&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Address2 = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;North&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Address3 = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Any Town&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Address4 = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Address5 = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Address6 = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;123 123&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;};&lt;br /&gt;


&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;           &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;customer.Id = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;ObjectId&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;customer.Addresses = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Address&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;customer.HomeAddress = 0;&lt;br /&gt;

customer.CustomerId = 12345;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;customer.CustomerShortName = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Tommy&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;customer.CustomerLongName = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Mr Thomous Smith&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; id = customer.Id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;           &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;//Create dal instance&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoDal&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; dal = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoDal&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;           &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;//Create customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;dal.CreateCustomer(customer);&lt;br /&gt;

&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;           &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;//Get All customers&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; allcustomer = dal.GetAllCustomer();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;//Get Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;           &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; GetCustomer = dal.GetCustomer(id);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;           &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;//Delete Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;dal.DeleteCustomer(id);&lt;br /&gt;


&lt;br /&gt;
　&lt;br /&gt;

}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;
Full Code Example&lt;/h2&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;Here&#39;s the full thing:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; System;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; System.Collections.Generic;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; System.Linq;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; System.Text;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; System.Threading.Tasks;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; MongoDB.Bson;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; MongoDB.Bson.Serialization;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; MongoDB.Driver;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; MongoDB.Driver.Builders;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; SampleCode&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoDal&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;


&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoDatabase&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Database&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;get&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; connectionString = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;mongodb://localhost&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; MongoClient&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; client = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;MongoClient&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;(connectionString);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; MongoServer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; server = client.GetServer();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; MongoDatabase&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; database = server.GetDatabase(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;); &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;//name of the database&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;              &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; database;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;br /&gt;

}&lt;br /&gt;


&lt;br /&gt;
　&lt;br /&gt;

&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; CreateCustomer(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;collection.Insert(customer);&lt;br /&gt;

}&lt;br /&gt;


&lt;br /&gt;
　&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; GetCustomer(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;ObjectId&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; objectid&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;//Query: Get Customer.id == supported objectid&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;IMongoQuery&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Query&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;.EQ(e =&amp;gt; e.Id, objectid);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;BsonDocument&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; bsonCustomer =  collection.FindOne(query);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsonCustomer);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customer;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;br /&gt;


&lt;br /&gt;
　&lt;br /&gt;

&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; DeleteCustomer(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;ObjectId&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; objectId)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Query&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;.EQ(e =&amp;gt; e.Id, objectId);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;collection.Remove(query);&lt;br /&gt;

&lt;br /&gt;
       }&lt;br /&gt;


&lt;br /&gt;
　&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; GetAllCustomer()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; MongoCursor&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonDocument&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; Bsoncustomers = collection.FindAll();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; customers = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; foreach&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; bsoncustomer &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;in&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Bsoncustomers)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; cus = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsoncustomer); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customers.Add(cus);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; GetByAddress6(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; address)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;IMongoQuery&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Query&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;.EQ(x =&amp;gt; x.Addresses[0].Address6 == address);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; GetByQuery(query);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;}&lt;br /&gt;


&lt;br /&gt;
　&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; GetByQuery(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;IMongoQuery&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; query)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; collection = Database.GetCollection(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;Customers&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;MongoCursor&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonDocument&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; Bsoncustomers = collection.Find(query);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt; customers = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;foreach&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; bsoncustomer &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;in&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; Bsoncustomers) &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; var&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; cus = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;BsonSerializer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;.Deserialize&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: x-small;&quot;&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;gt;(bsoncustomer); &lt;br /&gt;&amp;nbsp;&amp;nbsp; customers.Add(cus);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;br /&gt;

&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; customers;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&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;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/7210579249874403612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/10/c-simple-dal-layer-with-mongodb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7210579249874403612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7210579249874403612'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/10/c-simple-dal-layer-with-mongodb.html' title='C# Simple DAL Layer with MongoDB'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-7466444680403772547</id><published>2014-07-06T23:47:00.000+01:00</published><updated>2014-07-06T23:47:33.666+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Triathlon"/><title type='text'>Aberfeldy Sprint Triathlon  2014</title><content type='html'>This was my first triathlon set in the beatify location of Aberfeldy.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Sprint Triathlon &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Swim 750 metres (30 lengths of 25m pool)&lt;/li&gt;
&lt;li&gt;Cycle 20K (12 miles or so)&lt;/li&gt;
&lt;li&gt;Run 5K&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Registration&lt;/h2&gt;
I got there fairly early as I don&#39;t like being late and wanted a nice and relaxed start to the day. Registration was well organised and very friendly. They did forget to issue me a goody bag, which I picked up later; but this&amp;nbsp;was not an issue. The weather was dry to start&amp;nbsp;but&amp;nbsp;was rather cool&amp;nbsp;&amp;nbsp;and rain was forecast later. What to ware was my primary issue post cycle, do I go for second top or do just use my £15 tri suit from Aldi (no club kit at this point). Would my £15Aldi suit standup to the rigours of this and not let me down in a most embarrassing way. I opted for a second cycling top again Aldi costing the grand some of £7. I&#39;ve always found Aldi running and cycling gear to be fantastic value for money but fairly low on street cred. I brought way too much kit to transition to cover my options and most of was left&amp;nbsp;in the bag. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Kit&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Bike:&amp;nbsp; Boardman Team Carbon&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Bike Shoes: DHB&amp;nbsp;road&amp;nbsp;(£35)&lt;/li&gt;
&lt;li&gt;Tri Suit : Aldi&amp;nbsp; £15&lt;/li&gt;
&lt;li&gt;Cycle Top: Aldi £7&lt;/li&gt;
&lt;li&gt;Running Shoes:&amp;nbsp; Ascis GT2000&lt;/li&gt;
&lt;li&gt;Race Belt&lt;/li&gt;
&lt;li&gt;Saddlebag: tool, tubes x2&lt;/li&gt;
&lt;li&gt;Gels, jelly babies (easy to eat)&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
The&amp;nbsp;Swim&lt;/h2&gt;
750M in the pool and I was on wave 3, which was slightly late starting and took two gels before the swim. I had a swim planned time of 16mins and my plan was to draft with a steady pace and keep up with the swimmer in front. My swimming is not fast to this looked like a good plan. Luckily I was not first off (2nd) and my plan looked good.&amp;nbsp; First few lengths went and I was sticking to my drafting steady plan. Then the swimmer in front folded and I was in front (crap!!!), so I stuck to my steady pace which I knew was about 16mins. &lt;br /&gt;
&lt;br /&gt;
Then the swimmer behind me started to nip my heals (signal they wanted past and could swim fast). Fine by me as I could draft and let them take care of the pacing. Except they slowed down; I guess that leading was a bit slower than drafting&amp;nbsp;and the swimmer behind&amp;nbsp;me was nipping my heals. So I stopped and let them by at the turn.&amp;nbsp; The third swimmer was now nipping my heals and wanted past, which was fruitless as I was right behind all the front swimmers all the way. &lt;br /&gt;
&lt;br /&gt;
About halfway through the pace dropped a bit, I nipped the swimmer in front to let me by, nothing they ignored me.&amp;nbsp; Tried again and they ignored me again, but the pace This was getting annoying now as the swimmer behind me was nipping my heals to get&amp;nbsp; past. So I let them past only for them to start the breast stroke and really drop the pace. This was infuriating so I constantly nipped their heals all down the pool and they developed a odd way of not letting me past.&lt;br /&gt;
&lt;br /&gt;
So I&#39;m behind this swimmer&amp;nbsp;and wanted past and they drop the pace so they&#39;d sprint the last quarter of the length get knackered and&amp;nbsp; slow down until they got to the last quarter of the length and sprint like mad again. On the turn I&#39;d kick and glide and be right behind them (thanks JD for all that glide training)&amp;nbsp; nipping their heals all the way. I did not&amp;nbsp;copy&amp;nbsp;the swimmer in front&amp;nbsp;and kept my pace steady throughout the whole swim.&lt;br /&gt;
&lt;br /&gt;
Then it was over and I out the pool. Running in the cold toward my bike.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
T1&lt;/h2&gt;
I quickly towelled myself and tried to put socks on, this is really difficult with wet feet. I put a cycling top on prefilled with gels and grabbed my helmet fixing it securing before touching my bike. I tool two gels at T1 before running with my bike shoes on, which is just as scary as it sounds.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
The Run&lt;/h2&gt;
&lt;br /&gt;
Past the mount point and on the bike missing some&amp;nbsp; idiot who decided the best place to mount the bike was just in front of me moving off.&amp;nbsp; No matter I was off and eh.. pedalling.&amp;nbsp; Exit Aberfeldy toward the first bridge where I was to stay left of a line of cones which was less than two feet wide.&amp;nbsp;A&amp;nbsp;girl got it all wrong on the bridge staying right of the cones with two marshalling shouting at her and me trying to workout if they were shouting at me or her and watching her drift towards me and the cones. There was too much happening for me to concentrate on my cycling and I drifted a foot to the left where my front wheel caught a line on the curb. At this point I knew I was going down as the front wheel was tracking the cut between the road and the curb. I was flung out the bike and to the left. I saw the river Tay coming towards me and thought I was going for a second swim.&lt;br /&gt;
&lt;br /&gt;
I hit the wall hard was still attached to the bike, I thought I was out of it but it came with me, I grabbed onto the wall. My shoulder hurt and I was a bit winded and a small cut to my left elbow. I picked myself up and reassured a marshal I was fine and got back on my bike. &lt;br /&gt;
&lt;br /&gt;
My injuries were a tad worse than I thought, which only later I would discover. The cut to my elbow took weeks to heal properly as I tended to catch it and open the wound up again. My shoulder hurt for a couple of week as I&#39;ve broken this before but seemed sprained rather than any real damage.&lt;br /&gt;
&lt;br /&gt;
I was a tad jittery for a few miles after my off and this cost me quite a few minutes. I concentrated on playing catch with riders in front and put the pace on.&amp;nbsp; The rain started and it was&amp;nbsp;cold and bit wet (OK really wet).&amp;nbsp; My tactic was&amp;nbsp;catch up to the rider in front, pass and concentrate on the next rider in front of them. I took 6-7 riders before Kenmore and was getting cocky. I played tag with an older gentlemen swapping places a few times before Kenmore. He was in front before we hit the town. &lt;br /&gt;
&lt;br /&gt;
On the way dropping down into Kenmore I spotted a rider in front and started to catch up, he rounded a bend a bit two wide hitting his wheels against the curb or he high-sided I couldn&#39;t tell which.&amp;nbsp; The result was he flying out his bike doing a perfect upside down starfish impression. Luckily he landed on cut grass but this was on a bike with a big drop. He fell about 12-15 feet and I slowed to get off ad help but spotted a marshal running up the hill to assist him. He was moving and clutching his shoulder and I got a dull ache from left shoulder.&amp;nbsp; I didn&#39;t stop as I figured the marshal would sort him out and he was moving. &lt;br /&gt;
&lt;br /&gt;
I caught up with the older gentlemen and another rider who stopped at traffic before the coned section at the bridge into Kenmore, they were just sitting there waiting for cars to clear the bridge. I filter through heavy city traffic to work so just did the same here and passed the cars and them. &lt;br /&gt;
&lt;br /&gt;
No the climb out of Kenmore back towards Aberfeldy is a steep one and I passed a half dozen riders on the climb up. Nearing the top one guy started to go faster when he spotted me and moved to the middle of the road just as I was about to pass. I shouted &quot;passing&quot; to him and he smartly moved over to the left and I soon lost him on the decent. &lt;br /&gt;
&lt;br /&gt;
I was really trying to put the pace on the decent back to Aberfeldy&amp;nbsp;rather coast down the hills. I caught another few riders in Aberfeldy and sprinted into the dismount point.&lt;br /&gt;
&lt;br /&gt;
On the bike I ate my jelly babies and a couple of gels. Trying to keep my fluids up (in the lashing rain at times)&amp;nbsp; and keep my energy levels up.&lt;br /&gt;
&lt;h2&gt;
T2&lt;/h2&gt;
Getting off the bikes and running was a shock, my legs were like jelly and ached as blood rushed into all the cold spots. Rack bike, helmet off and&amp;nbsp;take off my well wet shoes,&amp;nbsp;take two gels and on with running shoes of off for the last leg.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
The Run &lt;/h2&gt;
The run can be best described as cruel with a 300ft climb up behind the village on a mix of road and old gravel track. Exit the sports complex and up the hill with a very steep section, I had to stop and walk this section. I picked my pace up and my running got stronger the more I got into it. By the time I reached the top I felt stronger and was upping the pace again. On the way back on the turn I pushed the pace up and started catching people on the decent.&amp;nbsp; The very steep section gave another issue on the way back, I had trouble stopping and had to take the return left rather wide.&amp;nbsp;Just another few hundred yards to go and I was finished, I sprinted in to cheers which was rather nice. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Results&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Overall Place:&amp;nbsp;&amp;nbsp;76 of 148&lt;/li&gt;
&lt;li&gt;Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01:28:47&lt;/li&gt;
&lt;li&gt;Swim :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;16:49&lt;/li&gt;
&lt;li&gt;T1:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;00:01:55&lt;/li&gt;
&lt;li&gt;Bike:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;00:44:20&lt;/li&gt;
&lt;li&gt;T2:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;00:01:22&lt;/li&gt;
&lt;li&gt;Run::&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00:24:24 &lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Not too bad considering it was my first tri and my bike crash cost me a few minutes, but the bike&amp;nbsp;was strong the result fairly decent for my first&amp;nbsp;season road biking. The swim although a bit frustrating is on par after speaking with more experienced athletes for the in pool antics, you just have to live with this I suppose. The run was a good effort after the run and the swim and the big hill it was on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/7466444680403772547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/07/aberfeldy-sprint-triathlon-2014.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7466444680403772547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7466444680403772547'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/07/aberfeldy-sprint-triathlon-2014.html' title='Aberfeldy Sprint Triathlon  2014'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-79009237160391092</id><published>2014-02-28T14:44:00.001+00:00</published><updated>2014-02-28T14:44:42.473+00:00</updated><title type='text'>IE11  Development Tools Fails to Load</title><content type='html'>This is a particular problem under Win7 (ie most of us) and an known issue with Mircosoft.

It is caused by the Development Tools trying to load your last tools tab, if this happens to be Network then it is mostly likely to hang.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;TO CURE THIS&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Open &lt;b&gt;RegEdit&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Navigate to&amp;nbsp; &lt;b&gt;&quot;HK\Current_User\Software\Mircosoft\F12&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Modify&amp;nbsp; &lt;b&gt;lastselectedpluginid &lt;/b&gt;to &lt;b&gt;&quot;0&quot;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;b&gt;Remove Zombie Processes&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Might not be needed, but IE11 under win7 seems very bad for this.&lt;br /&gt;
&lt;br /&gt;
Task Manager --&amp;gt; Processes --&amp;gt; Kill all iexplorer processes.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/79009237160391092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/02/ie11-development-tools-fails-to-load.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/79009237160391092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/79009237160391092'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/02/ie11-development-tools-fails-to-load.html' title='IE11  Development Tools Fails to Load'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-6769974145074705366</id><published>2014-02-28T12:59:00.002+00:00</published><updated>2014-02-28T12:59:39.803+00:00</updated><title type='text'>Very Simple Moving Ball Html5 Canvas</title><content type='html'>&lt;p&gt;
Been playing with a Java and gaming physics for a week now and decided to try a very quick moving ball in JavaScript.  I&#39;m really no expert as this and at the playing about at fun level. 
&lt;/p&gt;


&lt;pre&gt;

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;
&lt;canvas id=&quot;myCanvas&quot; width=&quot;500&quot; height=&quot;500&quot;&gt;&lt;/canvas&gt;
    &lt;script&gt;

var x=50;
var y=50;
var d=&#39;add&#39;;

      window.requestAnimFrame = (function(callback) {
        return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
        function(callback) {
          window.setTimeout(callback, 100 / 20);
        };
      })();

      function animate() {
        var canvas = document.getElementById(&#39;myCanvas&#39;);
        var context = canvas.getContext(&#39;2d&#39;);

        // update
        update();
     

        // clear
        context.clearRect(0, 0, canvas.width,canvas.height);

        // draw stuff
        draw();

        // request new frame
        requestAnimFrame(function() {
          animate();
        });
      }
      animate();

function update(){
 
     if (d==&#39;add&#39; &amp;&amp; x &lt; 450){
         x++; y++;
       }
        if (d==&#39;add&#39; &amp;&amp; x &gt;= 450){
          d=&quot;sub&quot;
         }
       if (d==&quot;sub&quot; &amp;&amp; x &gt; 50) {
         x--; y--;
       }
       if (d==&quot;sub&quot; &amp;&amp; x &lt;= 50) {
          d=&quot;add&quot;;
       }
}

function draw(){
  var c=document.getElementById(&quot;myCanvas&quot;);
  var ctx=c.getContext(&quot;2d&quot;);
  ctx.beginPath();
  ctx.arc(x,y,50,0,2*Math.PI);
  ctx.stroke();

}

&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;

&lt;/pre&gt;


</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/6769974145074705366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/02/very-simple-moving-ball-html5-canvas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6769974145074705366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6769974145074705366'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/02/very-simple-moving-ball-html5-canvas.html' title='Very Simple Moving Ball Html5 Canvas'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-2771061677636273759</id><published>2014-01-02T21:25:00.000+00:00</published><updated>2014-01-03T13:27:22.718+00:00</updated><title type='text'>Nokia Lumia 1020 New Phone... not a good start</title><content type='html'>Update: 03/01/2014&lt;br /&gt;
&lt;br /&gt;
I&#39;ve a new phone, Nokia Lumia 1020. &amp;nbsp;My previous phone Lumia 800 lasted well for two years and had little issues. The Mac connector worked very well and the integration to &amp;nbsp;Zune on windows was as good as Mac Book. &amp;nbsp;The only real issue I had was the lack of apps but this is improving. The amount of crapplets (crap apps) is huge; just like any other phone.&lt;br /&gt;
&lt;br /&gt;
Why does EVERY app have to access ALL my personal details, this does not seem right to me and I&#39;m not impressed nor buying the amount of apps I would have if proper restrictions on data privacy were used.&lt;br /&gt;
&lt;br /&gt;
The 1020 is nice, slightly bigger than the 800 and not too big in my jeans pocket. The Windows interface is great and the linking of contacts is superb, this is &amp;nbsp;real social phone. The camera is awesome and is a really alternative to having a DSLR hanging round your neck (most of the time). &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Setup&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I&#39;ve had sound real issues, Windows 8 first of all, the Win7.x used Zune and this was alright since I came from a Mac before and this was very similar to Itunes and iphone setup. But now this integration is not there anymore and you need Windows 8 metro type apps installed; which a useless as best. &amp;nbsp;ItThe new phone apps under windows 8 not pickup ANY of my music or videos and I was forced to switch back to my Mac. &lt;br /&gt;
&lt;br /&gt;
Right Mac phone connector seemed to work a treat and I copied over 35Gb of music and 10Gb of videos (I&#39;ve the 1020 64Gb version). &amp;nbsp;This took about 30 mins which is acceptable level of speed. &amp;nbsp;But on opening the phone there was no music or videos copied across; tried this again several times and with the same results.&lt;br /&gt;
&lt;br /&gt;
Back to my windows machines, As the windows phone apps did nothing I tried a manual copy; browse my computer and manually copy music from local folder to phone via explorer windows. This is very very poor and the over all experience is worse than the dog crapping on the carpet. Luckily I&#39;ve got Classic Shell on Win8.1 machine so this was not too much hassle. I&#39;m a very experienced user and the standard man in the street may not get round these issues.&lt;br /&gt;
&lt;br /&gt;
But the time for coping all my music is shocking, &amp;nbsp;To copy the 35Gb will take an estimated 22hours, really 22 hours to copy music onto the phone from a windows 8.1 machine. &amp;nbsp;But it is coping it across and does put the music in the right place.&lt;br /&gt;
&lt;br /&gt;
update: &amp;nbsp;Failed about 7 hours in coping music, so starting where it left off. &amp;nbsp;I also think the buggered update of Windows 8.1. where it deleted or corrupted all my libraries is to blame for the phone app not seeing any music or files. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Coping Contacts&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Bluetooth connection to Lumia 800 &amp;nbsp;and copy your contacts and messages. &amp;nbsp;This failed the first two times but got there in the end. The message copying is really odd; it will copy messages that are sent to you, but not messages you send to others. This is just plain stupid!!!&lt;br /&gt;
&lt;br /&gt;
update: &amp;nbsp;The newest message copied is 6 months old, even though it said it was successful.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;HeadPhones&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The don&#39;t fit in my ears and fallout even while sitting still. I seem not to have Nokia Ears!!!!! Not sure about the sound quality, ask me in 22hours or so.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Installing Apps&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I have previous purchases which I wished to port to my new Lumia, this is fairly standard stuff and would be easy. This could not be done on the phone or not any way I could figure out, so onto my windows phone account to look at purchased apps.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPOXIayBYBV1E4k_VyK9SCHbCApnB_fiLU1x4_qYADJ8SPcNq8WhIQAalAHFaxW03CygU8vlu09UXoQQRgA8EZ9wfjCnSYAFutwHIj9JKMA69w6Hx2KIJkuHlaaVWNNf6fSpVEQrbfsSw/s1600/AppNotAvailable.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPOXIayBYBV1E4k_VyK9SCHbCApnB_fiLU1x4_qYADJ8SPcNq8WhIQAalAHFaxW03CygU8vlu09UXoQQRgA8EZ9wfjCnSYAFutwHIj9JKMA69w6Hx2KIJkuHlaaVWNNf6fSpVEQrbfsSw/s1600/AppNotAvailable.png&quot; height=&quot;209&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
But on some apps I was getting &quot;App is not available in this region&quot;. &amp;nbsp;What does that even mean, has Scotland gone independent early and no one told me. I really wanted Plant V Zombies as well. With other apps you just click install and it sends a message to your phone.... neat.&lt;br /&gt;
&lt;br /&gt;
OK change of tact, on phone, games, store, search, &quot;plants v zombies&quot;, &amp;nbsp;buy app. &amp;nbsp;Message saying &quot;You&#39;ve already purchased like to install it instead. Game installed on new phone as last.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Free App Voucher £20&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Cool I always like free stuff. So onto Nokia app voucher page: &amp;nbsp;&lt;a href=&quot;http://www.nokia.com/gb-en/apps-voucher&quot;&gt;http://www.nokia.com/gb-en/apps-voucher&lt;/a&gt;&amp;nbsp;and enter details and click ok. &amp;nbsp;Except it crashed and gave me the following page.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhp9_BtWogbgbjfAynYuJyQRU02qsOdzbt04LA3ZQCA7MkYuXlEhbEY_xeK0YpnvkTb9YWnExvvuJK0Fx1vw_dbfts-rzhVLtpYj4T1k6WbDjPztaNPZSo59afnwaEOQsGK7sSJ0dm_4M8/s1600/AppVoucher.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhp9_BtWogbgbjfAynYuJyQRU02qsOdzbt04LA3ZQCA7MkYuXlEhbEY_xeK0YpnvkTb9YWnExvvuJK0Fx1vw_dbfts-rzhVLtpYj4T1k6WbDjPztaNPZSo59afnwaEOQsGK7sSJ0dm_4M8/s1600/AppVoucher.png&quot; height=&quot;464&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Yes it crashed and I tried to contact &quot;Nokia Care&quot;, which is some where in Glasgow. Why can&#39;t &amp;nbsp;the failing page give me link to a page where I can add details and leave this to Nokia to sort out. So no app voucher and its not clear If I&#39;ll get one. &amp;nbsp;I did try this page a few times but it always gave me the same result.&lt;br /&gt;
&lt;br /&gt;
update: tried this the next day and it work fine. &amp;nbsp;So maybe my tweet to various nokia accounts worked.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Phone good, connecting to PC/MAC bad and I&#39;ve been cheated of my App Voucher. With luck I get my music updated and the my app voucher sorted.&lt;br /&gt;
&lt;br /&gt;
Seriously though; &amp;nbsp;Microsoft latest batch of stuff look very pretty in the middle but frays quite a bit round the edges. &amp;nbsp;The 1020 is a top end phone but the support round it is poor.&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;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/2771061677636273759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2014/01/nokia-lumia-1020-new-phone-not-good.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/2771061677636273759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/2771061677636273759'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2014/01/nokia-lumia-1020-new-phone-not-good.html' title='Nokia Lumia 1020 New Phone... not a good start'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPOXIayBYBV1E4k_VyK9SCHbCApnB_fiLU1x4_qYADJ8SPcNq8WhIQAalAHFaxW03CygU8vlu09UXoQQRgA8EZ9wfjCnSYAFutwHIj9JKMA69w6Hx2KIJkuHlaaVWNNf6fSpVEQrbfsSw/s72-c/AppNotAvailable.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-7386688927113280836</id><published>2013-06-11T21:14:00.004+01:00</published><updated>2013-06-11T21:14:52.653+01:00</updated><title type='text'>My Reply to Microsoft XBOX One Reserve email</title><content type='html'>&lt;span style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;I currently have 3 xbox 360s in the household and the&amp;nbsp;original xbox which is still used sometimes. But your latest XBOX and no swaps games policy and having my XBOXs always on or alway on at least once ever 24hours is completely unacceptable. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
So let me get this right; I buy a game &amp;nbsp;and can&#39;t lend this to my son or daughter within my own household (as they have different xbox accounts under the family account I have).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&amp;nbsp;I won&#39;t be buying an XBOX One until&amp;nbsp;you change this, in fact my XBOX family won&#39;t be renewed again.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
Sometimes I don&#39;t turn my xbox on for months (quite busy sometimes being a full time .NET dev).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
Has it really been 10 years already, gosh I didn&#39;t even get a card. But it looks likes this relationship has run its course, it not me its you!!!!!!. You&#39;ve changed!!!!! you used to be nice and give my gifts, now its all about you getting more and more of my money. We started off well in a wee &amp;nbsp;xbox playing some really cool games, then we moved up to a bigger place with an XBox 360, the room and space we have was great. The games got better and better and &amp;nbsp;it started to get crowded with the kids. So we bought the kids their own &amp;nbsp;places (more Xbox 360s) and we moved into a new unit with Gbs and Gbs of space it was fab man!!! &amp;nbsp;But then you changed you promised a newer bigger place with XBOX one, I admit I was excited really exited. I watched the video I got even more excited then you came clean.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
Really how could you!!!!!! really man. I may even turn to the darkside, &amp;nbsp;that could even involve the S-word, yes you&#39;ve guessed it SONY PLAYSTATION 4. &amp;nbsp;I may find it hard to leave you but you started this and I&#39;m NOT your bitch, I thought we were partners in this thing, but I guess you&#39;ve changed and I have to move on.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
I&#39;m upset, pissed,&amp;nbsp;annoyed, betrayed.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
Good bye *sob*&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #444444; font-family: Calibri, sans-serif; font-size: 15px; line-height: 21px;&quot;&gt;
Frank &amp;nbsp;*sob*&lt;br /&gt;&lt;br /&gt;&lt;div&gt;
&lt;hr id=&quot;ecxstopSpelling&quot; /&gt;
From: Xbox@engage.xbox.com&lt;br /&gt;To:&lt;br /&gt;Subject:, thank you for being part of the Xbox community&lt;br /&gt;Date: Tue, 11 Jun 2013 13:05:08 -0600&lt;br /&gt;&lt;br /&gt;&lt;img height=&quot;1&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fclick.engage.xbox.com%2fopen.aspx%3fffcb10-fefb1575766d06-fe8b11707263037973-fe5f15707362017c7c10-ff971577-fe9111707263037d71-ff3115757366&quot; width=&quot;1&quot; /&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;center&quot; bgcolor=&quot;#ffffff&quot; style=&quot;color: white;&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 640px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#107c10&quot; height=&quot;7&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;7&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;center&quot; bgcolor=&quot;#107c10&quot; style=&quot;color: white; font-family: Verdana, Arial, sans-serif; font-size: 9px; line-height: 13px;&quot;&gt;This one&#39;s for you |&amp;nbsp;&lt;a href=&quot;http://click.engage.xbox.com/?qs=aeb735736a4028f847594bbb7cdfb33bafaa113340c397c3ee2640636a6a9dfcedd9fe83a0381533&quot; style=&quot;color: white; cursor: pointer; line-height: 12px;&quot; target=&quot;_blank&quot;&gt;View as web page&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#107c10&quot; height=&quot;9&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;9&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#107c10&quot; height=&quot;10&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;10&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#107c10&quot;&gt;&lt;img alt=&quot;Xbox One&quot; border=&quot;0&quot; height=&quot;34&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffe5f15707362017c7c10%2fm%2f1%2f13890_K-01.gif&quot; style=&quot;display: block;&quot; width=&quot;640&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 640px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#107c10&quot; width=&quot;332&quot;&gt;&lt;a href=&quot;http://click.engage.xbox.com/?qs=aeb735736a4028f88bbfa9a7b751102a94d85fcbb493876ce88ca04c1e3c79fe2c327406a3037403&quot; style=&quot;color: #0068cf; cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;274&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffe5f15707362017c7c10%2fm%2f1%2f13890_K-02.jpg&quot; style=&quot;border: none; display: block;&quot; width=&quot;332&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td bgcolor=&quot;#107c10&quot; width=&quot;308&quot;&gt;&lt;a href=&quot;http://click.engage.xbox.com/?qs=aeb735736a4028f88bbfa9a7b751102a94d85fcbb493876ce88ca04c1e3c79fe2c327406a3037403&quot; style=&quot;color: #0068cf; cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Welcome to a new generation. Reserve your Day One Edition today*.&quot; border=&quot;0&quot; height=&quot;274&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffe5f15707362017c7c10%2fm%2f1%2f13890_K-03.gif&quot; style=&quot;border: none; display: block;&quot; width=&quot;308&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 640px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;35&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;35&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 640px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; width=&quot;32&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;1&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block;&quot; width=&quot;32&quot; /&gt;&lt;/td&gt;&lt;td align=&quot;left&quot; bgcolor=&quot;#ffffff&quot; width=&quot;576&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 576px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; style=&quot;color: #3a3a3a; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 16px;&quot;&gt;Dear ,&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;20&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;20&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; style=&quot;color: #3a3a3a; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 16px;&quot;&gt;Over the past decade, you have been with us as we pushed the boundaries of innovation. Xbox One represents not only the arrival of a new generation of games and entertainment, but also the next chapter of our journey together.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;20&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;20&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; style=&quot;color: #3a3a3a; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 16px;&quot;&gt;Xbox One was designed to be the most advanced gaming console ever made. From its revolutionary new multiplayer matchmaking system to its state-of-the-art AI that adapts to the way you play. From its stunning cinematic realism to new ways to share experiences with friends. Not to mention the enhancements to Xbox Live, the most exciting social gaming network in the world.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;20&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;20&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; style=&quot;color: #3a3a3a; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 16px;&quot;&gt;We would like to personally invite you to be a part of this new generation of games and entertainment from Day One. Reserve your Day One Edition today and in addition to the best console we&#39;ve ever made, you&#39;ll also receive a commemorative controller and an exclusive achievement.*&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;20&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;20&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; style=&quot;color: #3a3a3a; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 16px;&quot;&gt;Thank you for being part of the Xbox community. We look forward to our journey&amp;nbsp;ahead.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;20&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;20&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;td bgcolor=&quot;#ffffff&quot; width=&quot;32&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;1&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block;&quot; width=&quot;32&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 640px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; height=&quot;15&quot; style=&quot;line-height: 1px;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;15&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffeca167070610c7c%2fm%2f1%2fspacer.gif&quot; style=&quot;display: block; line-height: 21px;&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 21px; width: 640px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#ffffff&quot; width=&quot;319&quot;&gt;&lt;a href=&quot;http://click.engage.xbox.com/?qs=aeb735736a4028f8857a3eac93191f99cae72d4e69af4c92954d7c9d526a43a8d1f9423a77cd371c&quot; style=&quot;color: #0068cf; cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Reserve your Day One Edition today. Features a commemorative controller and an exclusive achievement.&quot; border=&quot;0&quot; height=&quot;264&quot; src=&quot;https://dub124.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;amp;canary=YzF2Yw8fJruPDSSfe8THDhQHbm4GXMRfvjsuzOO%2fgzY%3d0&amp;amp;url=http%3a%2f%2fimage.engage.xbox.com%2flib%2ffe5f15707362017c7c10%2fm%2f1%2f13890_K-04.gif&quot; style=&quot;border: none; display: block;&quot; width=&quot;319&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/7386688927113280836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2013/06/my-reply-to-microsoft-xbox-one-reserve.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7386688927113280836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7386688927113280836'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2013/06/my-reply-to-microsoft-xbox-one-reserve.html' title='My Reply to Microsoft XBOX One Reserve email'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-1946632578081070156</id><published>2013-01-20T00:11:00.004+00:00</published><updated>2013-01-20T00:12:58.372+00:00</updated><title type='text'>Remove an Item from a Collection</title><content type='html'>Seem quite a few posts and questions on removing an item from a collection, most are fairly bad if not very bad coding examples. &lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Common Issue&lt;/h4&gt;
If you try and alter a collection from within a foreach loop then it will throw and exception ( and quite rightly so).&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: solid 1px black;&quot;&gt;
&lt;pre&gt;        

          var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };

           &lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;//THIS WILL CRASH AND IS CRAPPY CODE REGARDLESS&lt;/span&gt;
            foreach (var person in people)
            {
                if (person.Id == 1)
                    people.Remove(person);
            }
&lt;/person&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
What NOT TO DO&lt;/h4&gt;
Although this will work it is not very good code. Can you spot the issues ?? (answers below)&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px solid black;&quot;&gt;
&lt;pre&gt;        

            var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };


            var finder = new List&lt;person&gt;();

            foreach (var person in people)
            {
                if (person.Id == 2)
                    finder.Add(person);
            }

            foreach (var person in finder)
            {
                people.Remove(person);
            }


&lt;/person&gt;&lt;/person&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;You&amp;nbsp;iterate through the entire collection even of the search item is the first item there.&lt;/li&gt;
&lt;li&gt;It will be slow for large collections&lt;/li&gt;
&lt;li&gt;Other developers will laugh at you (or shake their head and mutter in despair)&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Easy Method&lt;/h4&gt;
A must more efficient method is pull the item you want to remove via a Find on the collection and&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: solid 1px black;&quot;&gt;
&lt;pre&gt;        

            var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };

           
            //USE THIS 
            var getperson = people.Find(x =&amp;gt; x.Id == 1);

            people.Remove(getperson)

&lt;/person&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In the above code you might think that it will throw an exception if there is no search results, but List.Remove(null) does not throw an exception.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Combine Search and Remove on Single Command Line&lt;/h4&gt;
You can also combine the search&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: solid 1px black;&quot;&gt;
&lt;pre&gt; 
            var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };


            people.Remove(people.Find(x =&amp;gt;; x.Id == 0));
&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
Remove Multiple with a Search &amp;nbsp;with RemoveAll&lt;/h4&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid black; font-weight: normal;&quot;&gt;
&lt;pre&gt; 
            var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };


            people.RemoveAll(x =&amp;gt;; x.Id &amp;gt; 0));
&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
Remove Multiple with another Collection&lt;/h4&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid black; font-weight: normal;&quot;&gt;
&lt;pre&gt; 
            var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };
&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;            // Collection of Ints
            var findpeople = new List&lt;int&gt;() {1, 2};
           &amp;nbsp;&lt;/int&gt;&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;&lt;int&gt;            // Remove people with Ids from the collection
            people.RemoveAll(x=&amp;gt;;  findpeople.Contains(x.Id));

     
&lt;/int&gt;&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
Remove with FindIndex&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;border: 1px solid black; font-weight: normal;&quot;&gt;
&lt;pre&gt;          

            var people = new List&lt;person&gt;()
                {
                    new Person() {Id = 0, Name = &quot;Bob&quot;},
                    new Person() {Id = 1, Name = &quot;Rob&quot;},
                    new Person() {Id = 2, Name = &quot;Ann&quot;},
                };

            people.RemoveAt(people.FindIndex(x=&amp;gt; x.Id == 2));

&lt;/person&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;person&gt;
&lt;/person&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Well I hope this helps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/1946632578081070156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2013/01/remove-item-from-collection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/1946632578081070156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/1946632578081070156'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2013/01/remove-item-from-collection.html' title='Remove an Item from a Collection'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-6539799693296151931</id><published>2013-01-10T14:51:00.003+00:00</published><updated>2013-01-10T15:08:31.577+00:00</updated><title type='text'>Late bound ActiveX  / UserControl  ASP.NET debugging</title><content type='html'>The title is slightly misleading here as its more of a debug pointer than true&amp;nbsp;debugging.&lt;br /&gt;
&lt;br /&gt;
If you have a custom ActiveX control or a windows control on your page which is strongly signed etc.. and fails it load it is fairly hard (or can be) to figure out why it is not loading.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
View IEHOST Errors Log&lt;/h4&gt;
Internet Explorer IE does log exceptions to non-loaded components by creating a file in the temp internet file folder. Pick the last file created (or near the top) and drag to your desktop and open it to view the exception details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
&amp;nbsp;Assembly binding logging&lt;/h4&gt;
You could always turn on Assembly binding logging as detailed in&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;pre&gt;Details on this can be found at Microsoft&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.100).aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.100).aspx&lt;/a&gt;&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/6539799693296151931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2013/01/late-bound-activex-usercontrol-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6539799693296151931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6539799693296151931'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2013/01/late-bound-activex-usercontrol-aspnet.html' title='Late bound ActiveX  / UserControl  ASP.NET debugging'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-770549444077896743</id><published>2013-01-10T09:53:00.003+00:00</published><updated>2013-01-10T09:53:33.509+00:00</updated><title type='text'>ILMerge with .NET 4.0</title><content type='html'>ILMerge.exe will merge multiple DDLs into the same assembly, this has to be done sometimes, but I ran into a &amp;nbsp;problem&amp;nbsp;up-scaling&amp;nbsp;from .NET3.5 to .NET4.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;An exception occurred during mergin&lt;/b&gt;g:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;&lt;b&gt;&amp;nbsp; Unresolved assembly reference not allowed: System.ServiceModel.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.WriteTypeDefOrRefEncoded(BinaryWriter target, TypeNode type)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.WriteTypeSignature(BinaryWriter target, TypeNode type, Boolean instantiateGenericTypes)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.WriteTypeSignature(BinaryWriter target, TypeNode type, Boolean instantiateGenericTypes)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.GetBlobIndex(TypeNode type)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.GetTypeSpecIndex(TypeNode type)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.VisitReferencedType(TypeNode type)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.VisitClass(Class Class)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.VisitModule(Module module)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at ILMerging.ILMerge.Merge()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;at ILMerging.ILMerge.Main(String[] args)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Issue&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Seems that the ilmerge.exe tool can&#39;t reference the .NET4.0 assembles itself, you could add a path reference using the &lt;b&gt;/lib &lt;/b&gt;option on the ilmerge.exe command script or use an imerge config file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Solution 1: Use /Lib Option&lt;/h4&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US;&quot;&gt;ilmerge /lib:&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 11px;&quot;&gt;C:\Windows\Microsoft.NET\Framework64\v4.0.30319&quot; ...... bla bla.....&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;use when&lt;/b&gt; you want to use ilmerge on different builds of .NET; either different builds within the same solution or different builds within different solutions.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Solution 2: Config File&lt;/h4&gt;
&lt;div&gt;
Locate this in the ilmerge program director eg&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;C:\Program Files (x86)\Microsoft\ILMerge&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;configuration&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/configuration&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;startup uselegacyv2runtimeactivationpolicy=&quot;true&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/startup&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;requiredruntime imageversion=&quot;v4.0.30319&quot; safemode=&quot;true&quot; version=&quot;v4.0.30319&quot;&gt;&lt;/requiredruntime&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;use when &lt;/b&gt;you always want to use the same .NET framework across all builds.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
References&lt;/h4&gt;
&lt;div&gt;
&lt;a href=&quot;http://geekswithblogs.net/michelotti/archive/2010/06/02/ilmerge---unresolved-assembly-reference-not-allowed-system.core.aspx&quot;&gt;http://geekswithblogs.net/michelotti/archive/2010/06/02/ilmerge---unresolved-assembly-reference-not-allowed-system.core.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx&quot;&gt;http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/770549444077896743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2013/01/ilmerge-with-net-40.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/770549444077896743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/770549444077896743'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2013/01/ilmerge-with-net-40.html' title='ILMerge with .NET 4.0'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-3964362367487963533</id><published>2012-12-07T11:01:00.002+00:00</published><updated>2014-02-28T14:46:44.158+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="WSE"/><category scheme="http://www.blogger.com/atom/ns#" term="WSE 2010"/><category scheme="http://www.blogger.com/atom/ns#" term="WSE 2012"/><title type='text'>Visual Studio vs2010 /  vs2012 with WSE Security </title><content type='html'>&lt;br /&gt;
Recently I had to access a WSE web service that send a security WSE token in the header in plain text. After scrapping about for about week and trying various fixes; which mostly did not work at all. &amp;nbsp;Below is the method that worked for me.&lt;br /&gt;
&lt;br /&gt;
WSE has been abandoned since about 2005/2006 because by modern standards it fairly poor security and there is a good chance you will see old &amp;nbsp;WSE services used over http &amp;nbsp;rather than https which makes its use pointless.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Microsoft Stance on WSE&lt;/b&gt;&lt;br /&gt;
&quot;&lt;span style=&quot;background-color: #ebf3de; color: #222222; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; line-height: 18px;&quot;&gt;WSE 3.0 is not officially supported because ASMX is seem as a legacy product and so its WSE. There is no release plan or service packs that will enable this support.&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The following is a mix of my own experiments, posts and articles.&lt;br /&gt;
&lt;h3&gt;
&lt;b&gt;Download : &amp;nbsp; Web Services Enhancements (WSE) 3.0 for Microsoft .NET&lt;/b&gt;&lt;/h3&gt;
&lt;div&gt;
This can currently be found here&amp;nbsp;&lt;a href=&quot;http://www.microsoft.com/en-us/download/details.aspx?id=14089&quot;&gt;http://www.microsoft.com/en-us/download/details.aspx?id=14089&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Install this as you need a dll called :&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Microsoft.Web.Services3.dll&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
WSDL.exe &amp;nbsp;or WseWSDL.exe for Generating Proxy Classes&lt;/h3&gt;
&lt;div&gt;
There are a lot sites/posts that say you need to generate the proxy classes via WseWSDL.exe. In anything over Windows &amp;nbsp;XP this requires a registery hack and the installation of .NET2.0 SDK.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
I found WsWSDL.exe to be buggy and error prone and does not has the same functionality as WSDL.exe so...&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;u&gt;DON&#39;T use WseWSDL.exe unless you have to.&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
You Really Want to use WseWSDL.exe&lt;/h3&gt;
&lt;div&gt;
If WseWsdl.exe can&#39;t find .Net 2.0 then...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Install &amp;nbsp;.NET 2.0 SDK&lt;/li&gt;
&lt;li&gt;Open RegEdit&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Navigate to &amp;nbsp;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework&lt;/li&gt;
&lt;li&gt;Add String Key&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Value Name :&amp;nbsp;sdkInstallRootv2.0&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Value Data : &amp;nbsp;&amp;nbsp;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Value data will be the location of your .NET 2.0 SDK location, above is for Win7.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Using Normal WSDL.exe&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Add a reference to&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Microsoft.Web.Services3.dll &lt;/span&gt;&amp;nbsp;to your project, I would also mark the reference to copy locally (eg bin folder) if you are going to deploy the code somewhere.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Add Using Reference in the proxy code:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using &lt;/span&gt;Microsoft.Web.Services3;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Change webclient proxy class from&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt; &amp;nbsp; public partial class&lt;/span&gt; &lt;span style=&quot;color: #0b5394;&quot;&gt;MyProxy&lt;/span&gt;: System.Web.Services.Protocols.SoapHttpClientProtocol&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;b&gt;to&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public partial class&lt;/span&gt; &lt;span style=&quot;color: #0b5394;&quot;&gt;MyProxy&lt;/span&gt;: Microsoft.Web.Services3.WebServicesClientProtocol&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
So you are telling the webclient proxy generated from the WSDL.exe to use WSE3.0 instead of the standard it usually has. &amp;nbsp;This is basiclly what WseWsdl.exe should do (except it can mess even this up)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;b&gt;Sending Plain Text username and password in the SOAP header&lt;/b&gt;&lt;/h3&gt;
&lt;div&gt;
All you do is send a security token as shown below.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background: lightgray; boarder: solid 2px black;&quot;&gt;
&lt;pre&gt;  MyProxy myproxy = new MyProxy();

  myproxy.RequestSoapContext.Security.Tokens.Add(new UsernameToken(&quot;user&quot;, &quot;password&quot;, PasswordOption.SendPlainText));

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
More BackGround / Reference&lt;/h3&gt;
http://www.codeproject.com/Articles/7062/An-introduction-to-Web-Service-Security-using-WSE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Find this useful ?&amp;nbsp; Then add a comment.&lt;/h2&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/3964362367487963533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2012/12/visual-studio-vs2010-vs2012-with-wse.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/3964362367487963533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/3964362367487963533'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2012/12/visual-studio-vs2010-vs2012-with-wse.html' title='Visual Studio vs2010 /  vs2012 with WSE Security '/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-6250305869446574721</id><published>2012-11-24T19:29:00.001+00:00</published><updated>2012-11-24T19:29:16.087+00:00</updated><title type='text'>Windows 8 and VS2012 Crashing in Debug</title><content type='html'>&lt;h2&gt;
RANT !!&lt;/h2&gt;
&lt;br /&gt;
Having problems with Windows 8 and VS2012, crash about 10 times today and had to do a restart to stop it every time I entered debug. &amp;nbsp;Looking at event logs gives NO clue of why this is happening and it does not seem to follow any patterns except that IE seems to crash sometimes and VS soon follows.&lt;br /&gt;
&lt;br /&gt;
I do have resharper 7.1 installed and this could be the issue, had problems with VS2010 and R#6 in the past.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Using IIS under VS2012&lt;/h4&gt;
Only&amp;nbsp;Administers&amp;nbsp;can use IIS in VS2012 and if the project uses a virtual directory then it fails to load the&amp;nbsp;project&amp;nbsp;as you don&#39;t have permissions to access IIS&lt;br /&gt;
&lt;br /&gt;
Microsoft have since Vista failed &amp;nbsp;somewhat to support developers running developer tools on their operating&amp;nbsp;systems, everything seems to be a hash.&lt;br /&gt;
&lt;br /&gt;
Not a happy bunny here at the mo.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/6250305869446574721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2012/11/windows-8-and-vs2012-crashing-in-debug.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6250305869446574721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/6250305869446574721'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2012/11/windows-8-and-vs2012-crashing-in-debug.html' title='Windows 8 and VS2012 Crashing in Debug'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-8886209509828657782</id><published>2012-11-14T17:20:00.000+00:00</published><updated>2012-11-14T17:20:03.928+00:00</updated><title type='text'>CORS handling in MVC4 API</title><content type='html'>&lt;br /&gt;
This post is a simple answers to CORS issues on WebAPI without being over complex&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://rajcodes.blogspot.co.uk/2012/07/mvc4-web-api.html&quot;&gt;http://rajcodes.blogspot.co.uk/2012/07/mvc4-web-api.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type call might be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px black solid; margin: 10px;&quot;&gt;
&lt;pre&gt; &amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;  $.ajax({
           url: &#39;http://SERVER/api/address/test/33345345&#39;,
           contentType: &quot;application/json&quot;,
               type: &quot;GET&quot;,
               datatype: &quot;json&quot;,
                success: function(data){
                   $(&quot;#call1&quot;).html(data);
                 
                },
            error: function (e) {
                   $(&quot;#call1&quot;).html(&quot;FAILED TO GET ADDRESS&quot;);
            }        

           });

&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/8886209509828657782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2012/11/cors-handling-in-mvc4-api.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/8886209509828657782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/8886209509828657782'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2012/11/cors-handling-in-mvc4-api.html' title='CORS handling in MVC4 API'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-7237635475541907734</id><published>2012-11-12T12:57:00.001+00:00</published><updated>2012-11-12T13:45:36.938+00:00</updated><title type='text'>C# Unique List Testing :  A little testing of collections.</title><content type='html'>&lt;br /&gt;
Sometimes you want to create a&amp;nbsp;unique&amp;nbsp;lists, this can be done in various ways but since .NET3.5 a new method called HASHSET was created&lt;br /&gt;
&lt;br /&gt;
Hash Set on MSDN: &amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb359438.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/bb359438.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Some code I can across recently used SortedList and I wanted to see how this compared to HashSet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;So I set about testing a simple sting write and read 50,000; code below&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
SortedList&lt;t&gt;&lt;/t&gt;&lt;/h4&gt;
&lt;t&gt;&lt;/t&gt;&lt;br /&gt;
&lt;div style=&quot;border: solid 1px black; padding: 3px;&quot;&gt;
&lt;pre&gt; 
private static void RunSortedList(&lt;string string=&quot;string&quot;&gt;)
        {
             SortedList&lt;string string=&quot;string&quot;&gt; SortedString = new SortedList&lt;string string=&quot;string&quot;&gt;();     
       
            // Sorted List WRITE TEST
            var SLWStart = DateTime.Now;
            for (int i = 1; i &amp;lt; 50000; i++)
            {
                SortedString.Add(i.ToString(), i.ToString());
            }
            var SLWStop = DateTime.Now;
            var SLWT = SLWStop - SLWStart;
            Console.WriteLine(&quot; Sorted List Write Diff : &quot; + SLWT.Ticks);


            /// SORTED LIST READ TEST
            var SLRStart = DateTime.Now;
            foreach (var s in SortedString)
            {
                var mystr = s.Value + &quot; &quot;;
            }
            var SLRStop = DateTime.Now;
            var SLRT = SLRStop - SLRStart;
            Console.WriteLine(&quot; Sorted List Read Diff : &quot; + SLRT.Ticks);
        }

&lt;/string&gt;&lt;/string&gt;&lt;/string&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
HashSet&lt;t&gt;&lt;/t&gt;&lt;/h4&gt;
&lt;div style=&quot;border: solid 1px black; padding: 3px;&quot;&gt;
&lt;pre&gt; private static void RunHasSet(&lt;string&gt;)
        {

            HashSet&lt;string&gt; HashString = new HashSet&lt;string&gt;();
            // Sorted List WRITE TEST
            var HSWStart = DateTime.Now;
            for (int i = 1; i &amp;lt; 50000; i++)
            {
                HashString.Add(i.ToString());
            }
            var HSWStop = DateTime.Now;
            var HSWT = HSWStop - HSWStart;
            Console.WriteLine(&quot; HastSet Write Diff : &quot; + HSWT.Ticks);


            /// SORTED LIST READ TEST
            var HSRStart = DateTime.Now;
            foreach (var s in HashString)
            {
                var mystr = s + &quot; &quot;;
            }
            var HSRStop = DateTime.Now;
            var HSRT = HSRStop - HSRStart;
            Console.WriteLine(&quot; HastSet Read Diff : &quot; + HSRT.Ticks);
        }

&lt;/string&gt;&lt;/string&gt;&lt;/string&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
And just for a&amp;nbsp;comparison&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
List&lt;t&gt;&lt;t&gt;&amp;nbsp;&lt;/t&gt;&lt;/t&gt;&lt;/h4&gt;
&lt;div style=&quot;border: solid 1px black; padding: 3px;&quot;&gt;
&lt;pre&gt;private static void RunSortedList(&lt;string string=&quot;string&quot;&gt;)
        {
             SortedList&lt;string string=&quot;string&quot;&gt; SortedString = new SortedList&lt;string string=&quot;string&quot;&gt;();
            
            // Sorted List WRITE TEST
            var SLWStart = DateTime.Now;
            for (int i = 1; i &amp;lt; 50000; i++)
            {
                SortedString.Add(i.ToString(), i.ToString());
            }
            var SLWStop = DateTime.Now;
            var SLWT = SLWStop - SLWStart;
            Console.WriteLine(&quot; Sorted List Write Diff : &quot; + SLWT.Ticks);


            /// SORTED LIST READ TEST
            var SLRStart = DateTime.Now;
            foreach (var s in SortedString)
            {
                var mystr = s.Value + &quot; &quot;;
            }
            var SLRStop = DateTime.Now;
            var SLRT = SLRStop - SLRStart;
            Console.WriteLine(&quot; Sorted List Read Diff : &quot; + SLRT.Ticks);
        }
&lt;/string&gt;&lt;/string&gt;&lt;/string&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This was run multiple times via a console&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Collecion&lt;/th&gt; &lt;th&gt;Write &lt;/th&gt; &lt;th&gt;Read &lt;/th&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;HashSet &lt;/td&gt; &lt;td&gt;90,009&lt;/td&gt; &lt;td&gt;20,002 &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;SortedList &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/td&gt; &lt;td&gt;4,780,478 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/td&gt;&lt;td&gt;70,007&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;List&lt;/td&gt; &lt;td&gt;60,006 &lt;/td&gt; &lt;td&gt;20,002 &lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
Conclusion&lt;/h4&gt;
HashSet is a lot faster than SortedList. List as expected was fastest when writing but HastSets was exactly as fast at reading.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;b&gt;Testing Issues&lt;/b&gt;&lt;/h4&gt;
I did run all the tests at the same time and the results varied depending on the order they were run in. &amp;nbsp;so when testing for speed it is best to test in isolation.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/7237635475541907734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2012/11/c-unique-list-testing-little-testing-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7237635475541907734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/7237635475541907734'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2012/11/c-unique-list-testing-little-testing-of.html' title='C# Unique List Testing :  A little testing of collections.'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3455888999808240896.post-4101283125627604106</id><published>2012-11-08T23:30:00.003+00:00</published><updated>2012-11-08T23:30:53.328+00:00</updated><title type='text'>Empty Collection Pattern</title><content type='html'>I&#39;m sure this is likely a pattern that is called something else, but I tend to use this quite a lot especially in Application Facade layers where I really don&#39;t want to return nulls. I generally use LIST&lt;t&gt; rather than IEnumerable&lt;t&gt; as this is more useful for counts etc..&lt;/t&gt;&lt;/t&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Background&lt;/b&gt;&lt;br /&gt;
I have always been amazed at how many applications crash when they don&#39;t have data in them, i.e. an empty database table produces exceptions because an objection collection call returns NULL. This pattern will prevent this (up to a point).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Advanatages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Calling layers don&#39;t have to worry about NULLS&lt;/li&gt;
&lt;li&gt;Its simply and it works without creating to much clutter.&lt;/li&gt;
&lt;li&gt;Empty collections are easy to work with&lt;/li&gt;
&lt;li&gt;If you say you are returning a collection you better return one, even if it is empty.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static List&lt;person&gt; GetPeople()&lt;/person&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;CREATE AN EMPTY LIST&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var result = new List&lt;person&gt;();&lt;/person&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // GO TO DB AND GET RESULTS&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var connectionString = &quot;mongodb://localhost/?safe=true&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var server = MongoServer.Create(connectionString);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var database = server.GetDatabase(&quot;test&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var collection = database.GetCollection&lt;person&gt;(&quot;people&quot;);&lt;/person&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var getall = collection.FindAll().ToList();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add results if any to the collection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.AddRange(getall); &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // RETURN LIST (WHICH MAY BE EMPTY)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return result;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rundevrun.blogspot.com/feeds/4101283125627604106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rundevrun.blogspot.com/2012/11/empty-collection-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/4101283125627604106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3455888999808240896/posts/default/4101283125627604106'/><link rel='alternate' type='text/html' href='http://rundevrun.blogspot.com/2012/11/empty-collection-pattern.html' title='Empty Collection Pattern'/><author><name>Frank Kerrigan</name><uri>http://www.blogger.com/profile/10863646763723213982</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>