<?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-7549567</id><updated>2025-12-24T16:03:22.136+08:00</updated><category term=".NET"/><category term="Layered Architecture"/><category term="Casual"/><category term="Developer Community"/><category term="Windows Azure"/><category term="Work Life"/><category term="Life"/><category term="Visual Studio"/><category term="C#"/><category term="Cloud Computing"/><category term="Home"/><category term="Windows"/><category term="3-tier"/><category term="Games"/><category term="WCF"/><category term="Windows Communication Foundation"/><category term="Windows Workflow Foundation"/><category term="N-tier"/><category term="Web Development"/><category term="Code"/><category term="WF"/><category term="ASP.NET MVC"/><category term="ASP.NET Web API"/><category term="ASP.NET Web Forms"/><category term="LASG"/><category term="Visual Studio Team System"/><category term="SharePoint"/><category term="Guidance Automation"/><category term="SQL Azure"/><category term="SQL Server"/><category term="Certification"/><category term="IIS"/><category term="REST"/><category term="XBOX"/><category term="Electronics"/><category term="IoT"/><category term="Silverlight"/><category term="Windows Phone Development"/><category term="Raspberry Pi"/><category term="Team Foundation Server"/><category term="ASP.NET SignalR"/><category term="Arduino"/><category term="Entity Framework"/><category term="MVP"/><category term="Paladin"/><category term="Windows Server"/><category term="ASP.NET"/><category term="Android"/><category term="Android Games"/><category term="AppFabric for Windows Server"/><category term="MEGA"/><category term="MVVM"/><category term="MacBook"/><category term="Mobile Games"/><category term="Model Binding"/><category term="Nokia"/><category term="Racing Games"/><category term="UNO"/><category term="WAS"/><title type='text'>Firedancer Unleashed!</title><subtitle type='html'>Just part of my life ...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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>667</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7549567.post-224214470210331309</id><published>2016-07-31T19:01:00.001+08:00</published><updated>2016-08-01T08:25:01.083+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Electronics"/><category scheme="http://www.blogger.com/atom/ns#" term="IoT"/><category scheme="http://www.blogger.com/atom/ns#" term="MEGA"/><category scheme="http://www.blogger.com/atom/ns#" term="UNO"/><title type='text'>Arduino UNO: Proto Shield Review</title><content type='html'>If you have just gotten yourself an Arduino UNO and wondering &lt;i&gt;&quot;what&#39;s next?&quot; -&lt;/i&gt;&amp;nbsp;Well, a good start will be to light up some LEDs (a.k.a. &lt;i&gt;The &quot;Helloworld&quot; of electronics&lt;/i&gt;). You will of course need to purchase the components (such as LEDs, Resistors, Breadboard, Jumper Wires etc.) separately but if you do not want too much hassle, enter the world of Arduino Shields. You can quickly get started with basic electronic concepts using this &lt;b&gt;Proto Shield&lt;/b&gt; designed for the Arduino UNO, which you can get it off cheap from eBay or AliExpress.&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/AVvXsEik0vZGpEGAakybTCp5Sq9K7Qnsedjpl6iTxprISw9Vtfneejaqz6_gOIMOVAPaW37ym5nkwuGTLNhazw_GOKMsv40HWnYeZH9klauvNSIqZ3tPuUACyeXRUOo8o92CvkoS7mlR/s1600/proto-top-bb.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik0vZGpEGAakybTCp5Sq9K7Qnsedjpl6iTxprISw9Vtfneejaqz6_gOIMOVAPaW37ym5nkwuGTLNhazw_GOKMsv40HWnYeZH9klauvNSIqZ3tPuUACyeXRUOo8o92CvkoS7mlR/s320/proto-top-bb.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This is a very basic (and cheap) version that comes with:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;2 x LEDs (wired-up to 2 resistors)&lt;/li&gt;
&lt;li&gt;1 x Button&lt;/li&gt;
&lt;li&gt;5 x extra 5V female pins&lt;/li&gt;
&lt;li&gt;5 x extra GND female pins&lt;/li&gt;
&lt;li&gt;1 x 170 pin breadboard (separate piece)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Note: There are of course more sophisticated ones (with more features) that you can find online but they usually cost more. Some vendors may provide this as a kit and you will need to solder everything yourself. This one I got was fully assembled on arrival.&lt;br /&gt;
&lt;br /&gt;
The center of the shield allows you to place a tiny 170-pin breadboad for prototyping or solder in your own components to make things more permanent. Take note that the center design of the shield may vary from vendor-to-vendor and is not standardized. I would recommend that you do not stick the breadboard onto the shield and also to make sure that the breadboard you are placing onto the shield does not have its back metal strips exposed (or you will risk shorting out your shield or worst - the UNO).&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/AVvXsEjsGBAkwc_Amt6PWgpl5Cp-QRTe4PJF7_Bl3DZhMbbfLX37IIiKJee2GhqPWMwAussY3QQtY9xTvKdeEAiySinEXLj6OGN95utx733mUqN69sazhkv79LXeaocpJoygSnScFTn-/s1600/proto-top.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsGBAkwc_Amt6PWgpl5Cp-QRTe4PJF7_Bl3DZhMbbfLX37IIiKJee2GhqPWMwAussY3QQtY9xTvKdeEAiySinEXLj6OGN95utx733mUqN69sazhkv79LXeaocpJoygSnScFTn-/s320/proto-top.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
A caveat that you should know about this shield is that it is not stackable. If you noticed, the space between the rows of pin headers at the top and bottom are not aligned for the next shield (because the Chinese did not only cloned the board, they also cloned the problem). You can probably fix it by de-soldering the pin headers and replacing them with the ones you desire or get a version of the shield that allows stacking. Since I am a&amp;nbsp;&lt;i&gt;noob&lt;/i&gt;, I will have to live with the defective design of this shield.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Testing the Shield&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Before you start thinking (like me initially) that you can immediately blink LEDs on this, take note that you will still need a few male-to-male&amp;nbsp;&lt;b&gt;Jumper Wires&lt;/b&gt;&amp;nbsp;to connect the LEDs to the pins. Noticed the tiny little holes marked with the labels -&amp;nbsp;&lt;b&gt;LED1&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;LED2&lt;/b&gt;? That&#39;s where you need to poke the jumper wires.&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/AVvXsEh6T-lOBnArasBlrefqYsnVTy1k5N2fDBcA9pvP2AWrItaicU1YNRlz0dAWS8LhIC6OB5mYuuUVUXCoZGs2lHj8oopM32OooxKrXSZqnmjOWmmvY1-CWxIvkTbzrc6ZzXhqXFpw/s1600/proto-cut-out.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;105&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6T-lOBnArasBlrefqYsnVTy1k5N2fDBcA9pvP2AWrItaicU1YNRlz0dAWS8LhIC6OB5mYuuUVUXCoZGs2lHj8oopM32OooxKrXSZqnmjOWmmvY1-CWxIvkTbzrc6ZzXhqXFpw/s320/proto-cut-out.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also a tiny hole with the&amp;nbsp;label&lt;b&gt;&amp;nbsp;+&amp;nbsp;&lt;/b&gt;beside the&amp;nbsp;&lt;b&gt;S1&amp;nbsp;&lt;/b&gt;push&amp;nbsp;button for you to learn inputs (like clicking a button in your app). Don&#39;t get confused with the&amp;nbsp;&lt;b&gt;RESET&lt;/b&gt;&amp;nbsp;button - most Arduino Shields comes with a reset button for you to &quot;reboot&quot; your board.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;#1 - Basic Test&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To test out the shield, upload the following sketch to your UNO. It is just a simple program that turns LED1 on and then swap to turn on LED2 instead when you press the push button. When you release the button, it will switch back to turn on LED1.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #eeeeee;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define LED1 13&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define LED2 12&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define BUTTON 11&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;static int _buttonState = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void setup() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Setup pins.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; pinMode(LED1, OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; pinMode(LED2, OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Pull-up Button pin.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; digitalWrite(BUTTON, HIGH);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void loop() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Read button state.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; _buttonState = digitalRead(BUTTON);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Swap lightings.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; digitalWrite(LED1, _buttonState);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; digitalWrite(LED2, !_buttonState);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Disconnect the UNO from the computer and attach the shield. Then proceed to make the following hardware connections:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;LED1 -&amp;gt; Pin 13&lt;/li&gt;
&lt;li&gt;LED2 -&amp;gt; Pin 12&lt;/li&gt;
&lt;li&gt;+ (S1) -&amp;gt; Pin 11&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Once it is done. Connect the UNO to your computer and test the shield. LED2 should light up and LED1 will turn off when you press the button.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgoJzUUxtCzeW0c5vJ914Wl6HKrjDn7tmlTj0X23Lbr64gMjHyClQv8IRzdt4xotShoCFBY2ftAUWXDsEXHDwGu5AdM2raMkXQ_k95n3x_JYdJNMztLztt_Hbrp9-sUi9c4IJIG/s1600/proto-test-01.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;256&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoJzUUxtCzeW0c5vJ914Wl6HKrjDn7tmlTj0X23Lbr64gMjHyClQv8IRzdt4xotShoCFBY2ftAUWXDsEXHDwGu5AdM2raMkXQ_k95n3x_JYdJNMztLztt_Hbrp9-sUi9c4IJIG/s640/proto-test-01.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#2 - Chase LEDs&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Let&#39;s try out something a little bit more interesting. We will wire-up 4 LEDs onto the tiny breadboard with some resistors and create the &#39;Chase LED&#39; effect. Uploading the following sketch to your UNO:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #eeeeee;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define LED1 13&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define LED2 12&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define LED3 11&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define LED4 10&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define TOTAL_LEDS 4&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define BUTTON 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define ON &amp;nbsp;LOW&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define OFF HIGH&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;static int LEDS[] = { LED1, LED2, LED3, LED4 };&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;static int _pos = -1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;static bool _forward = true;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void setup() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Setup pins.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; for(int i = 0; i &amp;lt; TOTAL_LEDS; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; pinMode(LEDS[i], OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Pull-up Button pin.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; digitalWrite(BUTTON, HIGH); &amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void loop() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; if (!digitalRead(BUTTON)) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; setDirection();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; blink(100);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void setDirection() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Increase _position if have not reached the end.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; if (_forward &amp;amp;&amp;amp; _pos &amp;lt; TOTAL_LEDS - 1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; _pos++;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Decrease _positon if have not reached the beginning.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; else if (!_forward &amp;amp;&amp;amp; _pos &amp;gt; 0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; _pos--;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Set to Forward if reached beginning.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; if (_pos &amp;lt;= 0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; _forward = true;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; // Set to Backward if reached end.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; else if (_pos &amp;gt;= TOTAL_LEDS - 1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; _forward = false;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void blink(int pause)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; digitalWrite(LEDS[_pos], HIGH);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; delay(pause);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; digitalWrite(LEDS[_pos], LOW);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; delay(pause);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Disconnect the UNO and proceed to make the following connections onto the tiny breadboard:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Blue LED (Anode +ve) -&amp;gt; Pin 13&lt;/li&gt;
&lt;li&gt;Green LED&amp;nbsp;(Anode&amp;nbsp;+ve)&amp;nbsp;-&amp;gt; Pin 12&lt;/li&gt;
&lt;li&gt;Yellow LED&amp;nbsp;(Anode&amp;nbsp;+ve) -&amp;gt; Pin 11&lt;/li&gt;
&lt;li&gt;Red LED&amp;nbsp;(Anode&amp;nbsp;+ve) -&amp;gt; Pin 10&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Important! Make sure all the LEDs are connected to resistors of at least 220 ohm.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You will now discover that the lack of a power rail on the tiny breadboad is a challenge for you to connect the LEDs to the GND pin. Fortunately, the Proto Shield came with a row of GND Pin Header that you can use. &lt;b&gt;Connect all the LEDs to GND&lt;/b&gt;.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Blue LED (Cathode -ve) -&amp;gt; 220 ohm Resistor -&amp;gt; GND&lt;/li&gt;
&lt;li&gt;Green LED&amp;nbsp;(Cathode&amp;nbsp;-ve)&amp;nbsp;-&amp;gt;&amp;nbsp;220 ohm Resistor -&amp;gt; GND&lt;/li&gt;
&lt;li&gt;Yellow LED&amp;nbsp;(Cathode&amp;nbsp;-ve) -&amp;gt;&amp;nbsp;220 ohm Resistor -&amp;gt; GND&lt;/li&gt;
&lt;li&gt;Red LED&amp;nbsp;(Cathode&amp;nbsp;-ve) -&amp;gt;&amp;nbsp;220 ohm Resistor -&amp;gt; GND&lt;/li&gt;
&lt;/ul&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/AVvXsEj4_cHesniolcbUGDgPsZVb3ejQGx0gXisfbCfttrJ3-Vk4jMYvEPG70N-Tt9z9N_TO7TYvxBjGEsHOef9jQBRDI0yzQq308bBEVm4symuGrV2ued6252eb4SI6VGE9geaAxfsJ/s1600/chase-led.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;274&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4_cHesniolcbUGDgPsZVb3ejQGx0gXisfbCfttrJ3-Vk4jMYvEPG70N-Tt9z9N_TO7TYvxBjGEsHOef9jQBRDI0yzQq308bBEVm4symuGrV2ued6252eb4SI6VGE9geaAxfsJ/s320/chase-led.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Finally, connect the Proto Shield button to Pin 7:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;+ (S1) -&amp;gt; Pin 7&lt;/li&gt;
&lt;/ul&gt;
Your completed wiring should look something like the following picture:&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/AVvXsEjNucY6YQM_tWR4dhNOhfzBc5XaKRO3aQxn1dbHixPVlk60fzLcYU7nWS-uZkH5C6IO9BnNzbwsd32oNqmS265B-YMUL22-GpFA84_6wqHZIEBbnnq81jE0H-u71EeoypDKuooQ/s1600/chase-led-wire-up.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;297&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNucY6YQM_tWR4dhNOhfzBc5XaKRO3aQxn1dbHixPVlk60fzLcYU7nWS-uZkH5C6IO9BnNzbwsd32oNqmS265B-YMUL22-GpFA84_6wqHZIEBbnnq81jE0H-u71EeoypDKuooQ/s400/chase-led-wire-up.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Check all your connections to make sure that they are correct. Connect your UNO to your Computer and press the button on the Proto Shield to run the chase effect.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.blogger.com/video.g?token=AD6v5dx0KZlhanL_kzBOE0ob3tPPEEGsNWexy-os8oSth_Z5OqOLj9SSqURe6pOezQxdVVuR9dGXc9mJd0A&#39; class=&#39;b-hbp-video b-uploaded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Summary&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
That&#39;s all to it for the Proto Shield.&amp;nbsp;If you are a seasoned electronics person or have some experience with the Raspberry Pi, you will noticed that the Arduino&#39;s pin design is somewhat not very convenient for external breadboads without longer jumper wires, due to the positioning of the pins along the edge of the board. Therefore, you may find the Proto Shield useful as well for little projects.&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/AVvXsEg1rji6eqVB3zBhNobvvkamVyCh4kdTVLrhr7udSueVIjC4_u7DbY8EmyWvaSFQvbNE6wmIzbYzEGKE7wRUmUOo3LvhqZNVNgdb7KoOC30pbtWZzpn669c_-iMtUJqowmv4e_Hq/s1600/proto-shield.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;202&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1rji6eqVB3zBhNobvvkamVyCh4kdTVLrhr7udSueVIjC4_u7DbY8EmyWvaSFQvbNE6wmIzbYzEGKE7wRUmUOo3LvhqZNVNgdb7KoOC30pbtWZzpn669c_-iMtUJqowmv4e_Hq/s320/proto-shield.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Category&lt;/div&gt;
&lt;/th&gt;&lt;th&gt;&lt;div style=&quot;text-align: left; width: 150px;&quot;&gt;
Ratings&lt;/div&gt;
&lt;/th&gt;&lt;th&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Comments&lt;/div&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Easy to Learn&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;div style=&quot;clear: both;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;Extremely easy to use even with basic electronics knowledge. No rocket science required.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Availability of Resources&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/td&gt;
&lt;td&gt;Resources and samples are abundance but may be different from vendor-to-vendor.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Built-In Features&lt;/td&gt;&lt;td&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/td&gt;
&lt;td&gt;A button and 2 LEDs with matching resistors. Nothing fancy.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Customizability&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/td&gt;
&lt;td&gt;Can solder your own components onto it but space to put breadboard for prototyping maybe too small.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Extensibility&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/td&gt;&lt;td&gt;Not stackable but exposes pin headers to connect to other modules and components.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Length of Excitement&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/td&gt;
&lt;td&gt;Can learn all the features quickly. Will get bored very fast.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Price&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOUGgRkhdiusP3qQ4mIZvCu1jYlxGDjkSN6bBCUJecrMqEBE05_YnMYJ0m1-8YQP3_yFlqJDCqdVkyh5CUghEz0UElyWTFKxMecIq8T23jYq0RdmRnWMnat1jxaYgAjLdYE2E/s200/star.png&quot; style=&quot;border: 0px; margin: 0px; padding: 0px;&quot; width=&quot;30&quot; /&gt;&lt;/td&gt;
&lt;td&gt;Good value and quite cheap.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;b&gt;Origin:&amp;nbsp;&lt;/b&gt;I suspect this shield originated from&amp;nbsp;&lt;a href=&quot;https://www.adafruit.com/product/51&quot;&gt;Adafruit&lt;/a&gt;&#39;s earlier creations. Since Adafruit published the designs for people to use, I guessed anyone can actually manufacture the similar thing. But you will notice that this shield has a few missing items from the original design i.e. the two 0.1uF Capacitors. Adafruit no longer produces this shield but instead sells an&amp;nbsp;&lt;a href=&quot;https://www.adafruit.com/products/2077&quot;&gt;updated version&lt;/a&gt;&amp;nbsp;that is stackable.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/224214470210331309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/224214470210331309' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/224214470210331309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/224214470210331309'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2016/07/arduino-uno-proto-shield.html' title='Arduino UNO: Proto Shield Review'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEik0vZGpEGAakybTCp5Sq9K7Qnsedjpl6iTxprISw9Vtfneejaqz6_gOIMOVAPaW37ym5nkwuGTLNhazw_GOKMsv40HWnYeZH9klauvNSIqZ3tPuUACyeXRUOo8o92CvkoS7mlR/s72-c/proto-top-bb.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-8890327954154007813</id><published>2016-07-24T14:30:00.000+08:00</published><updated>2016-10-18T15:15:37.785+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Electronics"/><category scheme="http://www.blogger.com/atom/ns#" term="IoT"/><category scheme="http://www.blogger.com/atom/ns#" term="Raspberry Pi"/><title type='text'>Beginning Arduino for Software Engineers</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
While exploring the realm of electronics, I discovered that, like in the software industry, there were many&amp;nbsp;&lt;i&gt;camps &lt;/i&gt;and one of the camps that caught my attention was &lt;a href=&quot;http://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt;. It is an open source hardware company that existed for more than 10 years, much longer in existence than the &lt;a href=&quot;https://www.raspberrypi.org/&quot;&gt;Raspberry Pi&lt;/a&gt;. Its most successful and famous products to-date are the Arduino &lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoBoardUno&quot;&gt;UNO &lt;/a&gt;and &lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoBoardMega2560&quot;&gt;MEGA&lt;/a&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;
The main difference between the Arduino boards and Raspberry Pi is that the Arduino boards are &lt;a href=&quot;https://en.wikipedia.org/wiki/Microcontroller&quot;&gt;Microcontrollers&amp;nbsp;&lt;/a&gt;(MCU), whereas, a Raspberry Pi is a&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Single-board_computer&quot;&gt;Single-Board Computer&lt;/a&gt;&amp;nbsp;(SBC). It is often seen that both Arduino and Raspberry Pi can complement each other in an IoT solution, with the Arduino boards communicating with sensors, motors and the environment, while the Raspberry Pi acts as a gateway to consolidate telemetry data from the Arduino and sends them to the Cloud.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&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/AVvXsEisecCDByexQaOoCJ4Er7baiX5LUvDzUyQpXDPHa-QQs-vRIC-2tsKpT7Qvi_3-WDe5YX0kwpWDPEL7FEXTp0Nr7DhL2FU7GgUU4l2EpIYjk9-keAHNtmTx-pakZP9AOx1sZL9O/s1600/uno-and-pi.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;276&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisecCDByexQaOoCJ4Er7baiX5LUvDzUyQpXDPHa-QQs-vRIC-2tsKpT7Qvi_3-WDe5YX0kwpWDPEL7FEXTp0Nr7DhL2FU7GgUU4l2EpIYjk9-keAHNtmTx-pakZP9AOx1sZL9O/s640/uno-and-pi.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Being a MCU means that the Arduino board doesn&#39;t have enough processing power or storage capacity for you to load an operating system onto it (Yep! You can&#39;t load &lt;a href=&quot;https://developer.microsoft.com/en-us/windows/iot&quot;&gt;Windows 10 IoT&lt;/a&gt; onto it). You program directly onto its chip which makes it perform more efficiently without all the overheads of an operating 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;
One good thing about Arduino is that it is open source hardware. You maybe wondering what does that mean? It simply means that all the designs and schematics of the hardware are published (in what is known as Eagle files) and available to the public. Any interested manufacturer (or even yourself) can use the designs to come out with own versions of Arduino boards and that&#39;s the reason why, you see a lot of Arduino boards out there with names like &lt;i&gt;something-something-uino&lt;/i&gt;, especially from China which I think contributed to the popularity and wide-spread of the UNO and MEGA boards.&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;
In my perspective, Arduino is like Android where everything is open-source and everyone is free to create their own version and sell it, creating lots of fragmentation and confusion, whereas, Raspberry Pi is like Apple, everything is controlled by a single organization and not to mention having lots of expensive accessories.&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;
So far, we have just been talking about Arduino as the hardware. Arduino also comes with an &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;IDE&lt;/a&gt; that we can use to develop our programs. The programming language of choice is Arduino C, a variant of C which is not too difficult to learn. I somehow have difficulties in mastering the C programming language - so I&#39;m still struggling with it right now. &amp;gt;_&amp;lt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgbJDWdmopljq6D2Z90yeDE3KxEPr7OrW7HS5ecqp8Ium-DdQi-9nM4_a40KYbipvmY_ZpL9oVj9M-kdCaKz2UHFHnHKgi4n_L_7J8NZK5VVl_ZpDw2DX-KdsUDHuFHTI3wROeX/s1600/arduino-ide.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;608&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbJDWdmopljq6D2Z90yeDE3KxEPr7OrW7HS5ecqp8Ium-DdQi-9nM4_a40KYbipvmY_ZpL9oVj9M-kdCaKz2UHFHnHKgi4n_L_7J8NZK5VVl_ZpDw2DX-KdsUDHuFHTI3wROeX/s640/arduino-ide.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&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;
Compared to Visual Studio (the best IDE on the planet), the Arduino IDE looks very primitive but it gets the job done. You just need to tell yourself that you are using a slightly better notepad and that you are debugging like Classic ASP. You can immediately learn a lot of things from the samples that comes with the IDE (provided you know how to wire-up the electronics part first). You also need to know that there are no emulators for you to work on unlike mobile development, so every time you make a coding mistake, you need to burn your program again to the chip. (After too many burns, the chip will&amp;nbsp;meet its end-of-life).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&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/AVvXsEi4Jl7pR-9K3WU_Ns0Ls42uV74eXL6q1uYm6yI2cgXO8Ubu1ETZS5PkVaYkzttvSocW4ERag-BLb_r8c0KLCRURfXxMYDyFBN-39anxz4O0z9gNNMzDYJ4rwVtNMNJX6NPM44Ts/s1600/arduino-ide-examples.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;609&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Jl7pR-9K3WU_Ns0Ls42uV74eXL6q1uYm6yI2cgXO8Ubu1ETZS5PkVaYkzttvSocW4ERag-BLb_r8c0KLCRURfXxMYDyFBN-39anxz4O0z9gNNMzDYJ4rwVtNMNJX6NPM44Ts/s640/arduino-ide-examples.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&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;
Adding more confusion to Arduino is that the founders are currently fighting over legal trademarks and the rights to use the Arduino brand. There is actually an Arduino LLC that runs &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino.cc&lt;/a&gt; and Arduino SRL that runs &lt;a href=&quot;http://www.arduino.org/&quot;&gt;Arduino.org&lt;/a&gt;. Both of them used the same logo. Arduino.org also forked the Arduino IDE creating a lot of confusion to people. To me, I just think that the founders should just be friends and not fight - fighting is&amp;nbsp;bad for consumers.&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 will realized that the UNO and MEGA are like 6 years old boards and after their release, the other boards like &lt;a href=&quot;http://www.arduino.org/products/boards/arduino-due&quot;&gt;DUE&lt;/a&gt;, &lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoBoardZero&quot;&gt;ZERO&lt;/a&gt; and etc. do not have much uptake. Anyway, some people said that it is because the newer boards are all 3V3 (like the Raspberry Pi) and the UNO/MEGA boards are still 5V which is easier to work with and has more compatible components out there. There are also some who said that maybe China has not gotten their hands on the Eagle files yet (i.e. the ZERO).&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;
Nevertheless, I hope the Arduino folks can get their act together and focus on their innovation because I&#39;m quite interested in the Arduino &lt;a href=&quot;http://www.arduino.org/products/boards/arduino-primo&quot;&gt;PRIMO&lt;/a&gt; and &lt;a href=&quot;http://www.arduino.org/products/boards/arduino-star-otto&quot;&gt;OTTO&lt;/a&gt; by Arduino SRL. Hopefully, everything will be settled and we will have better toys to play with.&lt;br /&gt;
&lt;br /&gt;
[Update: On 1st October 2016, both the Arduino companies have reached a &lt;a href=&quot;https://blog.arduino.cc/2016/10/01/two-arduinos-become-one-2/&quot;&gt;settlement&lt;/a&gt; with each other and have agreed to bring their innovations to the market together.]&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;
OK, after all that long introduction, I would like to say that it is pretty difficult, confusing and quite&amp;nbsp;expensive to get an Arduino board in Malaysia. Also, since we are outside the US market, we are supposed to get Genuino boards. You can get them from some local online sites if they carry stock.&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;
Most of the people I know, get those cheap unbranded version from ebay or AliExpress for less than RM15 (a.k.a &lt;i&gt;Cinanos&lt;/i&gt;). Those usually come with CH340G chip (instead of the ATMEGA chip) which you may need to go through some installation acrobatics to get it working. I have not heard complaints from anyone yet but I think they serve as a good platform for learning - you know, just in-case you plug something in wrongly and see blue smoke coming out.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgUh8W8bzR9rFATmPgA-o3hhS4xTOtqPzAZZxfgoQD3E2TAZ8dmg6VQ4DguTPrN8DZrIJ2YvZCZ491hzus5U2MzX2-FtqketVtc5gV1ZKcaU0lmQUlmN1sXfRG5j1Byp0WJSWTj/s1600/cinano-uno.jpg&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/AVvXsEgUh8W8bzR9rFATmPgA-o3hhS4xTOtqPzAZZxfgoQD3E2TAZ8dmg6VQ4DguTPrN8DZrIJ2YvZCZ491hzus5U2MzX2-FtqketVtc5gV1ZKcaU0lmQUlmN1sXfRG5j1Byp0WJSWTj/s1600/cinano-uno.jpg&quot; /&gt;&lt;/a&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;
For me, I bought my &lt;a href=&quot;http://www.sainsmart.com/arduino/control-boards/sainsmart-uno-r3-atmega328-au-development-board-compatible-with-arduino-uno-r3.html&quot;&gt;UNO&lt;/a&gt; and &lt;a href=&quot;http://www.sainsmart.com/arduino/control-boards/sainsmart-mega2560-r3-development-board-compatible-with-arduino-mega2560-r3.html&quot;&gt;MEGA&lt;/a&gt;&amp;nbsp;from &lt;a href=&quot;http://www.sainsmart.com/&quot;&gt;SainSmart&lt;/a&gt;&amp;nbsp;(also China). The reason I bought from them is because they are still using the ATMEGA chip, uses same USB port-type as the original and they have put in some modifications onto the board by providing (minor) extra features and pins which is good for my learning. The board also look very stylish&amp;nbsp;but the cost is higher than the &lt;i&gt;Cinanos &lt;/i&gt;though.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgbIWFRnxk9P1To2bBiaArEVVM3kFiGOiCwYdYcvkp6iKZB0spsn3u3cblOzVcXww7vAFLW9kPqLhHWeI93LeXbYZYJKistQLq89XZuX9Y-4kGAMrI6p9jsv95XDFntLQj1H7K9/s1600/sainsmart-uno.jpg&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/AVvXsEgbIWFRnxk9P1To2bBiaArEVVM3kFiGOiCwYdYcvkp6iKZB0spsn3u3cblOzVcXww7vAFLW9kPqLhHWeI93LeXbYZYJKistQLq89XZuX9Y-4kGAMrI6p9jsv95XDFntLQj1H7K9/s1600/sainsmart-uno.jpg&quot; /&gt;&lt;/a&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;
Whatever &lt;i&gt;Cinano&lt;/i&gt; version that you are getting, just make sure that there is a poly-fuse beside the USB port to protect your PC from overcurrent. Older versions do&amp;nbsp;not have them and you will risk frying your PC&#39;s USB port if you plug in something wrongly.&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;
In my opinion, I felt that it is much easier to work-on and pickup electronic concepts with the Arduino as compared to the Raspberry Pi. The only challenge with the Arduino right now is the complexity you need to go through to enable it for IoT. There are WiFi shields (ESP8266 and&amp;nbsp;&lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoYunShield&quot;&gt;YUN&lt;/a&gt;) and modified boards that you can use, but they all look like &quot;patches&quot; or &quot;add-ons&quot; instead of a truly integrated system. However, this may change in the future with the PRIMO.&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 hope I gave you enough insights to get started on Arduino.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/8890327954154007813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/8890327954154007813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8890327954154007813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8890327954154007813'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2016/07/beginning-arduino-for-software-engineers.html' title='Beginning Arduino for Software Engineers'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEisecCDByexQaOoCJ4Er7baiX5LUvDzUyQpXDPHa-QQs-vRIC-2tsKpT7Qvi_3-WDe5YX0kwpWDPEL7FEXTp0Nr7DhL2FU7GgUU4l2EpIYjk9-keAHNtmTx-pakZP9AOx1sZL9O/s72-c/uno-and-pi.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-3019314407346656179</id><published>2016-07-07T17:52:00.001+08:00</published><updated>2016-07-07T18:08:13.574+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Electronics"/><category scheme="http://www.blogger.com/atom/ns#" term="IoT"/><category scheme="http://www.blogger.com/atom/ns#" term="Raspberry Pi"/><title type='text'>Azure IoT SDK for Python on Raspberry Pi</title><content type='html'>After playing with my Raspberry Pi 2 for a while, I figured that it may be good to take it to the next level by looking into the Internet of Things (IoT). The concept IoT is pretty simple which is basically to upload data from sensors (Telemetry data) to the cloud for monitoring and analytics purposes. So, I just need to be looking at how I can upload some JSON data to a cloud storage.&lt;br /&gt;
&lt;br /&gt;
Since I have some basic working knowledge with Azure and since Microsoft has started supporting other platforms on Azure, I was thinking to maybe to skip Windows 10 IoT and try to get Azure working on my Pi2 with Python and Raspbian instead.&lt;br /&gt;
&lt;br /&gt;
Fortunately, I found out that there is an &lt;a href=&quot;https://azure-sdk-for-python.readthedocs.io/en/latest/&quot;&gt;Azure SDK for Python&lt;/a&gt;&amp;nbsp;from Microsoft. Although it is still in RC, it is already quite usable. Installing the Azure SDK for Python is straight forward on the Pi2. Simply enter the following in a &lt;b&gt;Terminal&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo pip3 install --pre azure&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Note: I used &lt;b&gt;pip3 &lt;/b&gt;because I am using &lt;b&gt;Python 3.5.1&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
I believe with the Azure SDK installed, we should somewhat be able to fulfill the basic requirements of uploading data to Azure storage. I have yet to test it because during the course of my research, I had found something even more awesome. Microsoft has actually released something called &lt;a href=&quot;https://www.microsoft.com/en-us/cloud-platform/internet-of-things-azure-iot-suite&quot;&gt;Azure IoT Suite&lt;/a&gt; and &lt;a href=&quot;https://azure.microsoft.com/en-us/services/iot-hub/&quot;&gt;Azure IoT Hub&lt;/a&gt;. Not only does it allow you to upload telemetry data to the cloud but it also allows you to manage/control your devices from the cloud. To my delight, there is also an &lt;a href=&quot;https://github.com/Azure/azure-iot-sdks/blob/master/python/device/readme.md&quot;&gt;Azure IoT Device SDK for Python&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Going through all the hands on tutorials on the &lt;a href=&quot;https://azure.microsoft.com/en-us/documentation/articles/iot-hub-csharp-csharp-getstarted/&quot;&gt;Azure IoT Hub site&lt;/a&gt;, I was convinced that I could use this on my Pi2. I tried to install the Azure IoT Device SDK on my Pi2 and this time it was not really that straight-forward anymore because most of the instructions were either for Windows or Ubuntu but fortunately, I got it working and here&#39;s how you can do it...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step #1 Clone the Repository&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Create a folder in your home directory on your Pi. I called mine &lt;b&gt;Sources&lt;/b&gt;. Open a &lt;b&gt;Terminal &lt;/b&gt;and navigate to the folder i.e. ~/Sources, then type:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo git clone --recursive git://github.com/Azure/azure-iot-sdks.git&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
After it is done, you will see an &lt;b&gt;azure-iot-sdks &lt;/b&gt;directory inside your &lt;b&gt;Sources&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step #2 Increase Swap File size&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;This is an important step. You need to do this or the compilation will fail.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The swap file configuration is located in &lt;b&gt;/etc/dphys-swapfile&lt;/b&gt;. You can edit it using any text editor. I will be using &lt;b&gt;nano &lt;/b&gt;to do it.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo nano /etc/dphys-swapfile&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
locate the line:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;CONF_SWAPSIZE=100&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and change it to:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;CONF_SWAPSIZE=1024&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&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/AVvXsEh5GaSCyN26IqxUOVZXtm5lhYHOYSR7p_smfoFWlshITTfaiTqjyM5qd6XH2BITJTawjceISorVOaxof7M3c4kvkcAjmTGKjzQckW8H1qoBvsK4gd2Gl1HWv5OjmLsUKz-EtJup/s1600/nano.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5GaSCyN26IqxUOVZXtm5lhYHOYSR7p_smfoFWlshITTfaiTqjyM5qd6XH2BITJTawjceISorVOaxof7M3c4kvkcAjmTGKjzQckW8H1qoBvsK4gd2Gl1HWv5OjmLsUKz-EtJup/s400/nano.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Save the file.&lt;br /&gt;
&lt;br /&gt;
Note: As I am a noob in Linux, I do not know what other side-effects the above settings will cause. If you are worried about it, you can always change it back after everything is done.&lt;br /&gt;
&lt;br /&gt;
After you have messed with the settings, you need to restart the swap:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/etc/dphys-swapfile stop&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/etc/dphys-swapfile start&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Note: It will take some time and it will look like everything is hanging and not responding but please don&#39;t panic.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step #3 Build the Azure IoT Device SDK for C&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Yes, you read it correctly. You need to build the sdk for C first. Make sure you have &lt;b&gt;cmake &lt;/b&gt;version 3.x or higher and &lt;b&gt;gcc &lt;/b&gt;version 4.9 or higher. If you are working on a new Raspberry Pi and have just installed Raspbian, you should be good to go.&lt;br /&gt;
&lt;br /&gt;
Change to the &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;~/Sources/azure-iot-sdks/c/build_all/linux&lt;/span&gt; directory&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;./setup.sh&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and after that, run:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;./build.sh&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You can get these instructions from &lt;a href=&quot;https://github.com/Azure/azure-iot-sdks/blob/master/c/doc/devbox_setup.md&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step #4 Fix the make file.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you proceed to follow the instructions given on the github site to compile the python &lt;b&gt;iothub_client&lt;/b&gt;, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;CMake Error at /usr/share/cmake-3.0/Modules/FindBoost.cmake:1198 (message):&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Unable to find the requested Boost libraries.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Boost version: 1.55.0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Boost include path: /usr/include&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Could not fine the following Boost libraries&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;boost_python-py35&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the locations of Boost.&lt;/span&gt;&lt;/div&gt;
I have filed it as an &lt;a href=&quot;https://github.com/Azure/azure-iot-sdks/issues/529&quot;&gt;issue&lt;/a&gt;. I&#39;m not sure if you will get the error if you are using python 2.7. I didn&#39;t bother to try. The error will mislead you into thinking you have a bad libboost installation but trust me, it is not.&lt;br /&gt;
&lt;br /&gt;
To solve the problem, edit the CMakeLists.txt file by loading it in a text editor:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo nano ~/Sources/azure-iot-sdks/python/device/iothub_client_python/CMakeLists.txt&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The line you are looking for is (Line 41 at time of writing):&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-size: 14px; line-height: 22.4px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;find_package(Boost COMPONENTS &quot;python-py${boost_python}&quot; REQUIRED)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Change it to:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-size: 14px; line-height: 22.4px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;find_package(Boost COMPONENTS &quot;python&quot; REQUIRED)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Save the file.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step #5 Build the Python IoTHub Client&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Change to the&amp;nbsp;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;~/Sources/azure-iot-sdks/python/build_all/linux&amp;nbsp;&lt;/span&gt;directory:&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;./setup.sh --python-version 3.5&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Then:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;./build.sh --build-python 3.5&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You can find the detail instructions &lt;a href=&quot;https://github.com/Azure/azure-iot-sdks/blob/master/doc/get_started/python-devbox-setup.md&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Get Started!&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now you can go to the&amp;nbsp;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;~/Sources/azure-iot-sdks/python/device/samples &lt;/span&gt;and start your journey into IoT.&lt;br /&gt;
&lt;br /&gt;
If you find all the electronics stuff in Raspberry Pi too intimidating and just want to jump straight to IoT, I will advice that you get a &lt;a href=&quot;https://www.raspberrypi.org/products/sense-hat/&quot;&gt;Raspberry Pi Sense HAT&lt;/a&gt;. It comes with all the basic sensors which is sufficient enough for you to explore Azure IoT and make your audience go wild in IoT presentations.&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/AVvXsEj8YuV040nVBRBcrL1TH5s5RIrta0ExFBre1SirTSujFJ-OUK_nFM1QUY7za7VttGIoVy7JIVUSq8J8ozobEe8iQVRIEjtx1vEQ9u8v8lvaUNwalN71wV0mI0mI5mFl8ulCgDzI/s1600/sensehat.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8YuV040nVBRBcrL1TH5s5RIrta0ExFBre1SirTSujFJ-OUK_nFM1QUY7za7VttGIoVy7JIVUSq8J8ozobEe8iQVRIEjtx1vEQ9u8v8lvaUNwalN71wV0mI0mI5mFl8ulCgDzI/s400/sensehat.png&quot; width=&quot;277&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
You can get it from &lt;a href=&quot;http://my.element14.com/&quot;&gt;element14&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Good luck and have fun!</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/3019314407346656179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/3019314407346656179' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3019314407346656179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3019314407346656179'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2016/07/azure-iot-sdk-for-python-on-raspberry-pi.html' title='Azure IoT SDK for Python on Raspberry Pi'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEh5GaSCyN26IqxUOVZXtm5lhYHOYSR7p_smfoFWlshITTfaiTqjyM5qd6XH2BITJTawjceISorVOaxof7M3c4kvkcAjmTGKjzQckW8H1qoBvsK4gd2Gl1HWv5OjmLsUKz-EtJup/s72-c/nano.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-4989439948328859067</id><published>2016-07-06T18:46:00.000+08:00</published><updated>2016-07-30T09:44:16.656+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Electronics"/><category scheme="http://www.blogger.com/atom/ns#" term="IoT"/><category scheme="http://www.blogger.com/atom/ns#" term="Raspberry Pi"/><title type='text'>Getting Started with Raspberry Pi</title><content type='html'>A couple of months back, I wasn&#39;t sure what hit me but I got myself a &lt;a href=&quot;https://www.raspberrypi.org/products/raspberry-pi-2-model-b/&quot;&gt;Raspberry Pi 2&lt;/a&gt;. It was also quite silly because my Pi 2 came two days after the released of &lt;a href=&quot;https://www.raspberrypi.org/products/raspberry-pi-3-model-b/&quot;&gt;Raspberry Pi 3&lt;/a&gt; *ARGHS!* Anyway, I had started playing with it since then and now I would like to share some of my experiences with other Software Engineers who maybe interested to get started with the Raspberry Pi.&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/AVvXsEii-kYsYDP7R-WgALoa5OspwanPbwN1IlXQgwgpEKxyxs3708xYyO7t-VMBQcftjJPuuRpEmkrMXHj98GaFlph9vX2KflACTLutLr2PBNNDdSPoW9X6MHRkVQX3hWFSryHpK1Qf/s1600/Pi3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii-kYsYDP7R-WgALoa5OspwanPbwN1IlXQgwgpEKxyxs3708xYyO7t-VMBQcftjJPuuRpEmkrMXHj98GaFlph9vX2KflACTLutLr2PBNNDdSPoW9X6MHRkVQX3hWFSryHpK1Qf/s320/Pi3.jpg&quot; width=&quot;176&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Short introduction - A Raspberry Pi is a low cost, low-power, credit card-sized computer that is developed by the &lt;a href=&quot;https://www.raspberrypi.org/&quot;&gt;Raspberry Pi Foundation&lt;/a&gt;&amp;nbsp;in the U.K., a non-profit organization with the noble goal of advancing computer science knowledge in adults and children. It is supported by the University of Cambridge Computer Library and Broadcomm.&lt;br /&gt;
&lt;br /&gt;
So what can a Software Engineer do with a Pi? Well, short-off trying to use it like a small computer, you can use it for various home automation projects, learn low-level programming, create little irritating autonomous robots (no vacuum cleaners though) and best of all, use it to delve into the world of Internet of Things (IoT). IoT is a big buzzword nowadays (together with Data Science) and it is set to boom in the upcoming years so it might be a good idea to equip yourself with some skills now. *HeHe*&lt;br /&gt;
&lt;br /&gt;
By now if you have googled for Raspberry Pi, you will see that it resembles a small mobo with familiar HDMI and USB ports, and being a Software Engineer, you would probably think it is no sweat! Here are some things I feel that you should know:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Don&#39;t Waste It As A Cheap PC&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Many people I knew thought to use the Raspberry Pi as cheap substitute for a PC. My advice is, if you can afford a PC, please forget about thinking to use the Raspberry Pi as a PC because at its processing power today, you will be frustrated (unless you don&#39;t mind the slowness). Some people also told me they want to use it to learn another operating system - fine, but if you wanna learn linux (yup, the official OS is a Linux variant), why not just virtualize a full-fledged environment to learn? (Ok, maybe it is the smaller size that makes it less scary).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Knowledge of Electronics&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The awesome thing about the Raspberry Pi is not really that it is a small PC but it is the row of pins you see on the board - the 40 GPIO pins. GPIO stands for General Purpose Input-Output and those pins are the key to the world of physical computing (and awesomeness). The GPIO pins will allow you to light up LEDs, read data from sensors, power up motors and servos and do all kinds of &lt;i&gt;tok-kong&lt;/i&gt;&amp;nbsp;stuff (interesting things).&lt;br /&gt;
&lt;br /&gt;
To make use of the GPIO pins, you will need some basic electronics knowledge which can be somewhat a challenge to some Software Engineers, particularly - Googlepers.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Know Your Stuff&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It is very common for Software Engineers to just google for code to get things done. What happens when you found bad code? - Just delete it and start over with zero risks. Your computer ain&#39;t gonna explode just because you googled an endless loop. Now things are a bit different when it comes to electronics - you need to know your stuff well.&lt;br /&gt;
&lt;br /&gt;
I spend a lot of time reading and re-reading before I even poke my first pin to the Pi. The reason for all these paranoia is because when you wire-up things wrongly, you will &quot;fry your Pi&quot; (and yes, it rhymes). You will also need to be careful when you google for stuff because there are times, the information you get could be different (i.e. different pins for your version of sensors) and you could just see smoke coming out from your precious Pi.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Running Windows 10 IoT&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
As I mentioned earlier, the official supported OS for the Raspberry Pi is Raspbian, a debian-based linux and you will be using Python to program it. &lt;i&gt;But what about Windows?&lt;/i&gt; Yes, you can install &lt;a href=&quot;https://developer.microsoft.com/en-us/windows/iot&quot;&gt;Windows 10 IoT&lt;/a&gt; on it (in fact, I got to know about Raspberry Pi after Microsoft made a big hoo-hah about it). However, the Windows 10 that you are going to get on the Raspberry Pi ain&#39;t gonna be the Windows that you are familiar with (and NO it is not just a command prompt like Windows Server Core - it is something more different).&lt;br /&gt;
&lt;br /&gt;
But if you are curious to try it out (because Visual Studio is the most awesome IDE on the planet and you love C#), head over to the &lt;a href=&quot;https://developer.microsoft.com/en-us/windows/iot&quot;&gt;Windows 10 IoT &lt;/a&gt;site to get the image or you can wait for me to talk about it later.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Buy the Pi&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now that I have pre-empt you and you are still interested, the first thing to do is to get a Raspberry Pi 3 and all its required accessories i.e. Power Adapter, HDMI to VGA adapter etc.. You can get them from:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://my.element14.com/&quot;&gt;Element14&lt;/a&gt; (recommended)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://my.rs-online.com/web/&quot;&gt;RS Online&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
If you are worried about not having the right components to get started, I would recommend that you get a Starter Kit. I got myself a Raspberry Pi 2 Ultimate Starter Kit from &lt;a href=&quot;http://www.canakit.com/&quot;&gt;Canakit&lt;/a&gt; via Amazon.com. You can also checkout &lt;a href=&quot;https://www.adafruit.com/&quot;&gt;Adafruit&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;https://www.sparkfun.com/&quot;&gt;Sparkfun&lt;/a&gt;&amp;nbsp;and &lt;a href=&quot;https://www.sunfounder.com/&quot;&gt;Sunfounder&lt;/a&gt;. By now you must be thinking - &lt;i&gt;Why everything overseas wan, got any local sites or not?&lt;/i&gt;&amp;nbsp;Ok, for local sites you can try &lt;a href=&quot;http://components.ubitap.com/&quot;&gt;Ubitap&lt;/a&gt;&amp;nbsp;(recommended), &lt;a href=&quot;http://www.cytron.com.my/&quot;&gt;Cytron&lt;/a&gt; or &lt;a href=&quot;http://myduino.com/&quot;&gt;MyDuino&lt;/a&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/AVvXsEiFrL7nK0DxYJw1aZGQZoA-0bN8bBGvrwMH3s6KS2alBddL2E3M-y4m4JL4OZr0L2eMaC1DpZ8fmpb-91Bl-REMG0Aw1OuFrQqdhIVCoqbgwJafnyKziGF-7PXNIUNH6soXUjVH/s1600/Pi2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;325&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFrL7nK0DxYJw1aZGQZoA-0bN8bBGvrwMH3s6KS2alBddL2E3M-y4m4JL4OZr0L2eMaC1DpZ8fmpb-91Bl-REMG0Aw1OuFrQqdhIVCoqbgwJafnyKziGF-7PXNIUNH6soXUjVH/s400/Pi2.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Ok, I know that face, that&#39;s the - &lt;i&gt;Walaueh! Why so expensive wan?&lt;/i&gt; look. Well, if you want to save up some $, you can be daring a-bit and go try out eBay or AliExpress. But don&#39;t say I never warned you, you probably get your stuff after weeks or months or maybe .... never.&lt;br /&gt;
&lt;br /&gt;
So what&#39;s next after you got your Pi. You will need a micro-SD CARD. The specs say you should be getting something Class 10 (or if there is something higher) with at least 8GB. Now, Class 10 micro-SD cards also have multiple variants. If you can spend some $, try to get some high-end Samsung cards like the EVO+ or even better, the PRO series if you have deep pockets.&lt;br /&gt;
&lt;br /&gt;
The Pi doesn&#39;t have a hard-disk like a PC, so you load the OS and store stuff on the micro-SD card (and that&#39;s why you need to have a fast card). If you &lt;i&gt;beh-song &lt;/i&gt;and don&#39;t want to use a micro-SD card, you can checkout &lt;a href=&quot;http://store.wdc.com/store/wdus/en_US/DisplayAccesoryProductDetailsPage/ThemeID.21986300/Accessories/WD_PiDrive_Kit/productID.323686500/categoryId.70262300&quot;&gt;Western Digital&#39;s PiDrive&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Installation&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To install your OS, first you need to download the OS image (or images). The best way to do it is from &lt;a href=&quot;https://www.raspberrypi.org/downloads/noobs/&quot;&gt;NOOBS&lt;/a&gt;&amp;nbsp;(New Out-Of-Box Software). Recall earlier I mentioned about Windows 10 IoT? If you try to install from NOOBS, you can actually select multiple OSes to dual, triple, quardro boot and Windows 10 IoT will be one of the option. For me, I will go with Raspbian.&lt;br /&gt;
&lt;br /&gt;
Just extract the downloaded .zip file and copy the files over to your micro-SD Card. Put the card into your new Pi and power it up. Follow the simple installation steps, make some coffee and then everything should be done.&lt;br /&gt;
&lt;br /&gt;
Go &lt;a href=&quot;https://www.raspberrypi.org/help/noobs-setup/&quot;&gt;here&lt;/a&gt; if you need more detail instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Installation Caveats&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now, some of you may be a bit &lt;i&gt;kiasu (&lt;/i&gt;like me) and go buy a big micro-SD Card i.e. 64GB. You will then noticed that the Pi will not recognize the card. The reason is because the larger cards are usually formatted in exFAT. Follow the instructions &lt;a href=&quot;https://www.raspberrypi.org/documentation/installation/sdxc_formatting.md&quot;&gt;here&lt;/a&gt; to format your card to FAT32.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Post-Installation Tips&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Usually most people will tell you that you are now ready to go and say &lt;i&gt;bye-bye&lt;/i&gt;, but I would like to give you a few more post installation tips. All the following should be done on your Raspbian OS.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tip #1 Get Up-to-date&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Make sure you are connected to the Internet. Open up a &lt;b&gt;Terminal&lt;/b&gt; and enter:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo apt-get update&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
then&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo apt-get upgrade&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You will see that almost everywhere, people will ask you to do that all the time. As to why they didn&#39;t script that on OS boot-up, I don&#39;t really know. These are something like your Windows Update but in command line style.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tip #2 Change the Keyboard Layout&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Before you start to think your keyboard is spoilt, you should go and change the keyboard layout to US. By default, I think it is default to U.K. &lt;i&gt;How to do it? &lt;/i&gt;Own self go find in the settings &lt;i&gt;la&lt;/i&gt;. Take this chance to explore the OS a bit.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tip #3 Install Remote Desktop&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I find it more convenient (and productive) to remote in to the Pi to do work. To enable remote desktop, open up a &lt;b&gt;Terminal&lt;/b&gt; and enter:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sudo apt-get install xrdp&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
After you have installed that, you will be able to Remote in to the Pi using &lt;b&gt;Remote Desktop Connection &lt;/b&gt;or (mstsc.exe) from your Windows machine.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tip #4 Share Files&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
After a while, you may have written &lt;i&gt;sibeh &lt;/i&gt;a lot of python programs or have some stuff you have to backup to your PC. You may also want to copy things from your PC to the Pi. In order to do this, install samba.&lt;br /&gt;
&lt;br /&gt;
The installation is a bit lengthy, you can visit &lt;a href=&quot;http://raspberrypihq.com/how-to-share-a-folder-with-a-windows-computer-from-a-raspberry-pi/&quot;&gt;here&lt;/a&gt;&amp;nbsp;for full instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tip #5 Date Time Format&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Not sure if it bugs you, but when I look at the date time at the taskbar, I feel &lt;i&gt;sibeh boh-song&lt;/i&gt;. I changed the format to&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;%a %x %I:%M %p&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
which will display something like &lt;b&gt;Wed 7/6/2016 6:20 pm&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Where to change it? &lt;/i&gt;Again, you own self go find in the settings &lt;i&gt;la&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I hope you have find it informative (and entertaining) so far and I hope you can do something awesome with the Raspberry Pi (since nowadays, even 8 year old kids are starting to play with it). Now, if you somehow bought the Pi, took pictures of it and put on facebook to fish likes and then felt that it is too difficult to work on, you can always convert it into a Media Centre - &lt;i&gt;How to do it? &lt;/i&gt;You own self google la. ;)</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/4989439948328859067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/4989439948328859067' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/4989439948328859067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/4989439948328859067'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2016/07/getting-started-with-raspberry-pi.html' title='Getting Started with Raspberry Pi'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEii-kYsYDP7R-WgALoa5OspwanPbwN1IlXQgwgpEKxyxs3708xYyO7t-VMBQcftjJPuuRpEmkrMXHj98GaFlph9vX2KflACTLutLr2PBNNDdSPoW9X6MHRkVQX3hWFSryHpK1Qf/s72-c/Pi3.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-1269627923693995576</id><published>2015-05-07T10:44:00.002+08:00</published><updated>2015-05-07T10:44:56.280+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>Visual Studio Code &amp; ASP.NET 5 on Mac OS X</title><content type='html'>Microsoft has recently announced the availability of &lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;Visual Studio Code&lt;/a&gt;&amp;nbsp;and I have been eager to test it out on my Mac. Before you get too excited, Visual Studio Code is just a &lt;strike&gt;text&lt;/strike&gt; code editor and is not an IDE. (If you are running on Windows and looking for an IDE, I will recommend you to get &lt;a href=&quot;https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx&quot;&gt;Visual Studio Community Edition&lt;/a&gt; instead but you need to get the 2015 version).&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Since Visual Studio Code and ASP.NET 5 are still in the preview stage, getting everything setup may not be that straight-forward. I will share with you the &lt;strike&gt;pain&lt;/strike&gt; steps that I have gone through in order to get them working on a Mac.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 1 - Download and install Visual Studio Code.&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Head over to&amp;nbsp;&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;https://code.visualstudio.com/&lt;/a&gt; and download VS Code.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Note: You will only get a zip file. There is no installer. Extract it to a location of your choice.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This is what you will see when you first load VS Code.&lt;/div&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/AVvXsEgyrgKT5biO9JsUh8mjuWlvjBV4DkWchOcf5QIQ7ejqvgtZj-ya0VIV2d0TJ1WcNnLWxGwsKaE_-zzXe7GuSgh6zzYe7WVmWg3zX5gWGcE1W7EozBArqdaxzyYhnJOAxoUTjAVu/s1600/Screen+Shot+2015-05-07+at+8.17.59+AM.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/AVvXsEgyrgKT5biO9JsUh8mjuWlvjBV4DkWchOcf5QIQ7ejqvgtZj-ya0VIV2d0TJ1WcNnLWxGwsKaE_-zzXe7GuSgh6zzYe7WVmWg3zX5gWGcE1W7EozBArqdaxzyYhnJOAxoUTjAVu/s1600/Screen+Shot+2015-05-07+at+8.17.59+AM.png&quot; height=&quot;462&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
If you are accustomed to Visual Studio you will be asking &quot;Is that it?&quot;. That&#39;s because it looks pretty much just like a notepad. There is no File -&amp;gt; New Project or whatsoever (because it is not an IDE). But don&#39;t under-estimate it, after all it is still part of the Visual Studio family!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To put it to good use for .NET development, here&#39;s &lt;strike&gt;where the pain starts&lt;/strike&gt; what you need to do.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 2 - Setup Pre-requisites&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
.NET development nowadays isn&#39;t like it used to be in the good old days. To have .NET working on your system, you will need to &lt;strike&gt;invite other non-related guests&lt;/strike&gt;&amp;nbsp;install other pre-requisites. The most important pre-requisite that you need is &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;npm&lt;/span&gt; and that comes with nodejs.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 2.1 - Setup &lt;a href=&quot;https://nodejs.org/&quot;&gt;nodejs&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Download and run the nodejs installer.&lt;/div&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/AVvXsEhBXjb9NIoX2I2C737N9egeOyLLg0J_gE-vTKDX3P5ugKdk1pAi99g3CzgBEL-WJT6-MdvMoqDc-GkTyK8YPC7Fk41-L31AFADNR8KwWJtu2_7liv-OTdEQAv1yL2KENHc2ggEN/s1600/Screen+Shot+2015-05-07+at+8.26.22+AM.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/AVvXsEhBXjb9NIoX2I2C737N9egeOyLLg0J_gE-vTKDX3P5ugKdk1pAi99g3CzgBEL-WJT6-MdvMoqDc-GkTyK8YPC7Fk41-L31AFADNR8KwWJtu2_7liv-OTdEQAv1yL2KENHc2ggEN/s1600/Screen+Shot+2015-05-07+at+8.26.22+AM.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Follow through the steps to get it installed.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 2.2 - Install &lt;a href=&quot;http://gruntjs.com/&quot;&gt;grunt&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Open up a Terminal and type in the following:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;npm install -g grunt-cli&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you are not running as administrator, remember to use the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;sudo&lt;/span&gt; command i.e. &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;sudo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;npm install -g grunt-cli&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 2.3 - Install &lt;a href=&quot;http://bower.io/&quot;&gt;bower&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Type the following in the same Terminal:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;npm install -g bower&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Again, please remember to use &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;sudo&lt;/span&gt; if you are not running as administrator.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 3 - Setup &lt;a href=&quot;https://github.com/aspnet/home#os-x&quot;&gt;ASP.NET 5&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once you have done with all the pre-requisites, it is now time to install ASP.NET 5.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 3.1 - Install &lt;a href=&quot;http://brew.sh/&quot;&gt;Homebrew&lt;/a&gt;.&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Wait, you can&#39;t just install ASP.NET like that, To get it, you will need Homebrew. Type the following in the Terminal:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ruby -e &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 3.2 - Install ASP.NET 5&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now you can proceed to install ASP.NET 5. Follow the steps as stated in the ASP.NET 5 &lt;a href=&quot;https://github.com/aspnet/home&quot;&gt;github&lt;/a&gt;. Type the following in the Terminal:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;brew tap aspnet/dnx&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;brew update&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;brew install dnvm&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Note: You have just installed the .NET Execution Environment (DNX) and .NET Version Manager (DNVM).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 3.3 - The missing stuff in &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;bash_profile&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
At the time of this writing, there are some missing steps in the official installation guide to make things a little more &lt;strike&gt;challenging&lt;/strike&gt; interesting for Mac users. You will need to enter some stuff into your&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;bash_profile&lt;/span&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Don&#39;t panic if you cannot find this file, I was told that it does not exist in most Macs.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
At the Terminal, type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;touch ~/.bash_profile&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;open ~/.bash_profile&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This will create the file and open it in a text editor. Type this into the &lt;b&gt;text editor&lt;/b&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: Courier New, Courier, monospace;&quot;&gt;export MONO_GAC_PREFIX=&quot;/usr/local&quot;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;export MONO_MANAGED_WATCHER=false&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;source dnvm.sh&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Save the file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Warning: If you missed these steps, you will get into a pull-hair session later i.e. lots of&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;command not found&lt;/span&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 4 - Scaffold a Web Application&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We are almost there. To get started with a web application template, we can use a scaffolding tool to do it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 4.1 - Install &lt;a href=&quot;http://yeoman.io/&quot;&gt;Yeoman&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
At the Terminal, type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;npm install -g yo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 4.2 - Install ASP.NET Templates/Generators&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
That&#39;s just the tool, you will need the generator/templates. At the Terminal, type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;npm install -g generator-aspnet&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 4.3 - Create the Web Application&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You are now finally ready to create your web application *claps*. At the Terminal, type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;yo aspnet&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You will get something like the following:&lt;/div&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/AVvXsEjGIYZsK-ur-PfgMO1CIRboE95ZdvChwPQmXgPTBVc6O1R5_KMcH1a6KuSwVb0JCfXcmNT4ljB1A4IUasfbodD8JauyskH_hFUA0N6u7jbAO7KK5TmjfRTdp_RtTYk-WzkLUUbL/s1600/Screen+Shot+2015-05-07+at+10.09.12+AM.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/AVvXsEjGIYZsK-ur-PfgMO1CIRboE95ZdvChwPQmXgPTBVc6O1R5_KMcH1a6KuSwVb0JCfXcmNT4ljB1A4IUasfbodD8JauyskH_hFUA0N6u7jbAO7KK5TmjfRTdp_RtTYk-WzkLUUbL/s1600/Screen+Shot+2015-05-07+at+10.09.12+AM.png&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Select &lt;b&gt;Web Application&lt;/b&gt; and press enter. Give your web project a name i.e. &lt;i&gt;WebApplication&lt;/i&gt; and see the magic happens.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can open your web project in Visual Studio Code. Just go to &lt;b&gt;File -&amp;gt; Open&lt;/b&gt; and open the project folder i.e. &lt;i&gt;WebApplication&lt;/i&gt;.&lt;/div&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/AVvXsEhBb86Ev3jnmZImWKMqLR2aV91JxSrUk0tdIl5LqdWWwXEf3BAKDEUD432ONgSWyG5ZTcYNz8OfwQ8Tzef2fIZcRsuWuKtPAq3Jrw9UPyn6JHQGgM44-xdK8LMcXPQGBD0o6HJ3/s1600/Screen+Shot+2015-05-07+at+10.12.33+AM.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/AVvXsEhBb86Ev3jnmZImWKMqLR2aV91JxSrUk0tdIl5LqdWWwXEf3BAKDEUD432ONgSWyG5ZTcYNz8OfwQ8Tzef2fIZcRsuWuKtPAq3Jrw9UPyn6JHQGgM44-xdK8LMcXPQGBD0o6HJ3/s1600/Screen+Shot+2015-05-07+at+10.12.33+AM.png&quot; height=&quot;494&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 5 - Running the Project&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here&#39;s the bad news - there is no F5 to run.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 5.1 - Restore nuget packages&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Before running the application, you will need to restore the nuget packages. You can open up a Terminal and go to your project folder or you can press&amp;nbsp;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;Myriad Set Pro&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 18px; line-height: 26.1000003814697px;&quot;&gt;⌘P&lt;/span&gt;&amp;nbsp;from Visual Studio Code to open the &lt;b&gt;Command Palette&lt;/b&gt;. Type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;dnu restore&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 5.2 Hosting the Web Application in kestrel&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Finally, you can now host and run your beautiful Web Application. At the &lt;b&gt;Command Palette&lt;/b&gt;, type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;kestrel&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
or at the Terminal, &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;cd&lt;/span&gt; to your project folder and type in:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;dnx . kestrel&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once kestrel is started, you can launch any web browser and point it to:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;http://localhost:5001&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEi7QI6uSjjjexylUy0CMiaUHhuWffjsupcnhXwPpkbLum0LrH4R-DI8y_l661bf1j304EZDahLLBDG0oHXn_mpcUeMZJgxdb9WErl4eoqZalpfuVB4IHSsDudxxi4m3FwUM1QwJ/s1600/Screen+Shot+2015-05-07+at+10.26.33+AM.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/AVvXsEi7QI6uSjjjexylUy0CMiaUHhuWffjsupcnhXwPpkbLum0LrH4R-DI8y_l661bf1j304EZDahLLBDG0oHXn_mpcUeMZJgxdb9WErl4eoqZalpfuVB4IHSsDudxxi4m3FwUM1QwJ/s1600/Screen+Shot+2015-05-07+at+10.26.33+AM.png&quot; height=&quot;464&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Note: If you can&#39;t get it on port 5001, try port 5004.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Wrap-up!&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you have followed me this far, then you should give yourself a pad on the shoulder. Getting all these to work is surely exciting but it is really a big hassle compared to the traditional Visual Studio experience. But by working through all these, we get to know what is going on behind the scene and will learn to appreciate the Visual Studio &lt;strike&gt;spoon-feeding&lt;/strike&gt; experience more.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you do not want to go through all the hassle just to start coding a Hello World ASP.NET Web Application, I would recommend that you just virtualize a Windows operating system, install Visual Studio 2015 and get on with it (I did that but my friends call me a cheat).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Have fun trying out ASP.NET 5.&lt;/div&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://serena-yeoh.blogspot.com/feeds/1269627923693995576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/1269627923693995576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/1269627923693995576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/1269627923693995576'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2015/05/visual-studio-code-aspnet-5-on-mac-os-x.html' title='Visual Studio Code &amp; ASP.NET 5 on Mac OS X'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEgyrgKT5biO9JsUh8mjuWlvjBV4DkWchOcf5QIQ7ejqvgtZj-ya0VIV2d0TJ1WcNnLWxGwsKaE_-zzXe7GuSgh6zzYe7WVmWg3zX5gWGcE1W7EozBArqdaxzyYhnJOAxoUTjAVu/s72-c/Screen+Shot+2015-05-07+at+8.17.59+AM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-191908382290853306</id><published>2014-08-31T00:36:00.000+08:00</published><updated>2014-08-31T00:36:21.142+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Converting Struct with Strings to Byte Array</title><content type='html'>There are times when there is a need to convert a struct to a byte array (and vice-versa) when working with&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.io.memorymappedfiles(v=vs.110).aspx&quot;&gt;memory-mapped files&lt;/a&gt;. Although the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.io.memorymappedfiles.memorymappedviewaccessor(v=vs.110).aspx&quot;&gt;MemoryMappedViewAccessor&lt;/a&gt; provides methods to read and write structs, they will fail&amp;nbsp;when the structs contain string fields such as the following:&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;struct&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Name; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Minimum;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Maximum;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Current;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You will encounter the error -&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;The specified Type must be a struct containing no references.&#39;&lt;/span&gt;&lt;/i&gt;&amp;nbsp; when you try to use the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd294099(v=vs.110).aspx&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Write&lt;t&gt;()&lt;/t&gt;&lt;/span&gt;&lt;/a&gt; method. To solve the issue, you will need to use the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd267754(v=vs.110).aspx&quot;&gt;WriteArray&lt;t&gt;()&lt;/t&gt;&lt;/a&gt; &lt;/span&gt;method instead and this is when you will need to convert the struct to a byte array.&amp;nbsp;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
To achieve that, we will need to perform some unmanaged memory acrobatics. The following code will convert the struct to a byte array and use the WriteArray method to write it to the memory-mapped file.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
WriteSequence(&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;MemoryMappedViewAccessor&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
accessor, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
seq)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Get size of struct&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
size = &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.SizeOf(&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;[]
data = &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;[size];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Initialize unmanaged
memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;IntPtr&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
p = &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.AllocHGlobal(size);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Copy struct to unmanaged
memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.StructureToPtr(seq,
p, &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Copy from unmanaged memory
to byte array.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.Copy(p,
data, 0, size);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Write to memory mapped
file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; accessor.WriteArray&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;gt;(0,
data, 0, data.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;finally&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Free unmanaged memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.FreeHGlobal(p);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;IntPtr&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.Zero;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
And to read the struct, we need to convert the byte array back to the struct using the following code which reverses the above process:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
ReadSequence(&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;MemoryMappedViewAccessor&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
accessor)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
seq;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Get size of struct&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
size = &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.SizeOf(&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;[]
data = &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;[size];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Initialize unmanaged
memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;IntPtr&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
p = &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.AllocHGlobal(size);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Read from memory mapped
file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; accessor.ReadArray&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;gt;(0,
data, 0, data.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Copy from byte array to
unmanaged memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.Copy(data,
0, p, size);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Copy unmanaged memory to
struct.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; seq = (&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.PtrToStructure(p,
&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;finally&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: green; font-family: Consolas; mso-highlight: white;&quot;&gt;// Free unmanaged memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Marshal&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.FreeHGlobal(p);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;IntPtr&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;.Zero;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
seq;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Before you can use the two methods, you will need to make some slight changes to the struct as follows:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #2b91af; font-family: Consolas;&quot;&gt;StructLayout&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #2b91af; font-family: Consolas;&quot;&gt;LayoutKind&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;.Sequential,
CharSet = &lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #2b91af; font-family: Consolas;&quot;&gt;CharSet&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;.Ansi)]&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;struct&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;Sequence&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #2b91af; font-family: Consolas;&quot;&gt;MarshalAs&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #2b91af; font-family: Consolas;&quot;&gt;UnmanagedType&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;.ByValTStr,
SizeConst = 50)]&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Name; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Minimum;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Maximum;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;
Current;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Note: You must marshal the string with the proper type and constant size. Failing to do so, you will get the error - &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;&quot;Attempted to read or write protected memory. This is often an indication that other memory is corrupt.&quot;&amp;nbsp;&lt;/span&gt;&lt;/i&gt;when you try to read the memory mapped file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once you have completed all the above steps, you are now able to read and write structs with strings from and to memory mapped files.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/191908382290853306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/191908382290853306' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/191908382290853306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/191908382290853306'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/08/converting-struct-with-strings-to-byte.html' title='Converting Struct with Strings to Byte Array'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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-7549567.post-2876188976853753095</id><published>2014-08-26T10:01:00.002+08:00</published><updated>2014-08-26T10:03:05.755+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Communication Foundation"/><title type='text'>WCF: Windows Authentication with basicHttpBinding</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
Most developers when developing Windows Communication Foundation (WCF) services, will take security for granted and deploy their web services unsecured. In this post, I&#39;m going to discuss how we can easily configure a WCF web service to use Windows Authentication.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In the &lt;b&gt;services&amp;nbsp;&lt;/b&gt;config file, configure the security settings for the binding as follows:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;bindings&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;basicHttpBinding&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;binding&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;basicHttp&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #a31515; font-family: Consolas;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: red; font-family: Consolas;&quot;&gt;mode&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;TransportCredentialOnly&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #a31515; font-family: Consolas;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: red; font-family: Consolas;&quot;&gt;clientCredentialType&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;
/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #a31515; font-family: Consolas;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;binding&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;basicHttpBinding&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;bindings&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Take note that I&#39;m using &lt;b&gt;basicHttpBinding &lt;/b&gt;for my web services.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Make sure that the service is using the binding configuration.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;SecureDemo.Services.MyService&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;endpoint&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;basicHttpMyService&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; address&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; binding&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;basicHttpBinding&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: red; font-family: Consolas;&quot;&gt;bindingConfiguration&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;basicHttp&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; contract&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;SecureDemo.Services.Contracts.IMyService&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;
/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;&lt;b&gt;service&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
WCF requires that both the consumer and service configurations to be the same. Therefore, at the &lt;b&gt;client&lt;/b&gt; config file, include the same binding configuration and then configure the client to use it.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;client&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;endpoint&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background: white; color: red; font-family: Consolas;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas;&quot;&gt;basicHttpMyService&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: red; font-family: Consolas;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; address&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas;&quot;&gt;http://localhost:8888/MyService&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&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; &lt;/span&gt;&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;binding&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;basicHttpBinding&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: red; font-family: Consolas;&quot;&gt;bindingConfiguration&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: blue; font-family: Consolas;&quot;&gt;basicHttp&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fce5cd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&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; &lt;/span&gt;&lt;span style=&quot;background: white; color: red; font-family: Consolas; mso-highlight: white;&quot;&gt;contract&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;SecureDemo.Services.Contracts.IMyService&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;client&lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
That&#39;s all for the configuration. Now when you call the service, simply supply the credentials like the following example:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;proxy = &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; mso-highlight: white;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; mso-highlight: white;&quot;&gt;MyServiceClient&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;proxy.ClientCredentials.Windows.ClientCredential.UserName
= &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas; mso-highlight: white;&quot;&gt;&quot;HelloKitty&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;proxy.ClientCredentials.Windows.ClientCredential.Password
= &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas;&quot;&gt;&quot;meowmeow&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;proxy.ClientCredentials.Windows.ClientCredential.Domain
= &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: Consolas;&quot;&gt;&quot;cutieland&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: Consolas;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
You can substitute the hard-coded credentials with values retrieved from your login screen if you want to authenticate by individual account and not from an application service account.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Hope this was helpful. :)&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/2876188976853753095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/2876188976853753095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/2876188976853753095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/2876188976853753095'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/08/wcf-windows-authentication-with.html' title='WCF: Windows Authentication with basicHttpBinding'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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-7549567.post-7904556663648920951</id><published>2014-07-12T16:03:00.001+08:00</published><updated>2014-07-12T17:28:08.398+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MacBook"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Server"/><title type='text'>Windows Server 2012 R2 on MacBook Pro</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
I have just gotten a MacBook Pro for work and like all the other notebooks before it, the first thing I would do is to install Windows Server on it. Afterall, a notebook is only worthy if it can run Windows Server. ;)&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
There were very little resources on installing Windows Server 2012 R2 on a MacBook Pro and that&#39;s the reason I&#39;m writing this. Being a Windows user for a long time, this is an exciting experience for me. I have successfully installed Windows Server 2012 R2&amp;nbsp;(with update)&amp;nbsp;on my 15&quot; MacBook Pro with Retina display so you can be assured that it works (or atleast most part of it).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I&#39;m a follower of official recommended practices, therefore I used &lt;a href=&quot;http://www.apple.com/my/support/bootcamp/&quot;&gt;Apple&#39;s Boot Camp&lt;/a&gt; for this. Make sure you have &lt;b&gt;downloaded the Windows Server .iso&lt;/b&gt;, prepared an &lt;b&gt;external USB keyboard &lt;/b&gt;and &lt;b&gt;two&amp;nbsp;USB flash drives &lt;/b&gt;for stand by.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The Boot Camp Assistant instructions are pretty straight-forward. I will just highlight some of the extra things that you need to do in order to have a smooth installation. Otherwise, you may spend a good amount of time trying to figure out &lt;i&gt;whadahell-is-wrong&lt;/i&gt; like me.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;Before you begin, make sure you&lt;b&gt; reset the NVRAM&lt;/b&gt;. Follow the steps&amp;nbsp;&lt;a href=&quot;http://support.apple.com/kb/ht1379&quot;&gt;here&lt;/a&gt;. If you did not complete this step, the installation of Windows will run until finish and then fail with the following error:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;&quot;Windows could not update the computer&#39;s boot configuration. Installation cannot proceed.&quot;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
After that, your Mac will restart with a white screen and shutdown itself - a.k.a. White Screen of Death (WSOD). You will no longer to be able to boot up from this point. If you are unlucky enough to hit such situation... don&#39;t panic! Restart your Mac and hold on to the Option (alt) key. This should allow you to boot back to your OS X and start all over again.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
1. From OS X, launch Boot Camp Assistant (you can type &quot;Boot Camp&quot; in Spotlight)&lt;/div&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/AVvXsEhr-sBdYdmllYX8XBOL5oap_i75TSgwh7nAy1EINdyQcIr5vWexKNzngce-Tt8tJbyduBPyO1-XvNKD_ee9NhNvnYbD0-TybTprf89fFsyNvL4E6DNqnl0ZVk_vt5XtG_vllPZS/s1600/Screen+Shot+2014-07-12+at+3.44.45+PM.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/AVvXsEhr-sBdYdmllYX8XBOL5oap_i75TSgwh7nAy1EINdyQcIr5vWexKNzngce-Tt8tJbyduBPyO1-XvNKD_ee9NhNvnYbD0-TybTprf89fFsyNvL4E6DNqnl0ZVk_vt5XtG_vllPZS/s1600/Screen+Shot+2014-07-12+at+3.44.45+PM.png&quot; height=&quot;473&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
2. Select all the 3 tasks available:&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/AVvXsEh9tn-caw8ci2OabkDUv5HbvGfR5AvaEE1VEtoLszpJqtP0LS9wCrR5nHqrdp1Yykemw9Fq-CCl4tWl4dzrjzbqDMXS5Vv9auhvthhFY-0hdegT930tim4pyGdFOT4WXTaR96Fy/s1600/Screen+Shot+2014-07-12+at+3.45.18+PM.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/AVvXsEh9tn-caw8ci2OabkDUv5HbvGfR5AvaEE1VEtoLszpJqtP0LS9wCrR5nHqrdp1Yykemw9Fq-CCl4tWl4dzrjzbqDMXS5Vv9auhvthhFY-0hdegT930tim4pyGdFOT4WXTaR96Fy/s1600/Screen+Shot+2014-07-12+at+3.45.18+PM.png&quot; height=&quot;475&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;Create a Windows 7 or later version install disk&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;Download the latest Windows Support software from Apple&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;Install Windows 7 or later version (Screenshot showing remove because I already have Windows installed)&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
Tip: You need to use the first option to let Boot Camp create the bootable USB. I tried creating it manually from a Windows machine and it doesn&#39;t work.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
3. Provide the path to the Windows Server .iso image and select one of the USB flash drives to copy it into. The other one will be used to store the Boot Camp drivers.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhnxggI9WVl8liCUlcEZnwoCjtrjxE9UCEDsdRqL4-6GC76CV6H4UekMYJOI7QTZKzeb-wL3zpjpnHxJuXWX3DI1RpkikhfEQ487nFue4ENhkIewFyb2BeHhIkieaWqMMspz18L/s1600/Screen+Shot+2014-07-12+at+3.45.52+PM.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/AVvXsEhnxggI9WVl8liCUlcEZnwoCjtrjxE9UCEDsdRqL4-6GC76CV6H4UekMYJOI7QTZKzeb-wL3zpjpnHxJuXWX3DI1RpkikhfEQ487nFue4ENhkIewFyb2BeHhIkieaWqMMspz18L/s1600/Screen+Shot+2014-07-12+at+3.45.52+PM.png&quot; height=&quot;474&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
4. Create a partition for Windows.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
5. The system will reboot and Windows installation will commence.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
6. During the setup of Windows, make sure you select the partition named &lt;b&gt;BOOTCAMP &lt;/b&gt;to install Windows. Do not mess with the other partitions!&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
7. Once the Windows Server installation is completed and properly configured, you will be presented with an interesting problem - The press CTRL+ALT+DEL to login screen. There is no way you can do that at this point in time - you can try it if you don&#39;t trust me. :p This is where your external USB keyboard is required. Plug it in and login. The Boot Camp drivers should automatically be installed (and if not, you can launch it from the USB flash drive).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Tip: You can disable the CTRL+ALT+DEL screen if you want. Follow instructions &lt;a href=&quot;http://www.win2012workstation.com/disable-ctrlaltdel/&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
8. Once everything is done, reboot and you are ready to go!&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
9. &lt;b&gt;Before enabling Hyper-V or installing Visual Studio 2013&lt;/b&gt;, reboot to OS X then go to &lt;b&gt;System Preferences -&amp;gt; Startup Disk&lt;/b&gt; and select the the BOOTCAMP disk. Restart the system. If you skip this step you will receive an error message stating that &quot;Hardware Virtualization is not enabled in the BIOS&quot; (and you can&#39;t access the BIOS on a Mac).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: I have heard interesting myths from friends telling me that the keyboard is pretty messed up in Mac, as in the keys are different from Windows i.e. can&#39;t do CTRL+C and CTRL+P to copy-paste. This is not entirely true. Once you have the Boot Camp drivers installed, the keyboard will function like normal and you can even do CTRL+ALT+DEL or WinKey (replaced with command key) +L to lock screen.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Extra Tip: OH NOES! How do we do screen capture since there isn&#39;t a Print Screen button on the keyboard? The key combo is &lt;b&gt;Fn+Shift+F11&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
10. To enable right-click, go to &lt;b&gt;Control Panel -&amp;gt; Boot Camp -&amp;gt; Trackpad&lt;/b&gt; and set &lt;b&gt;Secondary Click &lt;/b&gt;to &lt;b&gt;Bottom Right Corner&lt;/b&gt;.&lt;/div&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/AVvXsEiIkVss_l462kUsUu1o_9kxu-gY4Tg7FFnNxTmZaKDIqf81OifBQONjjz0Ah-IW5buS1ljU1EufThchyqFCwBLbLQiO6adrjvQppIEh21oAepF2qdPeBaVTvpE1fxHxpnzeRguJ/s1600/Capture.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/AVvXsEiIkVss_l462kUsUu1o_9kxu-gY4Tg7FFnNxTmZaKDIqf81OifBQONjjz0Ah-IW5buS1ljU1EufThchyqFCwBLbLQiO6adrjvQppIEh21oAepF2qdPeBaVTvpE1fxHxpnzeRguJ/s1600/Capture.PNG&quot; height=&quot;286&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
11. The WiFi may not be working. To fix the problem, download the &lt;a href=&quot;http://support.apple.com/downloads/#macoscomponents&quot;&gt;Boot Camp Support Software&lt;/a&gt; from Apple&#39;s site and run the Broadcom Wireless x64 drivers in the Drivers\Broadcom &amp;nbsp;folder.&lt;br /&gt;
&lt;br /&gt;
There you go! No you have a fully functional Windows Server 2012 R2 on your MacBook Pro that you can play with.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/7904556663648920951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/7904556663648920951' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7904556663648920951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7904556663648920951'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/07/windows-server-2012-r2-on-macbook-pro.html' title='Windows Server 2012 R2 on MacBook Pro'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEhr-sBdYdmllYX8XBOL5oap_i75TSgwh7nAy1EINdyQcIr5vWexKNzngce-Tt8tJbyduBPyO1-XvNKD_ee9NhNvnYbD0-TybTprf89fFsyNvL4E6DNqnl0ZVk_vt5XtG_vllPZS/s72-c/Screen+Shot+2014-07-12+at+3.44.45+PM.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-8395696862427487356</id><published>2014-04-18T12:44:00.000+08:00</published><updated>2014-04-18T12:47:13.862+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><category scheme="http://www.blogger.com/atom/ns#" term="WF"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Communication Foundation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Workflow Foundation"/><title type='text'>Layered Architecture: Partitioning the Code</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
Developing an enterprise layered application can be a daunting task especially when the layered samples provided, contains a barrage of Visual Studio projects. So, here&#39;s a brief description of what each folder and projects are for in the samples found in&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;and also those that were unfolded by the &lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance (LASG)&lt;/a&gt;&amp;nbsp;Visual Studio extension.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;b&gt;Business&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder should contain all projects and assets that are related to the business layer. If you have any classes that are only shared between business layer components, you can create a &lt;span style=&quot;color: #3d85c6;&quot;&gt;[Project-name].Business.Framework&lt;/span&gt; project to hold them in here.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;[Project-name].Business&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the main business components. The classes here should contain all the business processing and validation logic.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;b style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;[Project-name]&lt;/span&gt;&lt;/b&gt;.Workflows&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the WF workflow components that orchestrates the business flows. The classes here are stored as .xaml and will be compiled into a dll later. This is not a .xamlx project.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;b style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;[Project-name]&lt;/span&gt;&lt;/b&gt;.Workflows.Activities&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the workflow activity and related classes. Workflow activities facilitate the easy construction of workflows. Composite activities should reside in this project as well even if they are with the .xaml extension.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;b style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;[Project-name]&lt;/span&gt;&lt;/b&gt;.Workflows.Designers&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the workflow and activity designer classes. The classes here are to facilitate the designer experience of Visual Studio and should not be deployed to the application server.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Data&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder should be used to group all the projects and assets that are related to the data layer. Any classes that calls external web services or accesses other data storage such as the file system, SharePoint lists or message queues, the should also be located here. If you have any classes that are only shared between data layer components, you can create a &lt;span style=&quot;color: #6aa84f;&quot;&gt;[Project-name].Data.Framework&lt;/span&gt; project to hold them in here.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;[Project-name]&lt;/span&gt;.Data&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the components that interacts with the database. Place all CRUD code in this project.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;b style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;[Project-name]&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;.Data.Agents&lt;/span&gt;&lt;/b&gt;This project should contain all the components that interacts with other storage systems such as file, SharePoint lists or Queues. This project does not unfold by default in LASG.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;b style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;[Project-name]&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;.Database&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This is a SQL Server Data Tools (SSDT) project that is used to hold database scripts and publish them to the database server. You can also use this to keep track of design and schema changes by checking it into a version control system such as Team Foundation Server (TFS).&amp;nbsp;This project does not unfold by default in LASG.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Hosts&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder should contain all the host projects that will be deployed onto the application server. You can create as many host projects as needed depending on your hosting needs.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;[Project-name].Hosts.Web&amp;nbsp;&lt;/b&gt;This project should contain all the assets and configuration for hosting the services back-end in the application server. This is the entry point to the application server.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;Presentation&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder should contain all the projects and assets that are related to the presentation layer. If you have any classes that are only shared between presentation layer components such as UI element manipulation code, you can create a&amp;nbsp;&lt;span style=&quot;color: #e06666;&quot;&gt;[Project-name].UI.Framework&lt;/span&gt;&amp;nbsp;project to hold them in here.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;[Project-name].UI.Process&lt;/span&gt;&lt;/b&gt;This project should contain all the user interface process components (or controllers). Session, state management and page control classes should also reside here.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;[Project-name].UI.Web&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the pages, scripts and user interface assets that will be deployed to the web server. This is the main entry point to the layered web application.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;Services&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder should group all the projects and assets that are related to the service layer. All services related code whether they are ASMX, WCF or WEB API (REST), should reside in this folder. If you have any projects that extends the capabilities of the service technology, they should also reside in this folder.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;[Project-name].Services&lt;/span&gt;&lt;/b&gt;This project should contain all the WCF service implementation classes.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;[Project-name].Services.Contracts&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the services and message contracts for the WCF services. For non-WCF services, this project can serve to hold wrapper classes for Request and Response message classes that are used for communication.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;b&gt;[Project-name].Services.Http&lt;/b&gt;&lt;/span&gt;This project should contain all the ASP.NET WEB API related service implementation classes. This project is not currently unfolded by LASG.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Shared&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder contains all the projects and assets that can be shared among any of the projects in the layers.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;[Project-name].Entities&lt;/span&gt;&lt;/b&gt;This project should contain all the entity classes that are shared among all other projects in the layer.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #666666;&quot;&gt;[Project-name].Framework&amp;nbsp;&lt;/span&gt;&lt;/b&gt;This project should contain all the cross-cutting components such as Authentication, Authorization, Auditing, Logging, Configuration and etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Tests&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This folder should contain all the test projects for the components in the layers. You can create as many test projects in here based on your testing needs.&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;b&gt;LeaveSample.Test&lt;/b&gt;This project is created for you to place your tests (unit test, load test, web tests etc.).&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
This is how everything it looks like in Solutions Explorer. I have omitted some of the non-essential folders such as &lt;i&gt;Scripts &lt;/i&gt;and &lt;i&gt;Solution Items&lt;/i&gt; from the explanation.&lt;/div&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/AVvXsEilc3V4gKWMvp6bktYCJWpvFYeR0xLQXEOiUGOU1gG3tHe1I6anOj91boGEcaN8LeGYCU7EmeTAxNkz81Cwy12-0Ea_VZcGMiQDWRVygGcFeeaPMM-4QRPWnN5LuF-HmMaRLMpQ/s1600/solution-structure.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/AVvXsEilc3V4gKWMvp6bktYCJWpvFYeR0xLQXEOiUGOU1gG3tHe1I6anOj91boGEcaN8LeGYCU7EmeTAxNkz81Cwy12-0Ea_VZcGMiQDWRVygGcFeeaPMM-4QRPWnN5LuF-HmMaRLMpQ/s1600/solution-structure.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;What if I have multiple modules?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The above structure is simple when we are building a medium size application but how do we go about partitioning our projects when the applications becomes larger? There are two approaches that we can adopt.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;Partition by Layer&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The most common approach would be to partition the projects by layer. Each layer will contain the projects belonging to each module. Visual Studio provides the option to create Solution folders and you can use them to organize your projects neatly.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhYPmc1NL9dWVWM4YhVy-Xj_cfyP16fq1Ttlqx4uHbgjSe4yAhlsvZSdlYcP0RgUY_KnyYgAcbiZwDrkRKgFp9xFQMKY5Z4n1dDCp1MUqZqUOcLp1JV5Z4kmcTi6vPCmGLTHrDu/s1600/part-by-layer.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/AVvXsEhYPmc1NL9dWVWM4YhVy-Xj_cfyP16fq1Ttlqx4uHbgjSe4yAhlsvZSdlYcP0RgUY_KnyYgAcbiZwDrkRKgFp9xFQMKY5Z4n1dDCp1MUqZqUOcLp1JV5Z4kmcTi6vPCmGLTHrDu/s1600/part-by-layer.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Take note that the Solution Folders aren&#39;t physical folders and if you want the physical folder structure to match the one shown in Solution Explorer, you will have to do it manually.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;Partition by Module&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The next approach is to partition all the projects into each Module&#39;s Solution Folder. I personally would recommend to use this approach as it allows you to selectively compile the entire module independently from the others. You can also selectively unload a particular module and keep yourself focused on the one that you are working on.&lt;/div&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/AVvXsEhJeDgvcKOPRxh-O1UnMnD9PyqHwm-VqVDCp5kLiNf2VdBPDIPxkAjfamve-XrapbfiPRuTy9bYB2bLNZZ6y8Ti4tljII64y2BATVvBNye-0CmjJxVm5XVc1bd3iWcLujc0qRHh/s1600/part-by-module.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/AVvXsEhJeDgvcKOPRxh-O1UnMnD9PyqHwm-VqVDCp5kLiNf2VdBPDIPxkAjfamve-XrapbfiPRuTy9bYB2bLNZZ6y8Ti4tljII64y2BATVvBNye-0CmjJxVm5XVc1bd3iWcLujc0qRHh/s1600/part-by-module.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Can I have something simpler?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Frequently, Layered Architecture has been labelled as only suitable for large enterprise applications and overkill for smaller applications. This is understanding is inaccurate. Layered Architecture is an architecture pattern that should be inculcated in every business application developer, whether they are developing small or large applications.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The reason is that even the smallest business application has the potential to grow into something large or complex and Layered Architecture is merely a practice to logically partition the code. At the simplest level, we can still achieve layering with the following project structure.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgsrOHY-dVsLDGOCr1IHJb_QVU19FAvemclCYDIiOgzyGJqiI96vCP_q_IKt3OVPE2F_zFKVUWVXGZjtAz7kuYI_LoFAdhcGwIWbCtynFm36mTNQBkjbXkPoFCgoNrZS4-3I87l/s1600/simple.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/AVvXsEgsrOHY-dVsLDGOCr1IHJb_QVU19FAvemclCYDIiOgzyGJqiI96vCP_q_IKt3OVPE2F_zFKVUWVXGZjtAz7kuYI_LoFAdhcGwIWbCtynFm36mTNQBkjbXkPoFCgoNrZS4-3I87l/s1600/simple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The Entities project should be separated into a separate project for sharing reasons. This also applies if there is a Framework project available. Take note that the Contracts that is embedded inside the host will rely on Visual Studio&#39;s Add Service Reference dialog to re-create the service contracts on the presentation side. If a clean implementation is desired, the code in the contracts folder should also be separated into an individual project. LASG does not support this project structure.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
You can check out the other posts in the series if you are interested to learn more about layering:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2013/06/layered-architecture-for-net.html&quot;&gt;Layered Architecture: Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2013/07/layered-applications-3-tier.html&quot;&gt;Layered Architecture: Deployment Strategies&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/layered-applications-and-windows-azure.html&quot;&gt;Layered Architecture: Deploying to Windows Azure&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/applied-technologies-in-layered.html&quot;&gt;Layered Architecture: Applied Technologies&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/layered-architecture-components.html&quot;&gt;Layered Architecture: Component Interactions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/8395696862427487356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/8395696862427487356' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8395696862427487356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8395696862427487356'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/04/layered-architecture-partitioning-code.html' title='Layered Architecture: Partitioning the Code'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEilc3V4gKWMvp6bktYCJWpvFYeR0xLQXEOiUGOU1gG3tHe1I6anOj91boGEcaN8LeGYCU7EmeTAxNkz81Cwy12-0Ea_VZcGMiQDWRVygGcFeeaPMM-4QRPWnN5LuF-HmMaRLMpQ/s72-c/solution-structure.png" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-3157881249692520727</id><published>2014-04-09T09:07:00.000+08:00</published><updated>2014-04-09T09:13:42.755+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET SignalR"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>ASP.NET MVC with SignalR - Client Undefined Error</title><content type='html'>While working on a new &lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;ASP.NET MVC layer sample&lt;/a&gt; with SignalR, I have constantly encountered the following error when I tried to access the site directly with the full path to the View i.e.&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;http://localhost:13618/Home/Index&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;i&gt;0x800a138f - JavaScript runtime error: Unable to get property &#39;client&#39; of undefined or null reference&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This error does not occur when I access the path to the site i.e.&amp;nbsp;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;http://localhost:13618/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
My Views are using a layout and it has all the SignalR javascript references defined.&lt;br /&gt;
&lt;br /&gt;
Index.cshtml&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: yellow; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 11.5pt;&quot;&gt;@{&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ViewBag.Title&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&quot;Apply&amp;nbsp;Leave&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Layout&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&quot;~/Views/Shared/_Layout.cshtml&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: yellow; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 11.5pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;_Layout.cshtml&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;meta&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;viewport&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;width=device-width&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;Layered&amp;nbsp;Architecture&amp;nbsp;Sample&amp;nbsp;for&amp;nbsp;.NET&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;~/Scripts/jquery-2.1.0.min.js&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;~/Scripts/jquery-ui-1.10.3.min.js&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;~/Scripts/jquery.signalR-2.0.3.min.js&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;signalr/hubs&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;~/Content/themes/base/jquery-ui.css&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;stylesheet&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;~/Content/Site.css&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;stylesheet&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;It turns out that I was using the wrong way to reference the hub scripts in ASP.NET MVC. The problem can be easily resolved by changing the following line in the _layout.cshtml page from&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;pre style=&quot;background: white;&quot;&gt;&lt;pre style=&quot;background-position: initial initial; background-repeat: initial initial;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 11.5pt;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;=&quot;signalr/hubs&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 11.5pt;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 11.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;to&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: maroon; font-family: Consolas; font-size: 15px;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 15px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: red; font-family: Consolas; font-size: 15px;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;~/signalr/hubs&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background-color: white; color: maroon; font-family: Consolas; font-size: 15px;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; font-size: 15px;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;*Slaps myself for not reading the documentation properly*&lt;/o:p&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/3157881249692520727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/3157881249692520727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3157881249692520727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3157881249692520727'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/04/aspnet-mvc-with-signalr-client.html' title='ASP.NET MVC with SignalR - Client Undefined Error'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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-7549567.post-4966106624578238538</id><published>2014-04-08T20:58:00.000+08:00</published><updated>2014-04-09T09:07:58.954+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET SignalR"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>Serializing Enums in ASP.NET SignalR</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
Was working on a new&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;layered architecture sample&lt;/a&gt; that uses &lt;a href=&quot;http://www.asp.net/signalr&quot;&gt;ASP.NET SignalR&lt;/a&gt; and found out that it couldn&#39;t serialize the&amp;nbsp;&lt;i&gt;enums &lt;/i&gt;properly by default.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEiJOU9EjlezHYgt7u5XMQkZb0A5SiutwDvQj0HHzSdMHCGHX_7KIFeeQZ3yDiI4B76vyOTcdfeUe08aXYAuX92pEWA2Q8QBvRUQ2sJrD3jAAYijDf6XhmaxZqYMw7GDzMnSPj2M/s1600/signalR-enum.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/AVvXsEiJOU9EjlezHYgt7u5XMQkZb0A5SiutwDvQj0HHzSdMHCGHX_7KIFeeQZ3yDiI4B76vyOTcdfeUe08aXYAuX92pEWA2Q8QBvRUQ2sJrD3jAAYijDf6XhmaxZqYMw7GDzMnSPj2M/s1600/signalR-enum.png&quot; height=&quot;370&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
As you can see from the screenshot, the &lt;i&gt;LeaveStatuses &lt;/i&gt;enum has been serialized as a byte value instead of the text value. A quick solution will be to decorate the Status property with the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;[JsonConverter(typeof(StringEnumConverter))]&lt;/span&gt;&amp;nbsp;attribute in the &lt;i&gt;Leave &lt;/i&gt;entity class but I was reluctant to have my entities hard-coding that.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Fortunately, the problem can be easily solved with an alternative by including the following lines of code in the &lt;b&gt;Startup&lt;/b&gt; class.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;font-family: Consolas; font-size: 15px;&quot;&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af;&quot;&gt;Startup&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;Configuration(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af;&quot;&gt;IAppBuilder&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;app)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: green;&quot;&gt;//&amp;nbsp;Create&amp;nbsp;JsonSerializer&amp;nbsp;with&amp;nbsp;StringEnumConverter.&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;serializer&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;JsonSerializer&lt;/span&gt;();&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;serializer.Converters.Add(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;StringEnumConverter&lt;/span&gt;());&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&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;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: green;&quot;&gt;//&amp;nbsp;Register&amp;nbsp;the&amp;nbsp;serializer.&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;GlobalHost&lt;/span&gt;.DependencyResolver.Register(&lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;color: #2b91af;&quot;&gt;JsonSerializer&lt;/span&gt;),&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;serializer);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;app.MapSignalR();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
&lt;/span&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
With that piece of code, the enums can now be serialized to their text values and I don&#39;t have to modify the properties in the entities.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/4966106624578238538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/4966106624578238538' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/4966106624578238538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/4966106624578238538'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/04/serializing-enums-in-aspnet-signalr.html' title='Serializing Enums in ASP.NET SignalR'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEiJOU9EjlezHYgt7u5XMQkZb0A5SiutwDvQj0HHzSdMHCGHX_7KIFeeQZ3yDiI4B76vyOTcdfeUe08aXYAuX92pEWA2Q8QBvRUQ2sJrD3jAAYijDf6XhmaxZqYMw7GDzMnSPj2M/s72-c/signalR-enum.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-8259834864503742483</id><published>2014-03-26T08:45:00.000+08:00</published><updated>2014-05-08T09:44:01.970+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>Layered Architecture Solution Guidance (LASG) FAQ</title><content type='html'>Over the years, I have collected a number of frequently asked questions while working on &lt;a href=&quot;http://layerguidance.codeplex.com/&quot;&gt;Layered Architecture Solution Guidance (LASG)&lt;/a&gt;&amp;nbsp;and I think it will be good if I put them in a FAQ.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. What versions of Visual Studio are supported?&lt;/b&gt;&lt;br /&gt;
The latest version of LASG targets Visual Studio 2013 but you can still download the older versions for Visual Studio 2012 and 2010. Older versions will contain lesser features and development on them has been discontinued.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. What editions of Visual Studio are supported?&lt;/b&gt;&lt;br /&gt;
LASG is designed to run on Visual Studio Professional, Premium and Ultimate editions. The Modeling project only appears in Visual Studio Ultimate.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Is non-English version of Visual Studio supported?&lt;/b&gt;&lt;br /&gt;
As of version 1.0.1.0, LASG can only run on English versions of Visual Studio. A version that is supposed to support non-English Visual Studio is currently under works and hope to address the issue. The labels however, will still display in English even if it runs on non-English Visual Studio.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. Can the Inertia code-generator support non-Microsoft SQL Server databases i.e. Oracle?&lt;/b&gt;&lt;br /&gt;
No. Inertia uses the SQL Server Management Objects (SMO) library and therefore, can only support Microsoft SQL Server.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. Can I use Microsoft SQL Server Express edition?&lt;/b&gt;&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6. Does the Momentum code-generator supports Entity Framework?&lt;/b&gt;&lt;br /&gt;
No. Momentum only generates code that targets Enterprise Library Data Access Application Block (DAAB).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7. Are there plans to support Entity Framework in future?&lt;/b&gt;&lt;br /&gt;
No. There are no plans to support Entity Framework currently, but there were some thoughts on it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8. How can I use LASG with Entity Framework?&lt;/b&gt;&lt;br /&gt;
Depending on your choice, you can use Inertia to generate the entities as POCOs and write your own CRUD methods in the Data Access Components that uses EF. You can then continue to use the LASG generators from Business Layer onwards and things will still work.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9. Does&amp;nbsp;the Momentum code-generator supports Stored Procedures?&lt;/b&gt;&lt;br /&gt;
No.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;10. Are there plans to support Stored Procedures in future?&lt;/b&gt;&lt;br /&gt;
No. Some experimental work was done to support Stored Procedures but it was shelved due to the massive effort required to re-design the internals of Momentum.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;11. Why the code-generators have such code-names?&lt;/b&gt;&lt;br /&gt;
They were initially part of a separate pet-project called Project Newton before being merged into LASG. Hence, they all have code-names taken from articles describing the Newton Speed Theory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, please feel free to put them in the comments and I will try my best to answer them. :)</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/8259834864503742483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/8259834864503742483' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8259834864503742483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8259834864503742483'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/layered-architecture-solution-guidance_26.html' title='Layered Architecture Solution Guidance (LASG) FAQ'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-5421998874523840987</id><published>2014-03-24T08:49:00.002+08:00</published><updated>2014-03-24T08:50:17.951+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>Layered Architecture Solution Guidance (LASG) Tutorials</title><content type='html'>I&#39;ve finally completed writing all the tutorials for &lt;a href=&quot;http://layerguidance.codeplex.com/&quot;&gt;Layered Architecture Solution Guidance (LASG)&lt;/a&gt;. Here&#39;s the full list for easy reference:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/02/lasg-getting-started.html&quot;&gt;How-To: Get Started with Layered Architecture Solution Guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-entities.html&quot;&gt;How-To: Create Business Entities with Inertia in LASG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-data-access-components.html&quot;&gt;How-To: Create Data Access Components with Momentum in LASG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-business-components.html&quot;&gt;How-To: Create Business Components with Motion in LASG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-service-layer-components.html&quot;&gt;How-To: Create Service Layer Components with Velocity in LASG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-workflow-services-and.html&quot;&gt;How-To: Create Workflow Services and Activities with Vector in LASG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-ui-process-components.html&quot;&gt;How-To: Create UI Process Components with Impulse in LASG&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
During the development of these tutorials, I have spotted some UI inconsistencies in some of the code-generators and I have decided to fix them in the next release. Hopefully, these articles are useful in helping you to adopt LASG.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/5421998874523840987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/5421998874523840987' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/5421998874523840987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/5421998874523840987'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/layered-architecture-solution-guidance.html' title='Layered Architecture Solution Guidance (LASG) Tutorials'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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-7549567.post-9209961042029902216</id><published>2014-03-18T11:32:00.002+08:00</published><updated>2014-03-18T11:32:29.230+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><category scheme="http://www.blogger.com/atom/ns#" term="WF"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Communication Foundation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Workflow Foundation"/><title type='text'>How-To: Create UI Process Components with Impulse in LASG</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
This is the final part of the 7-series tutorial on&amp;nbsp;&lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance 2013&lt;/a&gt;. In this walk-through, we will be looking at the last code-generator in the family, the&amp;nbsp;&lt;b&gt;Impulse: User Interface Process Component Generator&lt;/b&gt; to create UI Controller components. Creating UI Controllers is also the final step in the LASG Code Generation process.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Before beginning this guide, please make sure that you have completed the previous tutorials on&amp;nbsp;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-service-layer-components.html&quot;&gt;Creating Service Layer Components with Velocity in LASG&lt;/a&gt;&amp;nbsp;and &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-workflow-services-and.html&quot;&gt;Creating Workflow Services and Activities with Vector in LASG&lt;/a&gt;. Please make sure that your solution is fully compilable without any errors before starting. This walk-through also uses the&amp;nbsp;&lt;b&gt;LeaveSample&amp;nbsp;&lt;/b&gt;database that is part of the&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;but you may use your own database to follow through.&lt;/div&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/AVvXsEilSUm6I0tigUSvRdR6tYYrTbgqRcwjxESWO-yR90fBtaWcsAaXdgcJe2_Eg4TuZ7jp_yE3pAUdpe8pEShR_w_9ilTHjyte36NrWRjAFrv50dV78Xbwp_pqpksOqdy5W2Z3ssL5/s1600/06-Guide.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/AVvXsEilSUm6I0tigUSvRdR6tYYrTbgqRcwjxESWO-yR90fBtaWcsAaXdgcJe2_Eg4TuZ7jp_yE3pAUdpe8pEShR_w_9ilTHjyte36NrWRjAFrv50dV78Xbwp_pqpksOqdy5W2Z3ssL5/s1600/06-Guide.png&quot; height=&quot;368&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Before launching the code-generator, the Host project will need to be started.&amp;nbsp;In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, expand the&amp;nbsp;&lt;b&gt;Tutorial&amp;nbsp;&lt;/b&gt;solution, go to the &lt;b&gt;Hosts &lt;/b&gt;folder, right-click on the &lt;b&gt;Tutorial.Hosts.Web &lt;/b&gt;project and select &lt;b&gt;Properties&lt;/b&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the project properties page, select the &lt;b&gt;Web &lt;/b&gt;category and uncheck the &lt;b&gt;Enable Edit and Continue&lt;/b&gt; check box. To understand why we need to do this, please refer to this &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/new-iis-express-behavior-in-vs-2013.html&quot;&gt;post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzZ91mXoPrKuptF-U5GfOxKbReH974FUKRUmWTUMbr_ULUg3VROkyOw65Hi2fyxN7b4pyyyHDUjFpfTh9HN0cmUuiCJx4Oi3lydpUd9b0KWG93w3TuVUOHMkRiJPbJC6IKaEBY/s1600/Edit+and+Continue.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/AVvXsEhzZ91mXoPrKuptF-U5GfOxKbReH974FUKRUmWTUMbr_ULUg3VROkyOw65Hi2fyxN7b4pyyyHDUjFpfTh9HN0cmUuiCJx4Oi3lydpUd9b0KWG93w3TuVUOHMkRiJPbJC6IKaEBY/s640/Edit+and+Continue.png&quot; height=&quot;384&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: I actually took this screenshot from another post. The actual port number for my project is 2381 and not 13619 (the port used in layer sample). Your port number could be different.&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;b&gt;Save &lt;/b&gt;the setting.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, right-click on the&amp;nbsp;&lt;b&gt;Tutorial.Hosts.Web&amp;nbsp;&lt;/b&gt;project, select &lt;b&gt;Debug&lt;/b&gt;&amp;nbsp;and then select &lt;b&gt;Start new instance&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Your browser should launch with a HTTP Error 403.14 - Forbidden page. This is normal.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;To test the WCF service, simply append &lt;i&gt;LeaveService.svc &lt;/i&gt;to the end of the address i.e.&lt;i&gt;&amp;nbsp;http://localhost:2381/&lt;b&gt;LeaveService.svc&lt;/b&gt;&lt;/i&gt;. To test the workflow service, append the address with&amp;nbsp;&lt;i&gt;LeaveWorkflowService.svc&amp;nbsp;&lt;/i&gt;instead i.e.&amp;nbsp;&lt;i&gt;http://localhost:2381/&lt;b&gt;LeaveWorkflowService.svc&lt;/b&gt;. &lt;/i&gt;You should get a result page similar to the following for both the address.&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/AVvXsEhDulcBt-NyLFkWQnxAblsrqq_GzB8r93E75Cl0s41bHm2-TfxtQ5bhQEoI1QJTAv-XLUdVfLUQ4eD7LKn3m7fOI4sLJYKExEECTkboUXc-YmzVt2iQ-35fX2GqNmuMSwLxmf8l/s1600/06-Browser.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/AVvXsEhDulcBt-NyLFkWQnxAblsrqq_GzB8r93E75Cl0s41bHm2-TfxtQ5bhQEoI1QJTAv-XLUdVfLUQ4eD7LKn3m7fOI4sLJYKExEECTkboUXc-YmzVt2iQ-35fX2GqNmuMSwLxmf8l/s1600/06-Browser.png&quot; height=&quot;470&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: Clicking on the url on this page will lead you to the WSDL of the service. (Whole page full of XML)&lt;br /&gt;&lt;br /&gt;Tip: If you are curious how the host was configured, the answer lies in the web.config. As you clicked through the code-generators, bits and pieces of the settings were registered into the web.config.&lt;/div&gt;
&lt;br /&gt;

&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Stop debugging but ensure that IIS Express is still running in the background. You can confirm this by checking the system tray for the IIS Express icon.&lt;br /&gt;
&lt;br /&gt;
Note: The browser may shut down.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Once you have confirmed that your services are running, we can proceed with the code-generator. In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, expand the&amp;nbsp;&lt;b&gt;Tutorial&amp;nbsp;&lt;/b&gt;solution, go to the&amp;nbsp;&lt;b&gt;Presentation&amp;nbsp;&lt;/b&gt;folder. Right-click on the &lt;b&gt;Tutorial.UI.Process&lt;/b&gt; project to invoke the context menu and click &lt;b&gt;Add User Interface Process Components...&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/AVvXsEgpWGg2_8Swwh_feS88m7iggPf54E0AjEQ89M6gRW7ST0jkcIcrDDG-fr6DprXTAv-GPWpUaSbrxozlbTY3y9PimM2MFmyKNTk0e96DUpcktgMFN88VXX0maaD4Y-mO5Wc2HIPd/s1600/06-Launch.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/AVvXsEgpWGg2_8Swwh_feS88m7iggPf54E0AjEQ89M6gRW7ST0jkcIcrDDG-fr6DprXTAv-GPWpUaSbrxozlbTY3y9PimM2MFmyKNTk0e96DUpcktgMFN88VXX0maaD4Y-mO5Wc2HIPd/s1600/06-Launch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The &lt;b&gt;Impulse: User Interface Process Component Generator&lt;/b&gt; will launch. Impulse is divided into 3 sections.&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/AVvXsEjxTYFbal_EalBjiex_Rb87dt5xAac4g3aTc5Op82f55gkBml6w1NoISLLSPHuD9Cz-zbOTwIcSW3OmpOFkRn-DRzu2P0TszGrCEzBkKmdOs2KzjXeTjRvNmYGo3pS2iy2MCz44/s1600/06-Impulse.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/AVvXsEjxTYFbal_EalBjiex_Rb87dt5xAac4g3aTc5Op82f55gkBml6w1NoISLLSPHuD9Cz-zbOTwIcSW3OmpOFkRn-DRzu2P0TszGrCEzBkKmdOs2KzjXeTjRvNmYGo3pS2iy2MCz44/s1600/06-Impulse.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By default, Impulse loads the service contract assembly for the WCF services from the centralized&amp;nbsp;&lt;b&gt;bin&lt;/b&gt;&amp;nbsp;folder located under the solution (i.e.&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Tutorial\bin&lt;/span&gt;).&amp;nbsp;In this exercise, the&amp;nbsp;&lt;b&gt;Tutorial.Services.Contracts.dll&amp;nbsp;&lt;/b&gt;should be automatically loaded.&lt;br /&gt;&lt;br /&gt;Note: If the service contract project cannot be loaded, please exit Impulse and return to Visual Studio to ensure that there are service contracts in the Tutorial.Services.Contracts project and all dependent assemblies are located in the centralized bin folder. Please make sure that the project can be built&amp;nbsp;successfully.&amp;nbsp;You can also manually load the business project assembly by clicking the&amp;nbsp;&lt;b&gt;Load&lt;/b&gt;&amp;nbsp;button and selecting the .dll file.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Like previous the code-generators, Impulse supplies us with default values in the &lt;b&gt;&lt;span style=&quot;background-color: #ea9999; color: white;&quot;&gt;&amp;nbsp;1. Define User Interface Process Component &lt;/span&gt;&lt;/b&gt;&amp;nbsp;section.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Verify that the &lt;b&gt;WCF Services&lt;/b&gt; radio button is selected.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Verify that &lt;i&gt;Leave&lt;/i&gt; is in the &lt;b&gt;UI Process name&lt;/b&gt; text box. The default &lt;b&gt;Suffix&lt;/b&gt; for UI process components is &lt;i&gt;Controller&lt;/i&gt;. Impulse will create a component called &lt;i&gt;LeaveController&lt;/i&gt; for us.&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/AVvXsEhYgi8w62Bh8UknodkKdGR3Ibr-zF9dNOJz_BlqcJqon_keW22XM_2BC_a61fts-X45lspPCniTEIwxgUqbqoXF5YqUS9kMDroDedaFDqieyT11rHnYhzo1mvjzeH5W7UdTJGS9/s1600/06-Section1.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/AVvXsEhYgi8w62Bh8UknodkKdGR3Ibr-zF9dNOJz_BlqcJqon_keW22XM_2BC_a61fts-X45lspPCniTEIwxgUqbqoXF5YqUS9kMDroDedaFDqieyT11rHnYhzo1mvjzeH5W7UdTJGS9/s1600/06-Section1.png&quot; height=&quot;118&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Tip: Take note that although the UI process components are called controllers, they are in no way related to ASP.NET MVC controllers.&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;All the service contracts that are available in the service contract assembly will be listed in the &lt;b&gt;Services &lt;/b&gt;dropdown list&amp;nbsp;at the&amp;nbsp;&lt;b style=&quot;background-color: #ea9999;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;2. Select Methods to Call&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section.&amp;nbsp;Verify that &lt;i&gt;ILeaveService&lt;/i&gt; is selected.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;All the methods in the service contract will be shown in the list box under the &lt;b&gt;Available operations&lt;/b&gt; check box.&amp;nbsp;Check the &lt;b&gt;Available operations&lt;/b&gt; check box to select all service operations.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.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/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;button to add them to the &lt;b&gt;Selected operations&lt;/b&gt; grid.&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/AVvXsEibN3N5kYq6bFaGudDmRziZceF2kP9B1azDbBQLLPfqXJT3St3B9uspchk38d24ybUxKL9g5gvf9k-NAH5_Fr3fg5MczQFSixqVW1y9YdmbntTCGZyt5y_TxxZHF2A9UltfBxYO/s1600/06-WCF-Section2.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/AVvXsEibN3N5kYq6bFaGudDmRziZceF2kP9B1azDbBQLLPfqXJT3St3B9uspchk38d24ybUxKL9g5gvf9k-NAH5_Fr3fg5MczQFSixqVW1y9YdmbntTCGZyt5y_TxxZHF2A9UltfBxYO/s1600/06-WCF-Section2.png&quot; height=&quot;484&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the &lt;b&gt;Add to Code Generation&lt;/b&gt; button to queue the service definitions.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Return to the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background-color: #ea9999; color: white;&quot;&gt;&amp;nbsp;1. Define User Interface Process Component&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section and click on the &lt;b&gt;Workflow Services&lt;/b&gt; radio button to load the &lt;b&gt;Tutorial.Workflows.dll&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Note: You should know the drill by now, if the workflow assembly fails to load, please exit Impulse and return to Visual Studio to make sure that there are workflows in the Tutorial.Workflows project and all dependent assemblies are located in the centralized bin folder. You will need to have at least one ReceiveActivity in your workflow to have something show-up. A blank xaml file will not do. Also make sure that the workflow project can build successfully. You can manually load the workflow project assembly by clicking the&amp;nbsp;&lt;b&gt;Load&lt;/b&gt;&amp;nbsp;button and selecting the .dll file.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Verify that&amp;nbsp;&lt;i&gt;Leave&lt;/i&gt;&amp;nbsp;is still in the&amp;nbsp;&lt;b&gt;UI Process name&lt;/b&gt;&amp;nbsp;text box and the default&amp;nbsp;&lt;b&gt;Suffix&lt;/b&gt;&amp;nbsp;is still&amp;nbsp;&lt;i&gt;Controller&lt;/i&gt;. Our &lt;i&gt;LeaveController &lt;/i&gt;component&amp;nbsp;will call both the backend WCF and Workflow services.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At&amp;nbsp;the&amp;nbsp;&lt;b style=&quot;background-color: #ea9999;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;2. Select Methods to Call&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section, ensure that &lt;i&gt;LeaveWorkflowService &lt;/i&gt;is selected in the &lt;b&gt;Services &lt;/b&gt;dropdown list.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;All the methods defined in the Receive activities in the workflow xaml will be listed in the list box below the&amp;nbsp;&lt;b&gt;Available operations&lt;/b&gt;&amp;nbsp;check box. Check the&amp;nbsp;&lt;b&gt;Available operations&lt;/b&gt;&amp;nbsp;check box to select all the workflow service operations.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.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/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;button to add them to the&amp;nbsp;&lt;b&gt;Selected operations&lt;/b&gt;&amp;nbsp;grid.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJrr0vn_Y5E64Gf44xUU3_NnKqV0hCDG4SI1Xe59r3xUKwxT2DeDd1jHD-lCUYWhcxZU4HvoIiR2GpeTNXy3DPGJ6ekkXMKEv2wZVtLPO93g2j2tDm5fKR8IaO80_q_sxnd3I6/s1600/06-WF-Section2.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/AVvXsEgJrr0vn_Y5E64Gf44xUU3_NnKqV0hCDG4SI1Xe59r3xUKwxT2DeDd1jHD-lCUYWhcxZU4HvoIiR2GpeTNXy3DPGJ6ekkXMKEv2wZVtLPO93g2j2tDm5fKR8IaO80_q_sxnd3I6/s1600/06-WF-Section2.png&quot; height=&quot;486&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to queue the definitions.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Notice the reminder about Add Service Reference? We can manually &lt;b&gt;Add Service Reference&lt;/b&gt; from Visual Studio or have Impulse launch it for us. Because we are adding both the WCF services and workflow services at the same time, we will require Impulse to launch the Add Service Reference dialog for us once for our WCF service, and we will need to manually launch it again from Visual Studio to add the Workflow service reference.&lt;br /&gt;&lt;br /&gt;Check the &lt;b&gt;Launch Add Service dialog&lt;/b&gt;&amp;nbsp;check box in the&amp;nbsp;&lt;b style=&quot;background-color: #ea9999;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;3. Generate UI Process Components&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section. You will notice the reminder is gone.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By now, you should have the following:&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/AVvXsEhyhwnwx2nqv_u0er2LjYqL2VIBg9uDiZV4a2HpsekrNv9f6vHi9Ersge8JvxAAyfehHIOYB2kg1rbyWn9sia9HdSFqrM2BK-rpIY9EFUED7lb-N1_Dr7sMPwWsP_TNYP85h7Pd/s1600/06-Section3.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/AVvXsEhyhwnwx2nqv_u0er2LjYqL2VIBg9uDiZV4a2HpsekrNv9f6vHi9Ersge8JvxAAyfehHIOYB2kg1rbyWn9sia9HdSFqrM2BK-rpIY9EFUED7lb-N1_Dr7sMPwWsP_TNYP85h7Pd/s1600/06-Section3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the&amp;nbsp;&lt;b&gt;Generate&amp;nbsp;&lt;/b&gt;button to generate the UI controller class.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Notice that you are once again reminded with instructions for Add Service Reference at the&amp;nbsp;&lt;b&gt;Code Generation Completed&lt;/b&gt;&amp;nbsp;dialog, click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&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/AVvXsEhRMa-VsiAb5ExBeYZvMbjaYFToE59qSo4R3EqY38-6k0TnMzZLTM8Z5Fn7cenCnP_31XxtBDsmfCesMYamTLM4UNiQNJz2ZugjVbsy1F0CBt-bE0W-F2fqtcew7WXHR1KgbQ2_/s1600/06-Information.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/AVvXsEhRMa-VsiAb5ExBeYZvMbjaYFToE59qSo4R3EqY38-6k0TnMzZLTM8Z5Fn7cenCnP_31XxtBDsmfCesMYamTLM4UNiQNJz2ZugjVbsy1F0CBt-bE0W-F2fqtcew7WXHR1KgbQ2_/s1600/06-Information.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The Visual Studio &lt;b&gt;Add Service Reference&lt;/b&gt; dialog will launch.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In the Address bar, type in the url to your LeaveService i.e.&amp;nbsp;&lt;i&gt;http://localhost:2381/LeaveService.svc&lt;/i&gt;&amp;nbsp;and click &lt;b&gt;GO&lt;/b&gt;. You should be able to see the details of the LeaveService in the &lt;b&gt;Services &lt;/b&gt;and &lt;b&gt;Operations &lt;/b&gt;list boxes.&lt;br /&gt;&lt;br /&gt;Note: If you cannot see the service, that means the host project is not running. Please make sure the host is running.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Enter &lt;i&gt;LeaveService &lt;/i&gt;in the &lt;b&gt;Namespace &lt;/b&gt;text box.&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/AVvXsEiAwRQ7s4Q1p5loSjJe4Z0xtr_pM3Jbcw6HQmjNFvw0Vr0QRTmfjDPjJ9LtA6FBTlpZ5etHbUxEYI9VJUaiJa57HrvOOMzNyGs3sOiJI1IUiT0fNNUNkKimYbumO7QRu8JXkGqD/s1600/06-WCF+Reference.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/AVvXsEiAwRQ7s4Q1p5loSjJe4Z0xtr_pM3Jbcw6HQmjNFvw0Vr0QRTmfjDPjJ9LtA6FBTlpZ5etHbUxEYI9VJUaiJa57HrvOOMzNyGs3sOiJI1IUiT0fNNUNkKimYbumO7QRu8JXkGqD/s1600/06-WCF+Reference.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the &lt;b&gt;Advance...&lt;/b&gt; button to open the &lt;b&gt;Service Reference Settings&lt;/b&gt; dialog.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In the &lt;b&gt;Collection type&lt;/b&gt; dropdown list, select &lt;i&gt;System.Collections.Generic.List&lt;/i&gt;. Click &lt;b&gt;OK&lt;/b&gt;.&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/AVvXsEiOJSM9Psnr6_Cvr-8XF0eP0WgINo34y000GUkFqIjR3ZvfLax2wGmY-OQdVehNsGmiLJpDuqTCHAjr5-04xJTfj-6OK4RVA8A9Fx2VJjnFCRhEKvEAx8ZKqglDj0TBAqX-4FDJ/s1600/06-Reference+Setting.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/AVvXsEiOJSM9Psnr6_Cvr-8XF0eP0WgINo34y000GUkFqIjR3ZvfLax2wGmY-OQdVehNsGmiLJpDuqTCHAjr5-04xJTfj-6OK4RVA8A9Fx2VJjnFCRhEKvEAx8ZKqglDj0TBAqX-4FDJ/s1600/06-Reference+Setting.png&quot; height=&quot;640&quot; width=&quot;622&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click &lt;b&gt;OK&lt;/b&gt; again to let Visual Studio generate the service reference code.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;To manually invoke the Add Service Reference dialog again for our workflow service, expand the &lt;b&gt;Tutorial.UI.Process&lt;/b&gt; project,&amp;nbsp;right-click on &lt;b&gt;References&lt;/b&gt; and click &lt;b&gt;Add Service Reference...&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In the Address bar, type in the url to the LeaveWorkflowService i.e.&amp;nbsp;&lt;i&gt;http://localhost:2381/LeaveWorkflowService.svc&lt;/i&gt;&amp;nbsp;and click&amp;nbsp;&lt;b&gt;GO&lt;/b&gt;. You should be able to see the details of the LeaveWorkflowService in the&amp;nbsp;&lt;b&gt;Services&amp;nbsp;&lt;/b&gt;and&amp;nbsp;&lt;b&gt;Operations&amp;nbsp;&lt;/b&gt;list boxes.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Enter&amp;nbsp;&lt;i&gt;LeaveWorkflowService&amp;nbsp;&lt;/i&gt;in the &lt;b&gt;Namespace&amp;nbsp;&lt;/b&gt;text box.&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/AVvXsEglkuAmH_OmqnSfbKe9Ug9Hygx6DwzGOed7IkK3h0kB16L649KIWgq49zHtIowIAnLpaF3Q2vXTAbWkcMeMUQVmA84uOzd97o_LoW_R6FQ1zkgdy5q1KsbutCJC2M3jBheHqcw4/s1600/06-WF+Reference.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/AVvXsEglkuAmH_OmqnSfbKe9Ug9Hygx6DwzGOed7IkK3h0kB16L649KIWgq49zHtIowIAnLpaF3Q2vXTAbWkcMeMUQVmA84uOzd97o_LoW_R6FQ1zkgdy5q1KsbutCJC2M3jBheHqcw4/s1600/06-WF+Reference.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Repeat step 31-32 for the LeaveWorkflowService.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;&amp;nbsp;to let Visual Studio generate the service reference code.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The &lt;b&gt;Tutorial.UI.Process&lt;/b&gt; project should contain the generated controller class.&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/AVvXsEjOg9OgG6Wz7HxXdm7ozsWHi15slQ3kN5GWrzfSHQLJAW4FRJwEjz5U6vLkiHltjY7X_hUdp4UPlJBe5BQAg_C237UbAgHi7vfSsKp2Xbn63xoVbmYbPSCeX43cMl2212Ope1Sn/s1600/06-Project.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/AVvXsEjOg9OgG6Wz7HxXdm7ozsWHi15slQ3kN5GWrzfSHQLJAW4FRJwEjz5U6vLkiHltjY7X_hUdp4UPlJBe5BQAg_C237UbAgHi7vfSsKp2Xbn63xoVbmYbPSCeX43cMl2212Ope1Sn/s1600/06-Project.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Ready to Go!&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You can now start developing your Web UI. At this point in time, LASG does not provide any UI generator. You can easily hook up the code to your WebForm like this:&lt;/span&gt;&lt;div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: blue; font-family: Consolas; font-size: 12.0pt; mso-highlight: white;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt; upc = &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; font-size: 12.0pt; mso-highlight: white;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; font-size: 12.0pt; mso-highlight: white;&quot;&gt;LeaveController&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;GridView1.DataSource
= upc.ListLeaves(0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt; line-height: 107%;&quot;&gt;GridView1.DataBind();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;But before you run the&amp;nbsp;&lt;b&gt;Tutorial.UI.Web&lt;/b&gt; project, you will need to copy the configuration that was generated by Visual Studio in the &lt;b&gt;Tutorial.UI.Process&lt;/b&gt; project. LASG provides a convenient way for you to do it.&lt;br /&gt;&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;Right-click on the &lt;b&gt;Tutorial.UI.Process&lt;/b&gt; project and select &lt;b&gt;Update Service Configuration to Client Projects&lt;/b&gt;.&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/AVvXsEhIJ4kbsd00EhcgMOn20FaEfXR1KWPYB8Pe9vBfQzQiqHpDLo2qiDH87jGuW-OCyFcMHP4RyI-UmQQY981VzgTSO-vsMXNQHuS47seMPFfkU_vHn6KxFarQLQnpYup8iBuOQA8t/s1600/06-Update+Config.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/AVvXsEhIJ4kbsd00EhcgMOn20FaEfXR1KWPYB8Pe9vBfQzQiqHpDLo2qiDH87jGuW-OCyFcMHP4RyI-UmQQY981VzgTSO-vsMXNQHuS47seMPFfkU_vHn6KxFarQLQnpYup8iBuOQA8t/s1600/06-Update+Config.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Summary and Conclusion&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: center;&quot;&gt;We have finally completed the tutorial for the last code-generator in LASG, the Impulse: User Interface Process Component Generator. As with other code-generators in the family, y&lt;/span&gt;ou are welcomed to change the generated code but take note that any changes made in your code will not be reflected in the definitions stored in Impulse. Therefore, practice caution when you are regenerating code on existing code file.&lt;br /&gt;&lt;br /&gt;Tip: In case you are wondering why all the fancy code-names for the code-generators, they were actually names mentioned in Newton speed theories. The code-generators was initially part of my own project called Project Newton before being merged into LASG.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This ends our 7 part series of walking through with LASG. I hope you find the information useful in adopting LASG. Thank You :)&lt;/div&gt;




&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-l91kMzWgsrI%2FUw2iBut2rsI%2FAAAAAAAAA30%2FyEIMFDC5zxw%2Fs1600%2F01-Right-Button.png&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/9209961042029902216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/9209961042029902216' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/9209961042029902216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/9209961042029902216'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/how-to-create-ui-process-components.html' title='How-To: Create UI Process Components with Impulse in LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEilSUm6I0tigUSvRdR6tYYrTbgqRcwjxESWO-yR90fBtaWcsAaXdgcJe2_Eg4TuZ7jp_yE3pAUdpe8pEShR_w_9ilTHjyte36NrWRjAFrv50dV78Xbwp_pqpksOqdy5W2Z3ssL5/s72-c/06-Guide.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-5814581243193629807</id><published>2014-03-17T11:40:00.002+08:00</published><updated>2014-03-18T11:35:39.029+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="WF"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Workflow Foundation"/><title type='text'>How-To: Create Workflow Services and Activities with Vector in LASG</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
This is the sixth in the series of the&amp;nbsp;&lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance 2013&lt;/a&gt;&amp;nbsp;walk-throughs where we will be exploring the&lt;b&gt;&amp;nbsp;Vector: Workflow Services and Activity Generator&lt;/b&gt;&amp;nbsp;to create workflow services and workflow activity components. Creating workflow services is the fifth step in the LASG Code Generation process. Before beginning this guide, please make sure that you have completed the previous tutorial on&amp;nbsp;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-business-components.html&quot;&gt;Creating Business Components with Motion in LASG&lt;/a&gt;. Please make sure that your solution is fully compilable without any errors before starting.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This walk-through also uses the&amp;nbsp;&lt;b&gt;LeaveSample&amp;nbsp;&lt;/b&gt;database that is part of the&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;but you may use your own database to follow through. It is also important that you have followed the steps in the sample to create the Workflow Persistence Store database. Otherwise, follow the instructions &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ee395773(v=vs.110).aspx&quot;&gt;here&lt;/a&gt; to locate the SQL scripts and then execute them on a newly created &lt;b&gt;WorkflowInstanceStore&lt;/b&gt; database.&lt;/div&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/AVvXsEhFm2ciWSB7sT6gya3fQ00dTD7lwLbJNDt9V2RPyBf0xjfqx4yNA0yjVkbU6vPZnMwZqlnNcIpUG8m0O33Gl3Ggur-P9hlLa7sGRUwgMU6wwct5uqhpdQTLoqDN-eVJsv0oNm88/s1600/05-Guide.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/AVvXsEhFm2ciWSB7sT6gya3fQ00dTD7lwLbJNDt9V2RPyBf0xjfqx4yNA0yjVkbU6vPZnMwZqlnNcIpUG8m0O33Gl3Ggur-P9hlLa7sGRUwgMU6wwct5uqhpdQTLoqDN-eVJsv0oNm88/s1600/05-Guide.png&quot; height=&quot;366&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, expand the&amp;nbsp;&lt;b&gt;Tutorial&amp;nbsp;&lt;/b&gt;solution, go to the&amp;nbsp;&lt;b&gt;Business&amp;nbsp;&lt;/b&gt;folder.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Right-click on any one of the&amp;nbsp;&lt;b&gt;Tutorial.Workflows,&lt;/b&gt;&amp;nbsp;&lt;b&gt;Tutorial.Workflows.Activities&lt;/b&gt; or &lt;b&gt;Tutorial.Workflows.Designers&amp;nbsp;&lt;/b&gt;project and click&amp;nbsp;&lt;b&gt;Add Workflow Activities... &lt;/b&gt;on the context menu.&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/AVvXsEjenBi8UXRHYW_8JHiNnWPSqaTwmWa0bRTIervPjBHuBR5sYoRtjng-n59laZ4uCuDHBeJvuwojjpMfOJCl77KoIjM9Vmyrqjb0kZgHGU_qfZSLDrfNvqS7AZwLtuRSuY_aC5JY/s1600/05-Launch.png&quot; imageanchor=&quot;1&quot; style=&quot;font-weight: bold; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjenBi8UXRHYW_8JHiNnWPSqaTwmWa0bRTIervPjBHuBR5sYoRtjng-n59laZ4uCuDHBeJvuwojjpMfOJCl77KoIjM9Vmyrqjb0kZgHGU_qfZSLDrfNvqS7AZwLtuRSuY_aC5JY/s1600/05-Launch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
Tip: Vector generates code to these 3 projects accordingly. The workflow service will be generated as an empty .xaml file to the Tutorial.Workflows project, activity classes will be generated to the Tutorial.Workflows.Activities project and their respective designer classes will be generated to the Tutorial.Workflow.Designers project. The classes in the Tutorial.Workflows.Designers project are only required for workflow design time purposes and do not need to be deployed onto your server.&lt;/div&gt;
&lt;br /&gt;

&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;This launches the&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-weight: bold;&quot;&gt;Vector: Workflow Services and Activity Generator&lt;/b&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;which contains 4 sections. Take note that Vector is designed to generate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Windows Workflow Foundation (WF)&lt;/span&gt;&amp;nbsp;services and activities, therefore, you are encouraged to read-up on WF and&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/vstudio/dd456788(v=vs.110).aspx&quot; style=&quot;font-weight: normal;&quot;&gt;WorkflowServices&lt;/a&gt; to understand the terminologies used.&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/AVvXsEgjadYjj-05KkV3yNxR-o4iKuJsf7IE2lSAHLDQul9d7QYZYqCDnySYY8wwIv0ScoIjH0E0_W1z2-dw5AVuB-GENRItIr5hzKeLryDLGHUKKniIUDAxeQeFWJOJ4MHl3__FG3Fg/s1600/05-Vector.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/AVvXsEgjadYjj-05KkV3yNxR-o4iKuJsf7IE2lSAHLDQul9d7QYZYqCDnySYY8wwIv0ScoIjH0E0_W1z2-dw5AVuB-GENRItIr5hzKeLryDLGHUKKniIUDAxeQeFWJOJ4MHl3__FG3Fg/s1600/05-Vector.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: It is always difficult to classify Workflow Services in the Layered Architecture due to their technological nature of being both a business component and also a service. In LASG, Workflow Services are still classified under the business layer even-though they are considered peers to the WCF services.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By default, Vector will attempt to load the business project assembly from the centralized&amp;nbsp;&lt;b&gt;bin&lt;/b&gt;&amp;nbsp;folder located under the solution (i.e.&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Tutorial\bin&lt;/span&gt;)&amp;nbsp;and populate the details in&amp;nbsp;the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: white;&quot;&gt;&amp;nbsp;1. Define Workflow Service&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section.&amp;nbsp;In this exercise, the&amp;nbsp;&lt;b&gt;Tutorial.Business.dll&amp;nbsp;&lt;/b&gt;should be automatically loaded.&lt;br /&gt;&lt;br /&gt;Note: If the business project assembly is not loaded, please exit Vector and return to Visual Studio to make sure that there are business components in the Tutorial.Business project and the solution is compilable without errors. Also please ensure that all dependent assemblies are located in the centralized bin folder. You can also manually load the business project assembly by clicking the&amp;nbsp;&lt;b&gt;Load&lt;/b&gt;&amp;nbsp;button and selecting the .dll file.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;All business components that exists in the assembly will be listed in the&amp;nbsp;&lt;b&gt;Business components&lt;/b&gt;&amp;nbsp;dropdown list. Verify that the&amp;nbsp;&lt;i&gt;LeaveComponent&amp;nbsp;&lt;/i&gt;is selected.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Vector will suggest the&amp;nbsp;&lt;b&gt;Workflow service name&amp;nbsp;&lt;/b&gt;for us. By default, it will replace the&amp;nbsp;&lt;i&gt;Component&amp;nbsp;&lt;/i&gt;suffix from the business component with a&amp;nbsp;&lt;i&gt;WorkflowService&amp;nbsp;&lt;/i&gt;suffix. Leave the default suggestions and let Vector create a&amp;nbsp;&lt;i&gt;LeaveWorkflowService&amp;nbsp;&lt;/i&gt;component for us.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Vector will also suggest the service contract name&amp;nbsp;for us. Verify that &lt;i&gt;ILeaveWorkflowService&lt;/i&gt; is entered into the&amp;nbsp;&lt;b&gt;Service contract &lt;/b&gt;text box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By default, the service namespace is&amp;nbsp;&lt;i&gt;http://tempuri.org/&lt;/i&gt;. You can&amp;nbsp;change the value by typing into the &lt;b&gt;Service namespace&amp;nbsp;&lt;/b&gt;text box or click the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-3-jYvpWN6F5NPyyxHpAIRSJ59iEEa0wtqVNtFZClbLKpSJdzX9ZIrbWPRIzHuPUSMuU6u8Y39SLCLZUQnampzMylu6JRQxPbHqa9oReOM7oJJ5vXVgR901L1nVJi4sfioqNl/s1600/04-Callout+Button.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/AVvXsEi-3-jYvpWN6F5NPyyxHpAIRSJ59iEEa0wtqVNtFZClbLKpSJdzX9ZIrbWPRIzHuPUSMuU6u8Y39SLCLZUQnampzMylu6JRQxPbHqa9oReOM7oJJ5vXVgR901L1nVJi4sfioqNl/s1600/04-Callout+Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp; button to get Vector to suggest one for you. For this exercise, we will use the default value.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Since most of the values were automatically filled in for us, please ensure that the settings that you have are somewhat like the following:&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/AVvXsEiDHguXfrQSrMyhVioWX_fk2H0WI_hs7oAsTQm5RnYo-8jCHgcU65ENeFzmW1ljHm826dA6XPRmx3wHuzug77toG9J6HfRhYTKvB_9VvQe08Er_pLH_1BB4hCAXY2JuEk0g2lis/s1600/05-Section1.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/AVvXsEiDHguXfrQSrMyhVioWX_fk2H0WI_hs7oAsTQm5RnYo-8jCHgcU65ENeFzmW1ljHm826dA6XPRmx3wHuzug77toG9J6HfRhYTKvB_9VvQe08Er_pLH_1BB4hCAXY2JuEk0g2lis/s1600/05-Section1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Define an endpoint for the new service. This only needs to be done once when a workflow service is first created. At the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: white;&quot;&gt;&amp;nbsp;2. Define Endpoint Configurations&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section, make sure&amp;nbsp;&lt;i&gt;basicHttpBinding&amp;nbsp;&lt;/i&gt;is selected in the&amp;nbsp;&lt;b&gt;Binding&amp;nbsp;&lt;/b&gt;dropdown list and leave the default values in the&amp;nbsp;&lt;b&gt;Endpoint&lt;/b&gt;&amp;nbsp;name and&amp;nbsp;&lt;b&gt;Address&lt;/b&gt;. Click the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhumoUMLjIAI00jWlISb2YYrWPWtGh45g3PiVMxSvawHemECUjp-3SElMP95uygRK5geqbsTQm6eSKMl2XqzUPRRk4NKeur69sQigFV8-rU_mJZgrw2Cin_Ic9A5GXKyOjptk08/s1600/04-Add+button.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/AVvXsEhumoUMLjIAI00jWlISb2YYrWPWtGh45g3PiVMxSvawHemECUjp-3SElMP95uygRK5geqbsTQm6eSKMl2XqzUPRRk4NKeur69sQigFV8-rU_mJZgrw2Cin_Ic9A5GXKyOjptk08/s1600/04-Add+button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp; button to add it to the&amp;nbsp;&lt;b&gt;Service endpoints&lt;/b&gt;&amp;nbsp;grid.&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/AVvXsEgUyE6BE6oKaOCDLu1HHv22-co762wThw0_MA4IHcwmegB-T-_Zv1cX8W2MeGd2HKPUz6BrRRbz1-svlszg53utohPE6zUgpMkY6tIl1I9y3vPON8-QS7MZnaizpALaJHS-yb8o/s1600/05-Section2.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/AVvXsEgUyE6BE6oKaOCDLu1HHv22-co762wThw0_MA4IHcwmegB-T-_Zv1cX8W2MeGd2HKPUz6BrRRbz1-svlszg53utohPE6zUgpMkY6tIl1I9y3vPON8-QS7MZnaizpALaJHS-yb8o/s1600/05-Section2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Tip: You can create multiple endpoints for your services based on WCF&#39;s guidelines. You may be wondering why WCF is mentioned here. The reason is because WorkflowServices are actually a fusion of WF and WCF. Therefore, some of the WCF settings will apply to WorkflowServices as well.&amp;nbsp;For this exercise, we will only use one endpoint.&lt;br /&gt;&lt;br /&gt;Note: The Address is only used in non-IIS/WAS hosts i.e. your own Console host. Since most enterprise WorkflowServices are usually (and recommended to be) hosted on IIS/WAS, this setting is seldom used and is just retained for backward LASG compatibility.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Creating the Apply workflow activity. At the &lt;b style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;3. Define Workflow Activities &lt;/span&gt;&lt;/b&gt;&amp;nbsp;section, select &lt;b&gt;Apply &lt;/b&gt;in the&lt;b&gt; Business methods&lt;/b&gt; list box.&lt;br /&gt;&lt;br /&gt;Note: You can actually select more than one business method to be included in an activity but that is not recommended. It is always advisable to have one business method to be exposed as one activity whereby, you can later use the granular activities to compose more complex activities.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Make sure that &lt;i&gt;CodeActivity&amp;nbsp;&lt;/i&gt;is selected in the &lt;b&gt;Base activity type&lt;/b&gt; dropdown list.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Leave the &lt;b&gt;Activity name&lt;/b&gt;&amp;nbsp;text box value as &lt;i&gt;Apply&lt;/i&gt;. By default, Vector uses the name of the business method as the activity name.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Make sure &lt;i&gt;None&lt;/i&gt;&amp;nbsp;is selected in &lt;b&gt;Emit tracking record&lt;/b&gt; dropdown list.&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/AVvXsEi8Wx25Pg6Nl1NI4y0IfPiLpmC_mvkqy8BEnhHNRF_56XbTgrNEB1V_scxyZe1eb_5dvFTuWQiE_eNw7nhzKliiuQcBxXFq6OBTDPc-zb_uds8PpJJH_zHXM3cvAmqKZvHHOSmV/s1600/05-Activity.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/AVvXsEi8Wx25Pg6Nl1NI4y0IfPiLpmC_mvkqy8BEnhHNRF_56XbTgrNEB1V_scxyZe1eb_5dvFTuWQiE_eNw7nhzKliiuQcBxXFq6OBTDPc-zb_uds8PpJJH_zHXM3cvAmqKZvHHOSmV/s1600/05-Activity.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Select &lt;i&gt;ReceiveAndSendReply&lt;/i&gt; at the &lt;b&gt;Messaging wrapper activity type&lt;/b&gt; dropdown list. This will create a messaging wrapper activity that will wrap your activity between a pair of ReceiveActivity and SendReplyActivity.&lt;br /&gt;&lt;br /&gt;Tip: Selecting &lt;i&gt;Receive &lt;/i&gt;will create an wrapper class that only contains a ReceiveActivity which will only allow asynchronous calls to your workflow activity.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Verify that the value&amp;nbsp;&lt;i&gt;ApplyReceiveSend &lt;/i&gt;is entered into the&lt;b&gt; Messaging wrapper activity name&lt;/b&gt; text box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The Apply activity is the first activity in our workflow (as in a User applies for a leave). To allow our activity to start the workflow, we will need to check the &lt;b&gt;Can create instance&lt;/b&gt; check box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check the &lt;b&gt;Persist before send&lt;/b&gt; check box.&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/AVvXsEjDq9vnh50y7Sk3MOz5FBRSD0yEFAIN9F31qsO-9soXJfHqa85o2sXlggRAYM0FbpwAu_Q3t1RyzsW8W3Z6zO1gH1CjvkaYoh8n5OM-anLzoEbglcLyJ4TeDQZAKVP9LUJhHX3R/s1600/05-Wrapper.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/AVvXsEjDq9vnh50y7Sk3MOz5FBRSD0yEFAIN9F31qsO-9soXJfHqa85o2sXlggRAYM0FbpwAu_Q3t1RyzsW8W3Z6zO1gH1CjvkaYoh8n5OM-anLzoEbglcLyJ4TeDQZAKVP9LUJhHX3R/s1600/05-Wrapper.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
Tip: Persist before send will ensure that all our values in our workflow will be saved before returning the result to the caller.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.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/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;button to add the &lt;b&gt;Apply &lt;/b&gt;activity to the &lt;b&gt;Activities &lt;/b&gt;grid.&lt;br /&gt;&lt;br /&gt;Tip: To remove an activity from the grid, right-click on the row to invoke a context menu and click &lt;b&gt;Delete&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create an Approve activity. Select &lt;i&gt;Approve&amp;nbsp;&lt;/i&gt;in the &lt;b&gt;Business methods &lt;/b&gt;list box.&amp;nbsp;Make sure &lt;i&gt;ReceiveAndSendReply&lt;/i&gt;&amp;nbsp;is selected&amp;nbsp;in the&amp;nbsp;&lt;b&gt;Messaging wrapper activity type&lt;/b&gt;&amp;nbsp;dropdown list&amp;nbsp;and click the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.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/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;button to add it to the&amp;nbsp;&lt;b&gt;Activities&lt;/b&gt;&amp;nbsp;grid.&lt;br /&gt;&lt;br /&gt;Tip: Notice the &lt;b&gt;Can create instance&lt;/b&gt; check box has been automatically unchecked? This is to prevent us from accidentally creating multiple activities that could start the workflow.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create a Cancel activity. Select&amp;nbsp;&lt;i&gt;Cancel&lt;/i&gt;&amp;nbsp;in the&amp;nbsp;&lt;b&gt;Business methods&amp;nbsp;&lt;/b&gt;list box.&amp;nbsp;Make sure&amp;nbsp;&lt;i&gt;ReceiveAndSendReply&lt;/i&gt;&amp;nbsp;is selected&amp;nbsp;in the&amp;nbsp;&lt;b&gt;Messaging wrapper activity type&lt;/b&gt;&amp;nbsp;dropdown list&amp;nbsp;and click the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.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/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;button to add it to the&amp;nbsp;&lt;b&gt;Activities&lt;/b&gt;&amp;nbsp;grid.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;You should now have 3 activities in the &lt;b&gt;Activities&lt;/b&gt; grid.&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/AVvXsEjcbF4fSekIyqanPWSerR6qpkE2XPbxK1dy9rbMjz_4TLO0XyfnhZXJ8UZ5u5iFfpqDal85PONR1LtEE_Jr9-2DebXr5N_bYfsi7IeZg8r6c6s80zulstYe69KFl0clT-vOP-Pl/s1600/05-Activity+Grid.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/AVvXsEjcbF4fSekIyqanPWSerR6qpkE2XPbxK1dy9rbMjz_4TLO0XyfnhZXJ8UZ5u5iFfpqDal85PONR1LtEE_Jr9-2DebXr5N_bYfsi7IeZg8r6c6s80zulstYe69KFl0clT-vOP-Pl/s1600/05-Activity+Grid.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to queue the definitions.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By now, you should be familiar with the tool-bar in the &lt;b style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;4. Generate Workflow Activities &lt;/span&gt;&lt;/b&gt;&amp;nbsp;section, so we will skip repeating the explanations.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;b&gt;Generate &lt;/b&gt;group box at the bottom of the section, check on the &lt;b&gt;Workflow xaml &lt;/b&gt;check box to instruct Vector to create a blank xaml file for us. &lt;br /&gt;&lt;br /&gt;Warning! You only need to do this for the first time you are creating the workflow service. If you already have a workflow service xaml with the same name, you will be prompted whether to overwrite it. Take extra caution on this!&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Make sure the &lt;b&gt;Base wrapper activity&lt;/b&gt; check box is checked. This will instruct Vector to create the base class that provides basic functionality to the wrapper activity classes. Your code will fail to compile if you do not check this.&lt;br /&gt;&lt;br /&gt;Warning! You only need to do this once when you create your first workflow activity. You can safely omit this on subsequent workflow activity creation.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check the &lt;b&gt;Service configuration&lt;/b&gt; check box to let Vector register the endpoints in the Host project config file.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;If you have created the &lt;i&gt;WorkflowInstanceStore&lt;/i&gt; database&amp;nbsp;before beginning this guide, you can check the &lt;b&gt;Persistence store&lt;/b&gt; check box and click on the &lt;b&gt;Connect&lt;/b&gt; button to connect to your SQL Server.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;b&gt;Connect...&lt;/b&gt; dialog, Enter the Server name and provide the relevant authentication details to your SQL Server. Click the &lt;b&gt;Connect &lt;/b&gt;button to connect.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Back at the&amp;nbsp;&lt;b style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;4. Generate Workflow Activities&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;section, the &lt;i&gt;WorkflowInstanceStore&lt;/i&gt; database should be available for selection in the dropdown list. Select&amp;nbsp;&lt;i&gt;WorkflowInstanceStore&lt;/i&gt;.&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/AVvXsEhGvy4Ni50VPD5VWvBO5bNmgGK0SLH0_sKnckKl7ApD7xQhf9s_VdKbhgPTrjF4ei0xghfPyKMDGkQoSkGYE2wDlkVh5mEZ56rV_2LA3lDT8bAFwjtCJR0eXDqioM9bnKUYvo1r/s1600/05-Generate+Options.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/AVvXsEhGvy4Ni50VPD5VWvBO5bNmgGK0SLH0_sKnckKl7ApD7xQhf9s_VdKbhgPTrjF4ei0xghfPyKMDGkQoSkGYE2wDlkVh5mEZ56rV_2LA3lDT8bAFwjtCJR0eXDqioM9bnKUYvo1r/s1600/05-Generate+Options.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the&amp;nbsp;&lt;b&gt;Generate&amp;nbsp;&lt;/b&gt;button to generate the workflow service and activity classes.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;b&gt;Code Generation Completed&lt;/b&gt;&amp;nbsp;dialog, click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Vector will generate code to all 3 of the workflow projects - &lt;b&gt;Tutorial.Workflows&lt;/b&gt;, &lt;b&gt;Tutorial.Workflows.Activities&lt;/b&gt; and &lt;b&gt;Tutorial.Workflows.Designers&lt;/b&gt;.&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/AVvXsEiE2x5_ikkxVfxLKPv2ukCK3I5pS7REpf0-Vwilr8gSZIOKodBtsO0wq2UQYHpq85Ye2mmO2_MCRD6wgGfIuhmrmV4w_8shqKBf91x_nD-4S7f21nvYLM_LSssWCYGw1PXmZUQR/s1600/05-Project.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/AVvXsEiE2x5_ikkxVfxLKPv2ukCK3I5pS7REpf0-Vwilr8gSZIOKodBtsO0wq2UQYHpq85Ye2mmO2_MCRD6wgGfIuhmrmV4w_8shqKBf91x_nD-4S7f21nvYLM_LSssWCYGw1PXmZUQR/s1600/05-Project.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;Post Code-Generation Steps&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
After generating the code, you can begin designing the workflow using the Visual Studio workflow designer.&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Open the &lt;i&gt;LeaveWorkflowService.xaml&lt;/i&gt; in Visual Studio and design the workflow accordingly.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Drag a &lt;b&gt;Flowchart &lt;/b&gt;activity from the Visual Studio Toolbox pane into the workflow designer surface.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Drag the &lt;b&gt;ApplyReceiveSend &lt;/b&gt;activity that we just code generated into the flowchart.&lt;br /&gt;&lt;br /&gt;Tip: If you are curious and look at the code of the ApplyReceiveSend activity, you will notice that it is just a design time activity that instructs the designer to wrap a ReceiveActivity and SendReplyActivity around the Apply activity. You can also achieve the same result by dragging the activities manually and hooking them up, but Vector just made it simpler for you.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Connect the &lt;b&gt;Start &lt;/b&gt;to the &lt;b&gt;ApplyReceiveSend &lt;/b&gt;activity.&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/AVvXsEib1-cgDWqT40KQRFGnkL6h2fw2rD1bGKCT_CrCVw3eTz55B-YkS_zAnt7ze78SzcXSFbWL9is6MYRcefu3CyJm9gjTvWk43mHro-_rRQm2nJ2HvoH_GO5LrlGlZkKvq1MyZrlO/s1600/05-WF+Designer.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/AVvXsEib1-cgDWqT40KQRFGnkL6h2fw2rD1bGKCT_CrCVw3eTz55B-YkS_zAnt7ze78SzcXSFbWL9is6MYRcefu3CyJm9gjTvWk43mHro-_rRQm2nJ2HvoH_GO5LrlGlZkKvq1MyZrlO/s1600/05-WF+Designer.png&quot; height=&quot;460&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;One important step that needs to be done with the activities generated by Vector is to set the CorrelationID.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Expand the &lt;b&gt;ApplyReceiveSend &lt;/b&gt;activity by double-clicking on it in the Workflow Designer.&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/AVvXsEizqk1IRmFwBuVwF3gNUyH035tkXgjaU7LRya3p7DB6FESVfZa5184S4fHgXMPFY2P7ntyCxyRWmAxdX4usqieiZXm5NjGeEu499WXn0NV738_A4KNE_O3mrFJUpH_JjBRgFeEg/s1600/05-Apply+Designer.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/AVvXsEizqk1IRmFwBuVwF3gNUyH035tkXgjaU7LRya3p7DB6FESVfZa5184S4fHgXMPFY2P7ntyCxyRWmAxdX4usqieiZXm5NjGeEu499WXn0NV738_A4KNE_O3mrFJUpH_JjBRgFeEg/s1600/05-Apply+Designer.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the &lt;b&gt;Apply Receive&lt;/b&gt; activity.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the properties pane in Visual Studio, locate the &lt;b&gt;CorrelatesOn &lt;/b&gt;property. Click on the ellipses [...] button.&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/AVvXsEgQXbIiTVEnQTYqF5-TJgZnBj57fALPBrAB1tJeQ7YhbR7wdOggyA2RTVJU6qz8G9hFfaWOiw6MYSvOGJZ8suPNh7xSoXesYzT6onLYUfJ-nVtPUx9L461fUA7M4BPu-W3I-9lV/s1600/05-Apply+Properties.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/AVvXsEgQXbIiTVEnQTYqF5-TJgZnBj57fALPBrAB1tJeQ7YhbR7wdOggyA2RTVJU6qz8G9hFfaWOiw6MYSvOGJZ8suPNh7xSoXesYzT6onLYUfJ-nVtPUx9L461fUA7M4BPu-W3I-9lV/s1600/05-Apply+Properties.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;b&gt;CorrelatesOn Definition &lt;/b&gt;dialog, define a key by selecting the &lt;b&gt;CorrelationID &lt;/b&gt;from the Leave entity. The XPath will be automatically created for you. Click &lt;b&gt;OK &lt;/b&gt;and you are done.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&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/AVvXsEhVWmCjPmjOt3-EreJCoTRWNt_osDWQFd3E21ySMXNqO1cbLlOaDm6kS54DhKGU2iiroCV8fiLuDjMPZWwoywYhlDVP9CPP6ywKsfAY-yk_odn71AHsgiPVY2tenOss2WeSVyfD/s1600/05-CorrelationID.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/AVvXsEhVWmCjPmjOt3-EreJCoTRWNt_osDWQFd3E21ySMXNqO1cbLlOaDm6kS54DhKGU2iiroCV8fiLuDjMPZWwoywYhlDVP9CPP6ywKsfAY-yk_odn71AHsgiPVY2tenOss2WeSVyfD/s1600/05-CorrelationID.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
You can continue to complete your workflow following the &lt;b&gt;&lt;a href=&quot;http://layersample.codeplex.com/releases/view/117278&quot;&gt;ASPNET-WCF-DAAB&lt;/a&gt;&lt;/b&gt; sample found in the &lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;. If you do not complete the workflow with the Approve and Cancel activities, you will still be able to proceed with the next tutorial.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In this tutorial, we have gone through how to use the Vector: Workflow Services and Activities Generator to create a workflow service and activities. Vector attempts to make the development workflows faster and easier by providing a means to quickly expose your business methods as activities. You are welcomed to change the generated code but take note that any changes made in your code will not be reflected in the definitions stored in Vector. Therefore, practice caution when you are regenerating code on existing code file.&lt;br /&gt;
&lt;br /&gt;
Coming up next - &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-ui-process-components.html&quot;&gt;How-To: Create User Interface Process Components with Impulse in LASG&lt;/a&gt;.&lt;/div&gt;






&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-l91kMzWgsrI%2FUw2iBut2rsI%2FAAAAAAAAA30%2FyEIMFDC5zxw%2Fs1600%2F01-Right-Button.png&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/5814581243193629807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/5814581243193629807' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/5814581243193629807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/5814581243193629807'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/how-to-create-workflow-services-and.html' title='How-To: Create Workflow Services and Activities with Vector in LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEhFm2ciWSB7sT6gya3fQ00dTD7lwLbJNDt9V2RPyBf0xjfqx4yNA0yjVkbU6vPZnMwZqlnNcIpUG8m0O33Gl3Ggur-P9hlLa7sGRUwgMU6wwct5uqhpdQTLoqDN-eVJsv0oNm88/s72-c/05-Guide.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-7609439064876570534</id><published>2014-03-13T18:03:00.000+08:00</published><updated>2014-03-17T15:55:47.554+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Communication Foundation"/><title type='text'>How-To: Create Service Layer Components with Velocity in LASG</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
This walk-through will get you familiarized with the&lt;b&gt;&amp;nbsp;Velocity: Service Layer Component Generator&lt;/b&gt;&amp;nbsp;that is available in&amp;nbsp;&lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance 2013&lt;/a&gt;&amp;nbsp;to create service layer components. We are now at the fourth step in the LASG Code Generation process where we will be exploring the creation of service layer components.&lt;br /&gt;
&lt;br /&gt;
Before beginning this guide, please make sure that you have completed the previous tutorial on&amp;nbsp;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-business-components.html&quot;&gt;Creating Business Components with Motion in LASG&lt;/a&gt;. Please make sure that your solution is fully compilable without any errors before starting. This walk-through also uses the&amp;nbsp;&lt;b&gt;LeaveSample&amp;nbsp;&lt;/b&gt;database that is part of the&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;but you may use your own database to follow through.&lt;/div&gt;
&lt;div&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/AVvXsEgi-39suZw95JiPKX_1ULr74DwA2xqGjNI9u6uEdyh-d7jY7FO1k-7qdk1k-eD1wUq7PIFhS1qDcOmlNa4NwPeuxqhRsxHB9yS1z60WCFKKjRDgjH9bNZPfeHWKhCFHYTeuBVYo/s1600/04-Guide.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/AVvXsEgi-39suZw95JiPKX_1ULr74DwA2xqGjNI9u6uEdyh-d7jY7FO1k-7qdk1k-eD1wUq7PIFhS1qDcOmlNa4NwPeuxqhRsxHB9yS1z60WCFKKjRDgjH9bNZPfeHWKhCFHYTeuBVYo/s1600/04-Guide.png&quot; height=&quot;363&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, expand the&amp;nbsp;&lt;b&gt;Tutorial&amp;nbsp;&lt;/b&gt;solution, go to the&amp;nbsp;&lt;b&gt;Services&amp;nbsp;&lt;/b&gt;folder.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Right-click on any one of the&amp;nbsp;&lt;b&gt;Tutorial.Services &lt;/b&gt;or &lt;b&gt;Tutorial.Services.Contracts&amp;nbsp;&lt;/b&gt;project and on the context menu, click&amp;nbsp;&lt;b&gt;Add Services and Service Contracts...&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/AVvXsEjvbT-EFO8pPPrNwbcs4ckCQFmu6i_gnsNDC7xGZB6vxjrCuOHXmdjLgZQ7nIQhqgQbb1PeNVnFZlJKuXPLKrz10XTsk9jXSLcSNT81bf1GMgk9FMJvXkck7scTSaeVRdGgPbj8/s1600/04-Launch.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/AVvXsEjvbT-EFO8pPPrNwbcs4ckCQFmu6i_gnsNDC7xGZB6vxjrCuOHXmdjLgZQ7nIQhqgQbb1PeNVnFZlJKuXPLKrz10XTsk9jXSLcSNT81bf1GMgk9FMJvXkck7scTSaeVRdGgPbj8/s1600/04-Launch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;This will launch the &lt;b&gt;Velocity: Service Layer Component Generator&lt;/b&gt; which contains 4 sections. Take note that Velocity is designed to generate &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms731082(v=vs.110).aspx&quot;&gt;Windows Communication Foundation (WCF)&lt;/a&gt; services and therefore, you are encouraged to acquire some knowledge of WCF to understand the terminologies used.&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/AVvXsEj-WtWt9g56pvC3eiGz1IyL3UFcU8rLaifnT5S2lxny7f1PjGXXAbZiBgzItAhVC2zVcXhjyrJ3QyYhL_zsBP__DGdwOzwIP32J21Owwrnx8StmUu7BbGpUjnk-WZ6LtctY81S4/s1600/04-Velocity.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/AVvXsEj-WtWt9g56pvC3eiGz1IyL3UFcU8rLaifnT5S2lxny7f1PjGXXAbZiBgzItAhVC2zVcXhjyrJ3QyYhL_zsBP__DGdwOzwIP32J21Owwrnx8StmUu7BbGpUjnk-WZ6LtctY81S4/s1600/04-Velocity.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By default, Velocity will attempt to load the business project assembly from the centralized&amp;nbsp;&lt;b&gt;bin&lt;/b&gt;&amp;nbsp;folder located under the solution (i.e.&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Tutorial\bin&lt;/span&gt;)&amp;nbsp;and populate the details in&amp;nbsp;the &lt;b&gt;&lt;span style=&quot;background-color: #f6b26b; color: white;&quot;&gt;&amp;nbsp;1. Define Service &lt;/span&gt;&lt;/b&gt;&amp;nbsp;section.&amp;nbsp;In this exercise, the&amp;nbsp;&lt;b&gt;Tutorial.Business.dll&amp;nbsp;&lt;/b&gt;should be automatically loaded.&lt;br /&gt;&lt;br /&gt;Note: If the business project assembly is not loaded, please exit Velocity and return to Visual Studio to make sure that there are business components in the Tutorial.Business project and the solution is compilable without errors. Also please ensure that all dependent assemblies are located in the centralized bin folder. You can also manually load the business project assembly by clicking the&amp;nbsp;&lt;b&gt;Load&lt;/b&gt;&amp;nbsp;button and selecting the .dll file.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;All business components in the assembly will be listed in the &lt;b&gt;Business components&lt;/b&gt; dropdown list. Make sure that &lt;i&gt;LeaveComponent &lt;/i&gt;is selected.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Velocity will attempt to suggest the &lt;b&gt;Service name &lt;/b&gt;for us. By default, it will replace the &lt;i&gt;Component &lt;/i&gt;suffix from the business component with a &lt;i&gt;Service &lt;/i&gt;suffix. Leave the default suggestions and let Velocity create a &lt;i&gt;LeaveService &lt;/i&gt;component for us.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By default, the namespace is left blank but you can enter one of your choice it in the &lt;b&gt;Namespace &lt;/b&gt;text box or click the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-3-jYvpWN6F5NPyyxHpAIRSJ59iEEa0wtqVNtFZClbLKpSJdzX9ZIrbWPRIzHuPUSMuU6u8Y39SLCLZUQnampzMylu6JRQxPbHqa9oReOM7oJJ5vXVgR901L1nVJi4sfioqNl/s1600/04-Callout+Button.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/AVvXsEi-3-jYvpWN6F5NPyyxHpAIRSJ59iEEa0wtqVNtFZClbLKpSJdzX9ZIrbWPRIzHuPUSMuU6u8Y39SLCLZUQnampzMylu6JRQxPbHqa9oReOM7oJJ5vXVgR901L1nVJi4sfioqNl/s1600/04-Callout+Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp; button to get Velocity to suggest one for you. For this exercise, we will leave the namespace as blank.&lt;br /&gt;&lt;br /&gt;Note: WCF will automatically give a service namespace of &lt;i&gt;http://tempuri.org&lt;/i&gt; if the namespace is left blank.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;You can also set the Instance Context Mode and Concurrency Mode of your service. Verify that &lt;b&gt;Instance Context Mode&lt;/b&gt; is &lt;i&gt;PerCall &lt;/i&gt;and &lt;b&gt;Concurrency Mode&lt;/b&gt; is &lt;i&gt;Multiple&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Tip: For more information, read &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms731193(v=vs.110).aspx&quot;&gt;Session, Instancing, and Concurrency&lt;/a&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Velocity allows you to create custom fault contracts which you can extend later, you can check the &lt;b&gt;Generate fault contract&lt;/b&gt; check box and specify the name of the fault contract. All fault contracts will be suffixed with &lt;i&gt;Fault&lt;/i&gt;. For this exercise, we will not create any fault contracts.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Since most of the values have been automatically filled in for us, please ensure that the settings that you have are somewhat like the following:&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/AVvXsEhuY9M7cwsfOzlXp8ytuore79q1sW0F2yoJYU8uAAgRdaM04VxegDq9jimBnYziY_vvpM3b78gBMZERFR9bBmKt9awm4bq5w3WHspQgQBzRoHHRuLa48UroWApMhvquDrFeb0_X/s1600/04-Section1.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/AVvXsEhuY9M7cwsfOzlXp8ytuore79q1sW0F2yoJYU8uAAgRdaM04VxegDq9jimBnYziY_vvpM3b78gBMZERFR9bBmKt9awm4bq5w3WHspQgQBzRoHHRuLa48UroWApMhvquDrFeb0_X/s1600/04-Section1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;b&gt;&lt;span style=&quot;background-color: #f6b26b; color: white;&quot;&gt;&amp;nbsp;2. Select Business Methods &lt;/span&gt;&lt;/b&gt;&amp;nbsp;section,&amp;nbsp;the&amp;nbsp;&lt;b&gt;Business methods&lt;/b&gt;&amp;nbsp;grid lists&amp;nbsp;all the business methods that are available in the&amp;nbsp;business component.&amp;nbsp;Select the &lt;b&gt;ListLeaves &lt;/b&gt;and &lt;b&gt;GetLeave &lt;/b&gt;methods by checking on the their check boxes in the first column.&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/AVvXsEhQSBVHMoNZwycfl3HjzAW3xe4JzkgodKsJH-iCurH_EnH9nmEw2i-r08aQGVynJKn2q92gRHhOLKOLz0JgQTh78Sg3jntreNSTGUSuXxO3H9E1GR5n_xI5JLlwhdsk1T6Goive/s1600/04-Section2.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/AVvXsEhQSBVHMoNZwycfl3HjzAW3xe4JzkgodKsJH-iCurH_EnH9nmEw2i-r08aQGVynJKn2q92gRHhOLKOLz0JgQTh78Sg3jntreNSTGUSuXxO3H9E1GR5n_xI5JLlwhdsk1T6Goive/s1600/04-Section2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: Velocity exposes business methods as service methods in a one-to-one mapping.&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Define an endpoint for the new service. This only needs to be done once when we first create a service. At the &lt;b style=&quot;background-color: #f6b26b;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;3. Define Endpoint Configurations &lt;/span&gt;&lt;/b&gt;&amp;nbsp;section, make sure &lt;i&gt;basicHttpBinding &lt;/i&gt;is selected in the &lt;b&gt;Binding &lt;/b&gt;dropdown list. Leave the suggested &lt;b&gt;Endpoint&lt;/b&gt; name and &lt;b&gt;Address&lt;/b&gt;. Click the 
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhumoUMLjIAI00jWlISb2YYrWPWtGh45g3PiVMxSvawHemECUjp-3SElMP95uygRK5geqbsTQm6eSKMl2XqzUPRRk4NKeur69sQigFV8-rU_mJZgrw2Cin_Ic9A5GXKyOjptk08/s1600/04-Add+button.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/AVvXsEhumoUMLjIAI00jWlISb2YYrWPWtGh45g3PiVMxSvawHemECUjp-3SElMP95uygRK5geqbsTQm6eSKMl2XqzUPRRk4NKeur69sQigFV8-rU_mJZgrw2Cin_Ic9A5GXKyOjptk08/s1600/04-Add+button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;
&amp;nbsp; button to add it to the&amp;nbsp;&lt;b&gt;Service endpoints&lt;/b&gt; grid.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&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/AVvXsEhpiszLp5s13W_uuhVCDGY85GYx0vZsKKAPV9f_K0MaMAqjjxZWhVPBUgKt_WjLY7IvLKlkLQLSiDdON0fog0prSU14_3nFAL71l_ue5DXhh7TS3WY0nrkSagatH5MwFxsZZRDO/s1600/04-Section3.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/AVvXsEhpiszLp5s13W_uuhVCDGY85GYx0vZsKKAPV9f_K0MaMAqjjxZWhVPBUgKt_WjLY7IvLKlkLQLSiDdON0fog0prSU14_3nFAL71l_ue5DXhh7TS3WY0nrkSagatH5MwFxsZZRDO/s1600/04-Section3.png&quot; height=&quot;174&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Tip: You can create multiple endpoints for your services based on WCF&#39;s guidelines. If you are using a HTTP based binding and want to use SSL, you can also check the &lt;b&gt;SSL/HTTPS enabled&lt;/b&gt; check box to allow Velocity to generate the basic configuration settings for you. For this exercise, we will not create any extra endpoints or use SSL.&lt;br /&gt;&lt;br /&gt;Note: The Address is only used in non-IIS/WAS hosts i.e. your own Console host. Since most enterprise WCF services are usually (and recommended to be) hosted on IIS/WAS, this setting is seldom used and is just retained for backward LASG compatibility.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the &lt;b&gt;Add to Code Generation&lt;/b&gt; button to queue the definition.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Like the other code generators, you can perform various action from the tool-bar at the&amp;nbsp;&lt;span style=&quot;color: white;&quot;&gt;&lt;b style=&quot;background-color: #f6b26b;&quot;&gt;&amp;nbsp;4. Generate Service Components&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&amp;nbsp;section. You can&amp;nbsp;&lt;b&gt;Preview&amp;nbsp;&lt;/b&gt;the code that will be generated, set&amp;nbsp;&lt;b&gt;Options&lt;/b&gt;, reposition the methods,&amp;nbsp;&lt;b&gt;Reset&lt;/b&gt;&amp;nbsp;the definitions so that they will be code-generated again or&amp;nbsp;&lt;b&gt;Delete&amp;nbsp;&lt;/b&gt;the definitions.&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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.png&quot; height=&quot;120&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: red;&quot;&gt;Warning! Deleted definitions will not be recoverable.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;If you &lt;b&gt;Preview &lt;/b&gt;the code, you will noticed that the preview window now opens up in split view to show you the code of the service interface and the service implementation classes.&lt;br /&gt;&lt;br /&gt;
Note: All definitions will be marked as code generated (indicated by the&amp;nbsp;&lt;b&gt;IsUpdated&lt;/b&gt;&amp;nbsp;property) after code generation. They will continue to appear in the list but will not be code generated the next time. Clicking&amp;nbsp;&lt;b&gt;Reset&lt;/b&gt;&amp;nbsp;will change one or more definitions&#39;&amp;nbsp;&lt;b&gt;IsUpdated&lt;/b&gt;&amp;nbsp;value to&amp;nbsp;&lt;i&gt;true&lt;/i&gt;&amp;nbsp;and mark them for code generation again.&lt;br /&gt;
&lt;br /&gt;
You can also&amp;nbsp;&lt;b&gt;Delete&lt;/b&gt;&amp;nbsp;a method, a service component definition or all service component definitions from the tool-bar. Clicking on the&amp;nbsp;&lt;b&gt;Options&lt;/b&gt;&amp;nbsp;icon will open the&amp;nbsp;&lt;b&gt;Code Generation Options&lt;/b&gt;&amp;nbsp;dialog that will allow you to set a few standard options. Leave the settings alone and click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Make sure the &lt;b&gt;Generate service configuration&lt;/b&gt; check box is checked.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the &lt;b&gt;Generate &lt;/b&gt;button to generate the service layer component classes.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;b&gt;Code Generation Completed&lt;/b&gt;&amp;nbsp;dialog, click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The&amp;nbsp;&lt;b&gt;Tutorial.Services&lt;/b&gt; project should contain a generated &lt;b&gt;&lt;i&gt;LeaveService &lt;/i&gt;&lt;/b&gt;code file&amp;nbsp;and the&lt;b&gt;&amp;nbsp;Tutorial.Services.Contracts&amp;nbsp;&lt;/b&gt;projects should contain a generated &lt;b&gt;&lt;i&gt;ILeaveService&lt;/i&gt; &lt;/b&gt;code file. Take note that this is WCF&#39;s requirement that all services must be accommodated by a service contract (or interface).&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/AVvXsEiIw9o-n6DB8YSIRc4vdymoI4Ime3WfbFgunGlQurOFX5VtHs0zD9_PK38xbaIxIHYb86pEUUeDxZI7S6PSgYXtY1kODDupoksYqV1d2N54le_YIkze4iDHMrkN5DcVMkDfElai/s1600/04-Project.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/AVvXsEiIw9o-n6DB8YSIRc4vdymoI4Ime3WfbFgunGlQurOFX5VtHs0zD9_PK38xbaIxIHYb86pEUUeDxZI7S6PSgYXtY1kODDupoksYqV1d2N54le_YIkze4iDHMrkN5DcVMkDfElai/s1600/04-Project.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We have basically gone through how to use the Velocity: Service Layer Component Generator to create service layer components for our layered application. As you can see, Velocity is very easy to use as it provides most of the default values that are needed for code generation. Since Velocity generates WCF service components, it is recommended that you do some read-up on &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms731082(v=vs.110).aspx&quot;&gt;WCF&lt;/a&gt; to fully understand what is going. You can still change the generated code but take note that any changes made in your code will not be reflected in the definitions stored in Velocity. Therefore, practice caution when you are regenerating code on existing code file.&lt;br /&gt;
&lt;br /&gt;
Coming up next - &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-workflow-services-and.html&quot;&gt;How-To: Create Workflow Services and Activities with Vector in LASG&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/7609439064876570534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/7609439064876570534' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7609439064876570534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7609439064876570534'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/how-to-create-service-layer-components.html' title='How-To: Create Service Layer Components with Velocity in LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEgi-39suZw95JiPKX_1ULr74DwA2xqGjNI9u6uEdyh-d7jY7FO1k-7qdk1k-eD1wUq7PIFhS1qDcOmlNa4NwPeuxqhRsxHB9yS1z60WCFKKjRDgjH9bNZPfeHWKhCFHYTeuBVYo/s72-c/04-Guide.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-483982311469035986</id><published>2014-03-12T13:21:00.002+08:00</published><updated>2014-03-18T12:01:13.407+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>How-To: Create Business Components with Motion in LASG</title><content type='html'>&lt;div style=&quot;orphans: auto; text-align: left; text-indent: 0px; widows: auto;&quot;&gt;
With the Entities and Data Access Component classes generated, it is now the time to look at the&lt;b&gt;&amp;nbsp;Motion: Business Component Template Generator&lt;/b&gt;&amp;nbsp;that is available in &lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance 2013&lt;/a&gt;&amp;nbsp;to create business components. Creating business components is the third step in the LASG Code Generation process.&amp;nbsp;Before beginning this guide, please make sure that you have completed the previous tutorial on&amp;nbsp;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-data-access-components.html&quot;&gt;Creating Data Access Components with Momentum in LASG&lt;/a&gt;. Please make sure that your solution is fully compilable without any errors before starting.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
This walk-through also uses the&amp;nbsp;&lt;b&gt;LeaveSample&amp;nbsp;&lt;/b&gt;database that is part of the&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;but you may use your own database to follow through.
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVZa6JWRJiUaoMCnGGNu9anEjn6XV6B0JiNjaMgB0IPyRe8nhgES206xH-0mlQYk1J8tf0IZXf6G8FGbfkXT4RlghLKdGlJjKy7hcklj5r6hsn3e9_bLbRfcbdqVBHWpL5z3Lx/s1600/03-Guide.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/AVvXsEgVZa6JWRJiUaoMCnGGNu9anEjn6XV6B0JiNjaMgB0IPyRe8nhgES206xH-0mlQYk1J8tf0IZXf6G8FGbfkXT4RlghLKdGlJjKy7hcklj5r6hsn3e9_bLbRfcbdqVBHWpL5z3Lx/s1600/03-Guide.png&quot; height=&quot;363&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, expand the&amp;nbsp;&lt;b&gt;Tutorial&amp;nbsp;&lt;/b&gt;solution, go to the&amp;nbsp;&lt;b&gt;Business&amp;nbsp;&lt;/b&gt;folder, right-click on the&amp;nbsp;&lt;b&gt;Tutorial.Business&amp;nbsp;&lt;/b&gt;project and click&amp;nbsp;&lt;b&gt;Add Business Components...&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxeGqNIB0X20TcFHBpSFNZKmmQ52xwZ9_xVGZ4a5J4revK4osPd5ryU_BqBViUHfM74Y3CGB1Re-Qt2Vl2Ot6fJVqsp_ZhjGyltD7dKGAA4kAOHvizTtSrFJajkL8_wAknhh_t/s1600/03-Launch.png&quot; imageanchor=&quot;1&quot; style=&quot;font-weight: normal; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxeGqNIB0X20TcFHBpSFNZKmmQ52xwZ9_xVGZ4a5J4revK4osPd5ryU_BqBViUHfM74Y3CGB1Re-Qt2Vl2Ot6fJVqsp_ZhjGyltD7dKGAA4kAOHvizTtSrFJajkL8_wAknhh_t/s1600/03-Launch.png&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;This launches the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Motion: Business Component Template Generator &lt;span style=&quot;font-weight: normal;&quot;&gt;that comprises of&lt;/span&gt;&lt;/span&gt;&amp;nbsp;3 &lt;span style=&quot;font-weight: normal;&quot;&gt;sections.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2C_VG7vpnKS820VhMEEmcZBU_6XkNbv6QwpAIyXATQyiaISiHUAtex4fBo7v0OsWVA0w7RpXESZ6MVF_x7FdH0Fry8_hwh7sm8mDmsQ2IMwHY0VguPmWcqjWwf0Q_hPz_yiwJ/s1600/03-Motion.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/AVvXsEi2C_VG7vpnKS820VhMEEmcZBU_6XkNbv6QwpAIyXATQyiaISiHUAtex4fBo7v0OsWVA0w7RpXESZ6MVF_x7FdH0Fry8_hwh7sm8mDmsQ2IMwHY0VguPmWcqjWwf0Q_hPz_yiwJ/s1600/03-Motion.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;span style=&quot;color: white;&quot;&gt;&lt;b style=&quot;background-color: #6fa8dc;&quot;&gt;&amp;nbsp;1. Define Business Component &lt;/b&gt;&lt;/span&gt;&amp;nbsp;section, enter&amp;nbsp;&lt;i&gt;Leave &lt;/i&gt;in the &lt;span style=&quot;font-weight: bold;&quot;&gt;Create new component&lt;/span&gt; text box and leave the default &lt;b&gt;Suffix &lt;/b&gt;as &lt;i&gt;Component&lt;/i&gt;. Motion will create the class with the name&amp;nbsp;&lt;i&gt;LeaveComponent&lt;/i&gt;&amp;nbsp;for us.&lt;br /&gt;&lt;br /&gt;Tip: After you have defined business components and successfully compile them in the project, they will appear in the &lt;b&gt;Use existing component&lt;/b&gt; dropdown list the next time you launch Motion.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By default, Motion will attempt to load the data project assembly from the centralized&amp;nbsp;&lt;b&gt;bin&lt;/b&gt;&amp;nbsp;folder located under the solution (i.e.&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Tutorial\bin&lt;/span&gt;). All projects unfolded by LASG (except the Host and Web projects) will target this folder. In this exercise, the&amp;nbsp;&lt;b&gt;Tutorial.Data.dll &lt;/b&gt;should be automatically loaded.&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/AVvXsEgRwA5LVgVx3lrzvXRviLHt1qHTcWLVBK2fHx2VJ2uBFvyPiS6obSztLLsZsA5TF-1XY93VLzTFQJElUqwLKkUv284dLbQt4X3tXrS9eFLqu5HOTSIUDtRpk6C5jRpt-7ttfHb1/s1600/03-Section1.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/AVvXsEgRwA5LVgVx3lrzvXRviLHt1qHTcWLVBK2fHx2VJ2uBFvyPiS6obSztLLsZsA5TF-1XY93VLzTFQJElUqwLKkUv284dLbQt4X3tXrS9eFLqu5HOTSIUDtRpk6C5jRpt-7ttfHb1/s1600/03-Section1.png&quot; height=&quot;120&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Tip: All the data access components and their methods will be listed in the&lt;b&gt;&amp;nbsp;Data access component methods&lt;/b&gt;&amp;nbsp;tree-view in the&amp;nbsp;&lt;span style=&quot;background-color: #6fa8dc; color: white;&quot;&gt;&lt;b&gt;&amp;nbsp;2. Select Data Methods to Call in Business Method&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&amp;nbsp;section if the data assembly is loaded correctly. Take note that it is normal for the tree-view to be disabled.&lt;br /&gt;&lt;br /&gt;Note: If the data project assembly is not loaded, please exit Motion and return to Visual Studio to make sure that there are data access components in the Tutorial.Data project and the solution is compilable without errors. Also please ensure that all dependent assemblies are located in the centralized bin folder. You can also manually load the data project assembly by clicking the &lt;b&gt;Load&lt;/b&gt; button and selecting the .dll file.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create the Apply business method. Enter &lt;i&gt;Apply&lt;/i&gt; in the &lt;b&gt;Business method name&lt;/b&gt; text box. The&amp;nbsp;&lt;b&gt;Data access component methods&lt;/b&gt;&amp;nbsp;tree-view should be enabled now.&lt;br /&gt;&lt;br /&gt;Tip: It is recommended that you use business-like terms&amp;nbsp;(i.e. Apply, Submit, Cancel, Approve, List etc.)&amp;nbsp;to name your business methods instead of technical terms such as Insert, Update, Delete and Select. For example, it makes more sense to name your business method as &lt;i&gt;Register &lt;/i&gt;for adding a user instead of calling it &lt;i&gt;InsertUser&lt;/i&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Expand the LeaveDAC and LeaveStatusLogDAC nodes in the tree-view. If you remembered, these are the two DACs which you have created in the &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-data-access-components.html&quot;&gt;previous tutorial&lt;/a&gt;. Check on the check boxes beside the&amp;nbsp;&lt;b&gt;Create &lt;/b&gt;method of the &lt;b&gt;LeaveDAC &lt;/b&gt;and the &lt;b&gt;Create &lt;/b&gt;method of the &lt;b&gt;LeaveStatusLogDAC&lt;/b&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the &amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;button to add them to the &lt;b&gt;Called methods&lt;/b&gt; grid.&lt;br /&gt;&lt;br /&gt;Tip: You can also drag-and-drop methods from the &lt;b&gt;Data access component methods&lt;/b&gt; tree-view to the &lt;b&gt;Called methods&lt;/b&gt; grid. You can&#39;t select or check a DAC. If you have made any mistakes and want to start over, click on the &lt;b&gt;Reset&lt;/b&gt; button.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check on the check box in the &lt;b&gt;Return &lt;/b&gt;grid column for the &lt;b&gt;Create &lt;/b&gt;method of the &lt;b&gt;LeaveDAC &lt;/b&gt;component. This will return the updated entity after insertion.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEie_BJCzPyI-JYB9zijFMBR_UgxU3iIBRVOSZoSerHBt6fjZsKFrfRXoK-yp-SlbgzDcD2DlhHvSaz2GyHZ-F49otVSFLyn3sH6s-os2oIau7YcjbosCLLCwRWD5anfsGCevcoV/s1600/03-Create+Apply.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEie_BJCzPyI-JYB9zijFMBR_UgxU3iIBRVOSZoSerHBt6fjZsKFrfRXoK-yp-SlbgzDcD2DlhHvSaz2GyHZ-F49otVSFLyn3sH6s-os2oIau7YcjbosCLLCwRWD5anfsGCevcoV/s1600/03-Create+Apply.png&quot; height=&quot;496&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Tip: You can use the Top and Bottom arrow buttons to re-arrange your called methods.&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to queue the definition.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create the Approve business method. Enter &lt;i&gt;Approve &lt;/i&gt;in the &lt;b&gt;Business method name&lt;/b&gt; text box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check on the &lt;b&gt;UpdateById &lt;/b&gt;method of the &lt;b&gt;LeaveDAC &lt;/b&gt;and the &lt;b&gt;Create &lt;/b&gt;method of the &lt;b&gt;LeaveStatusLogDAC&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the &amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;button to add them to the&amp;nbsp;&lt;b&gt;Called methods&lt;/b&gt;&amp;nbsp;grid.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Uncheck any check boxes in the &lt;b&gt;Return &lt;/b&gt;grid column.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to add the definition to the code generation queue.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNd9PgRWsC0IqoH7b1hLdMoIO2aL6LtZfRxpLJIZm-AaPovswjlnx4LFjUcmSAXJv-wTcSAqELnjTHfB_CNM6hQd6Mk1A_61r9fbg7lV4Vt4VFb_N-Hp_CO-QyHYrNhYOTCWXd/s1600/03-Create+Approve.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNd9PgRWsC0IqoH7b1hLdMoIO2aL6LtZfRxpLJIZm-AaPovswjlnx4LFjUcmSAXJv-wTcSAqELnjTHfB_CNM6hQd6Mk1A_61r9fbg7lV4Vt4VFb_N-Hp_CO-QyHYrNhYOTCWXd/s1600/03-Create+Approve.png&quot; height=&quot;494&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create the Cancel business method. Enter &lt;i&gt;Cancel &lt;/i&gt;in the&amp;nbsp;&lt;b&gt;Business method name&lt;/b&gt;&amp;nbsp;text box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Repeat the same steps from step 11 to 14 for the Cancel method.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create the business method to list leaves. Enter &lt;i&gt;ListLeaves&lt;/i&gt; in the&amp;nbsp;&lt;b&gt;Business method name&lt;/b&gt;&amp;nbsp;text box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Drag the &lt;b&gt;SelectPage &lt;/b&gt;method under the &lt;b&gt;LeaveDAC &lt;/b&gt;node to the &lt;b&gt;Called methods &lt;/b&gt;grid. Verify that the check box at the &lt;b&gt;Return &lt;/b&gt;grid column is checked.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to add the definition to the code generation queue.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create the business method to retrieve a Leave. Enter &lt;i&gt;GetLeave&amp;nbsp;&lt;/i&gt;in the&amp;nbsp;&lt;b&gt;Business method name&lt;/b&gt;&amp;nbsp;text box.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Drag the &lt;b&gt;SelectById&amp;nbsp;&lt;/b&gt;method under the&amp;nbsp;&lt;b&gt;LeaveDAC&amp;nbsp;&lt;/b&gt;node to the&amp;nbsp;&lt;b&gt;Called methods&amp;nbsp;&lt;/b&gt;grid. Verify that the check box at the&amp;nbsp;&lt;b&gt;Return&amp;nbsp;&lt;/b&gt;grid column is checked.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to add the definition to the code generation queue.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;By now you should have 5 business methods in your LeaveComponent queue - &lt;i&gt;Apply&lt;/i&gt;, &lt;i&gt;Approve&lt;/i&gt;, &lt;i&gt;Cancel&lt;/i&gt;, &lt;i&gt;ListLeaves &lt;/i&gt;and &lt;i&gt;GetLeave&lt;/i&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Next, we will make some modifications to the methods. At the&amp;nbsp;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;b&gt;&amp;nbsp;3. Generate Business Components&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;section, select the&amp;nbsp;&lt;b&gt;Apply&amp;nbsp;&lt;/b&gt;method in the list below the&amp;nbsp;&lt;b&gt;LeaveComponent&lt;/b&gt;&amp;nbsp;and locate the&amp;nbsp;&lt;b&gt;CallMethods&lt;/b&gt;&amp;nbsp;property in the property grid. Click on the ellipses&amp;nbsp;&lt;b&gt;[...]&lt;/b&gt;&amp;nbsp;button to invoke the&amp;nbsp;&lt;b&gt;MethodModel Collection Editor&lt;/b&gt;&amp;nbsp;dialog.&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/AVvXsEhTveQoR826l2PZ0SjVnh-e4NKx6Bkd6FFkBV9NXVnphif9sLCmxfdhNRey-iawSW8ZBr48wXmL5vKccrtPoKblEtrWk1VSh4BD3qE5q-FOLghs8WZuVIbZhn7jajLq0b859oVu/s1600/03-Apply+PG.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/AVvXsEhTveQoR826l2PZ0SjVnh-e4NKx6Bkd6FFkBV9NXVnphif9sLCmxfdhNRey-iawSW8ZBr48wXmL5vKccrtPoKblEtrWk1VSh4BD3qE5q-FOLghs8WZuVIbZhn7jajLq0b859oVu/s1600/03-Apply+PG.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;b&gt;MethodModel Collection Editor&lt;/b&gt;&amp;nbsp;dialog, select the&amp;nbsp;&lt;b&gt;Create&amp;nbsp;&lt;/b&gt;method that belongs to the&amp;nbsp;&lt;b&gt;LeaveStatusLogDAC&lt;/b&gt;. Locate the&amp;nbsp;&lt;b&gt;Parameters&amp;nbsp;&lt;/b&gt;property in the property grid on the right and click on the ellipses&lt;b&gt;&amp;nbsp;[...]&lt;/b&gt;&amp;nbsp;button to invoke the&amp;nbsp;&lt;b&gt;ParameterModel Collection Editor&lt;/b&gt;&amp;nbsp;dialog.&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/AVvXsEjypbkxaQljkQAB9614h2EJ20TjJGb0vxdl2kU__U_1iOaDw8R-PmvLirf83RYdL0M-QZ7VtN-EKsIkGOZkJJ4XkEzWZXMtawq86CVcGLTxMYyx8UashrIgX-XbTFbVs-lpfckt/s1600/03-Apply-Methods.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/AVvXsEjypbkxaQljkQAB9614h2EJ20TjJGb0vxdl2kU__U_1iOaDw8R-PmvLirf83RYdL0M-QZ7VtN-EKsIkGOZkJJ4XkEzWZXMtawq86CVcGLTxMYyx8UashrIgX-XbTFbVs-lpfckt/s1600/03-Apply-Methods.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Tip: If you want to wrap your methods in a TransactionScope, you can set the&amp;nbsp;&lt;b&gt;TransactionBegin&amp;nbsp;&lt;/b&gt;property to&amp;nbsp;&lt;b&gt;true&amp;nbsp;&lt;/b&gt;for the&amp;nbsp;&lt;b&gt;first&amp;nbsp;&lt;/b&gt;method in the scope and set the&amp;nbsp;&lt;b&gt;TransactionEnd&amp;nbsp;&lt;/b&gt;property to&amp;nbsp;&lt;b&gt;true&amp;nbsp;&lt;/b&gt;for the&amp;nbsp;&lt;b&gt;last&amp;nbsp;&lt;/b&gt;method in the scope. Please take note that it is your responsibility to arrange the sequence of the method calls correctly. For this exercise, we will not define any transaction scope.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;b&gt;ParameterModel Collection Editor&lt;/b&gt;&amp;nbsp;dialog, select the&amp;nbsp;&lt;b&gt;leaveStatusLog&amp;nbsp;&lt;/b&gt;parameter and set its&amp;nbsp;&lt;b&gt;IsInternallyDeclared&amp;nbsp;&lt;/b&gt;property to&amp;nbsp;&lt;i&gt;true&lt;/i&gt;. This will indicate that this parameter will be declared in code and not at the method signature.&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/AVvXsEjS_ytUW9Fix8E1weNSCs0UejOCzKwBonQDms_l68B_vAQsCoryvIbHANtgSDivK4lz6CN5Y0CTLqpkxUJL0NTlhTg8Nyyw31JiAbUoH7GITRxmL0cPIeuOY8fqW8n24DX_lpa5/s1600/03-Apply+Params.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/AVvXsEjS_ytUW9Fix8E1weNSCs0UejOCzKwBonQDms_l68B_vAQsCoryvIbHANtgSDivK4lz6CN5Y0CTLqpkxUJL0NTlhTg8Nyyw31JiAbUoH7GITRxmL0cPIeuOY8fqW8n24DX_lpa5/s1600/03-Apply+Params.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Click OK to close the &lt;b&gt;ParameterModel Collection Editor&lt;/b&gt;&amp;nbsp;dialog.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Click OK to close the&amp;nbsp;&lt;b&gt;MethodModel Collection Editor&lt;/b&gt;&amp;nbsp;dialog.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div&gt;
Repeat these steps (24 to 28) for the &lt;b&gt;Approve &lt;/b&gt;and &lt;b&gt;Cancel &lt;/b&gt;methods.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div&gt;
Like the other code generators, you can perform various action from the tool-bar at the &lt;span style=&quot;background-color: #6fa8dc; color: white;&quot;&gt;&lt;b&gt;&amp;nbsp;3. Generate Business Components &lt;/b&gt;&lt;/span&gt;&amp;nbsp;section. You can&amp;nbsp;&lt;b&gt;Preview&amp;nbsp;&lt;/b&gt;the code that will be generated, set&amp;nbsp;&lt;b&gt;Options&lt;/b&gt;, reposition the methods,&amp;nbsp;&lt;b&gt;Reset&lt;/b&gt;&amp;nbsp;the definitions so that they will be code-generated again or&amp;nbsp;&lt;b&gt;Delete&amp;nbsp;&lt;/b&gt;the definitions.&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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.png&quot; height=&quot;120&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: red;&quot;&gt;Warning! Deleted definitions will not be recoverable.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Note: All definitions will be marked as code generated (indicated by the&amp;nbsp;&lt;b&gt;IsUpdated&lt;/b&gt;&amp;nbsp;property) after code generation. They will continue to appear in the list but will not be code generated the next time. Clicking&amp;nbsp;&lt;b&gt;Reset&lt;/b&gt;&amp;nbsp;will change one or more definitions&#39;&amp;nbsp;&lt;b&gt;IsUpdated&lt;/b&gt;&amp;nbsp;value to&amp;nbsp;&lt;i&gt;true&lt;/i&gt;&amp;nbsp;and mark them for code generation again.&lt;br /&gt;
&lt;br /&gt;
You can also&amp;nbsp;&lt;b&gt;Delete&lt;/b&gt;&amp;nbsp;a method, a BC definition or all BC definitions from the tool-bar. Clicking on the&amp;nbsp;&lt;b&gt;Options&lt;/b&gt;&amp;nbsp;icon will open the&amp;nbsp;&lt;b&gt;Code Generation Options&lt;/b&gt;&amp;nbsp;dialog that will allow you to set a few standard options. Leave the settings alone and click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div&gt;
Finally, click the&amp;nbsp;&lt;b&gt;Generate&lt;/b&gt;&amp;nbsp;button to generate the business component classes.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;b&gt;Code Generation Completed&lt;/b&gt;&amp;nbsp;dialog, click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The&amp;nbsp;&lt;b&gt;Tutorial.Business&amp;nbsp;&lt;/b&gt;project should contain the generated &lt;b&gt;LeaveComponent&lt;/b&gt; code file.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirqSCbXtydFJDFF7RLKHxu0Qc5Wc-co18cHGHlv2ahfzS9LuBc5gDf6h68ng8c8jzW8Quo6iteWqVS7gpwRgkzoGkau0_Xpe3SIKVAPgVjV7XvQaPhaSWfrd4_lsrTCDiTIU3Y/s1600/03-Project.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/AVvXsEirqSCbXtydFJDFF7RLKHxu0Qc5Wc-co18cHGHlv2ahfzS9LuBc5gDf6h68ng8c8jzW8Quo6iteWqVS7gpwRgkzoGkau0_Xpe3SIKVAPgVjV7XvQaPhaSWfrd4_lsrTCDiTIU3Y/s1600/03-Project.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div&gt;
Extra Tip: If you are regenerating code and the code file already exist in the project, you will be prompted to either Append, Backup, Overwrite or Cancel the process.&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/AVvXsEgWBs-UhY06SFCSOMfYDcSCRtEF34btDk1Jv6PLgVVYzRh1Ufe1uSg822so-VYidzhctAlfiuA3VNJyQjLjuj4Vi4XQQYMtnq31uhwG2uQwzyAmz_UbTkX8pLAJ8ZgE9kUpfhKq/s1600/03-Exist+Warning.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/AVvXsEgWBs-UhY06SFCSOMfYDcSCRtEF34btDk1Jv6PLgVVYzRh1Ufe1uSg822so-VYidzhctAlfiuA3VNJyQjLjuj4Vi4XQQYMtnq31uhwG2uQwzyAmz_UbTkX8pLAJ8ZgE9kUpfhKq/s1600/03-Exist+Warning.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Append&amp;nbsp;&lt;/b&gt;will append whatever new methods to the bottom of the class. Take note it is not an intelligent append and duplicate methods may be appended to your class. You also need to make sure that you do not have any comments or commented code at the end of your class files.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Backup&amp;nbsp;&lt;/b&gt;creates a copy of your code file with a .bak extension and requires you to manually include its contents into your project.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Overwrite&amp;nbsp;&lt;/b&gt;will replace your existing code with the newly generated one. Any previously defined methods that were not included in the latest code generation will be lost.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Cancel&amp;nbsp;&lt;/b&gt;will discard the generated code from memory and preserves the existing code file.&lt;br /&gt;
&lt;br /&gt;
You can choose to apply the same option for all the files by checking the&lt;b&gt;&amp;nbsp;Do the same for all occurrence&lt;/b&gt;&amp;nbsp;check box.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Adding Business Logic&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
By now the template of your business component should have been generated and you can proceed to implement your own business logic.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As an example, we can modify the Apply method to contain some logic:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;Apply(&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;leave)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;result =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;leave.DateSubmitted =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;DateTime&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;.Now;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;leave.Status = 0;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 12pt;&quot;&gt;// Pending&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas; font-size: 12pt;&quot;&gt;// Data access component declarations.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;LeaveDAC&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;leaveDAC =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;LeaveDAC&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;LeaveStatusLogDAC&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;leaveStatusLogDAC =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;LeaveStatusLogDAC&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas; font-size: 12pt;&quot;&gt;// Step 1 - Calling Create on LeaveDAC.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result = leaveDAC.Create(leave);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;leaveStatusLog =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;LeaveStatusLog&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LeaveID = result.LeaveID,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Status = result.Status,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Date =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 12pt;&quot;&gt;DateTime&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;.Now&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas; font-size: 12pt;&quot;&gt;// Step 2 - Calling Create on LeaveStatusLogDAC.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;leaveStatusLogDAC.Create(leaveStatusLog);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas; font-size: 12pt;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;result;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 12pt; line-height: 17.1200008392334px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For a more complete implementation of the business logic, you can refer to the &lt;a href=&quot;http://layersample.codeplex.com/releases&quot;&gt;ASPNET-WCF-DAAB&lt;/a&gt; sample from&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We have basically gone through how to use the Motion: Business Component Template Generator to create business components for our layered application. Take note that the methods generated only contain the basic structure without any logic. You will still need to add-in your own business processing logic to them but take note that any changes made in your code will not be reflected in the definitions stored in Motion. Therefore, practice caution when you are regenerating code on existing code file.&lt;br /&gt;
&lt;br /&gt;
Coming up next - &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/how-to-create-service-layer-components.html&quot;&gt;How-To: Create Service Layer Components with Velocity in LASG&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/483982311469035986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/483982311469035986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/483982311469035986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/483982311469035986'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/lasg-creating-business-components.html' title='How-To: Create Business Components with Motion in LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEgVZa6JWRJiUaoMCnGGNu9anEjn6XV6B0JiNjaMgB0IPyRe8nhgES206xH-0mlQYk1J8tf0IZXf6G8FGbfkXT4RlghLKdGlJjKy7hcklj5r6hsn3e9_bLbRfcbdqVBHWpL5z3Lx/s72-c/03-Guide.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-3445496177306268068</id><published>2014-03-10T15:52:00.002+08:00</published><updated>2014-03-18T11:58:50.671+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>How-To: Create Data Access Components with Momentum in LASG</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
This is the third in the series where we will get you started with the&lt;b&gt; Momentum: Data Access Component Generator&lt;/b&gt; that is available in &lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance 2013&lt;/a&gt; to create data access components. Creating data access components is the second step in the LASG Code Generation process.&amp;nbsp;Before beginning this guide, please make sure that you have completed the previous tutorial on &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-entities.html&quot;&gt;Creating Entities with Inertia in LASG&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This walk-through also uses the&amp;nbsp;&lt;b&gt;LeaveSample&amp;nbsp;&lt;/b&gt;database that is part of the&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;but you may use your own database to follow through.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&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/AVvXsEj0fYXEtAxPzmTKVqZNhdK24OyZVwMPMi-vfHibIkqHzhxsjc-7sF7_Cet-49zRuz7r2TzUtLcRj6yiW69Tbd_rn9goseAvRHjn8Kbj0_AjLRZ4pqgVmW49e2UNQoKxgZiX4gn3/s1600/02-Guide.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/AVvXsEj0fYXEtAxPzmTKVqZNhdK24OyZVwMPMi-vfHibIkqHzhxsjc-7sF7_Cet-49zRuz7r2TzUtLcRj6yiW69Tbd_rn9goseAvRHjn8Kbj0_AjLRZ4pqgVmW49e2UNQoKxgZiX4gn3/s1600/02-Guide.png&quot; height=&quot;367&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In&amp;nbsp;&lt;b&gt;Solution Explorer&lt;/b&gt;, expand the&amp;nbsp;&lt;b&gt;Tutorial&amp;nbsp;&lt;/b&gt;solution, go to the&amp;nbsp;&lt;b&gt;Data&amp;nbsp;&lt;/b&gt;folder, right-click on the&amp;nbsp;&lt;b&gt;Tutorial.Data&amp;nbsp;&lt;/b&gt;project and click&amp;nbsp;&lt;b&gt;Add Data Access Components...&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/AVvXsEic_7MX7ZPheYWnzosRmblibYXB-F8xdKs08VtR4Aqr0EAhY_D6roOT2yXev0PdbGdCTq_uTf0YaB8a4pCtXOyNS_wQIp_G2q7nnxA8Oml7sDd1kBY1t_OxEyi4ySkq9pgHCD-8/s1600/02-Launch.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/AVvXsEic_7MX7ZPheYWnzosRmblibYXB-F8xdKs08VtR4Aqr0EAhY_D6roOT2yXev0PdbGdCTq_uTf0YaB8a4pCtXOyNS_wQIp_G2q7nnxA8Oml7sDd1kBY1t_OxEyi4ySkq9pgHCD-8/s1600/02-Launch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;This launches the&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-weight: bold;&quot;&gt;Momentum: Data Access Component Generator&lt;/b&gt;. The code generator is divided into 4 sections.&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/AVvXsEiXRlfpF4cp6Wh5JCKZX_g9CrAM_FtPTlqqJ1BMdPUgLoLcoi_Z7tpEdFxtukcHruSE-a6QgO2G1d67651gD92dskrAJ4dtnxaah4_oUB4f16pLMcDd-QKOEht54iLeXp0RIpak/s1600/02-Momentum.png&quot; imageanchor=&quot;1&quot; style=&quot;font-weight: normal; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXRlfpF4cp6Wh5JCKZX_g9CrAM_FtPTlqqJ1BMdPUgLoLcoi_Z7tpEdFxtukcHruSE-a6QgO2G1d67651gD92dskrAJ4dtnxaah4_oUB4f16pLMcDd-QKOEht54iLeXp0RIpak/s1600/02-Momentum.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
Tip: Notice like all the code generators, Momentum is colour coded to the code generation guide.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
At the &lt;span style=&quot;background-color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;1. Connect to Database and Select Data Source&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt; section, click on the &lt;b&gt;Connect &lt;/b&gt;button to connect to a Microsoft SQL Server.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In the&amp;nbsp;&lt;b&gt;Connect...&amp;nbsp;&lt;/b&gt;dialog, enter the&amp;nbsp;&lt;b&gt;Server name&lt;/b&gt;&amp;nbsp;and select the appropriate authentication method. Click&amp;nbsp;&lt;b&gt;Connect&lt;/b&gt;&amp;nbsp;to connect to the SQL server.&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/AVvXsEhlUnXg4e8ADuNZ5C9ha0t1xfS9sostC7HNF5X0SowpxGVCyqSnjnowqonnM61RBTIvCn5azJnL9dnfP0rYkCT4MzzcCzZ1FskI8sBKfR1U6Yt6ssr7d4Yo8SvqniP1j2VgSrk0/s1600/01-Connection.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/AVvXsEhlUnXg4e8ADuNZ5C9ha0t1xfS9sostC7HNF5X0SowpxGVCyqSnjnowqonnM61RBTIvCn5azJnL9dnfP0rYkCT4MzzcCzZ1FskI8sBKfR1U6Yt6ssr7d4Yo8SvqniP1j2VgSrk0/s1600/01-Connection.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Note: LASG uses the SQL Server Management Objects and therefore, only Microsoft SQL Server is supported. You can use any editions of SQL Server including the Express edition.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Select the &lt;b&gt;LeaveSample&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;database&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;from the database list located beside the &lt;b&gt;Connect &lt;/b&gt;button. &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;All the tables available in the database will be listed in the &lt;b&gt;Sources&lt;/b&gt; dropdown list.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Select the &lt;b&gt;dbo.Leaves&lt;/b&gt; table from the &lt;b&gt;Sources&lt;/b&gt; dropdown list.&lt;/span&gt;&lt;/span&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/AVvXsEjzrtal2xYQpEOFbMl21r6vh8Zvjij0SvSdk6aNwiItrZb242D7X9M7bTovi3-qX3heJL4qJe_-FG_Jq0QkyE7kJ0jpIGAT8FkYId_0TwjBzQgWUyOaQimr9cj1XnV0Hfol_L2X/s1600/02-Section1.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/AVvXsEjzrtal2xYQpEOFbMl21r6vh8Zvjij0SvSdk6aNwiItrZb242D7X9M7bTovi3-qX3heJL4qJe_-FG_Jq0QkyE7kJ0jpIGAT8FkYId_0TwjBzQgWUyOaQimr9cj1XnV0Hfol_L2X/s1600/02-Section1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Momentum will attempt to suggest the &lt;b&gt;Entity name&amp;nbsp;&lt;/b&gt;and &lt;b&gt;Data Component name&lt;/b&gt; for you based on the selected table&#39;s name. By default, the components are given a &quot;DAC&quot; suffix. You may change that to your own naming convention (i.e. Repository) if desired.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjef-oUafHoESONX5wIJqeXiRk5NV9Ycqhoea71xpRJzZSnhyphenhyphen-wEqi_obJjHK1r40G-ejTwQvNLO1ptxa06tEiQ0S-iUgsZDDF-xZxHpW_EahzdShotP2JoUs4vQGcMdMz-BK5c/s1600/02-Section2.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/AVvXsEjef-oUafHoESONX5wIJqeXiRk5NV9Ycqhoea71xpRJzZSnhyphenhyphen-wEqi_obJjHK1r40G-ejTwQvNLO1ptxa06tEiQ0S-iUgsZDDF-xZxHpW_EahzdShotP2JoUs4vQGcMdMz-BK5c/s1600/02-Section2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;Tip: If your tables have plural names, the&amp;nbsp;&lt;b&gt;Singularize class names&lt;/b&gt;&amp;nbsp;option will attempt to suggest singular entity class names for you.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;span style=&quot;background-color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;3. Define Data Access Methods&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;section, you can select the&amp;nbsp;&lt;b&gt;Method type&lt;/b&gt; to create. For this tutorial, we will be creating &amp;nbsp;many methods. First, select &lt;b&gt;Insert | Update | Select&lt;/b&gt;&amp;nbsp;from the &lt;b&gt;Method type&lt;/b&gt; dropdown list.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the &lt;b&gt;Columns &lt;/b&gt;check box to select all the columns.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRmeF8bnTgiAjMqG6iUW9va1aw0oPx51S4cJjWzCeTeJPsS_mU_i5ajUiivE7XnR8aMkrgyarspD5g6ebEV7G3exwqREM0sSBvmmFWSOp2jExVN3HxgqrM9dRqtA41QEE7tuaX/s1600/02-Section3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRmeF8bnTgiAjMqG6iUW9va1aw0oPx51S4cJjWzCeTeJPsS_mU_i5ajUiivE7XnR8aMkrgyarspD5g6ebEV7G3exwqREM0sSBvmmFWSOp2jExVN3HxgqrM9dRqtA41QEE7tuaX/s1600/02-Section3.png&quot; height=&quot;488&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;Note: If you have previously changed the name of the properties during the creation of your entity, you will also need to change them here to match it. Similar to when you are creating entities, you can click on the &lt;b&gt;bar &lt;/b&gt;above the &lt;b&gt;Columns &lt;/b&gt;grid to launch the &lt;b&gt;Define Column Mappings&lt;/b&gt; dialog to fix any abbreviated column names.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click on the &lt;b&gt;Add to Code Generation&lt;/b&gt; button to queue the data access component definition to the &lt;span style=&quot;background-color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;4. Generate Data Access Components &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/b&gt;section. You should see 3 methods in the list - &lt;i&gt;Create&lt;/i&gt;, &lt;i&gt;UpdateById&lt;/i&gt; and &lt;i&gt;SelectById &lt;/i&gt;under the &lt;b&gt;LeaveDAC&lt;/b&gt;&lt;i&gt;.&amp;nbsp;&lt;/i&gt;Their properties are shown in the property grid below the section. You may make any last moment changes here.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZOs-8vS6qwEyz7vwfp1i8iDf8BSUyFKJdwXpiDm0Od6T2K6-jfqrXXpga_6PvfVp0U2Ivp9ga4pgV__WMbG574itAehkhAv0vaTBOT__-ruR6ISiMBwYW95FtUMkn0QhBqO_U/s1600/02-Generate.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZOs-8vS6qwEyz7vwfp1i8iDf8BSUyFKJdwXpiDm0Od6T2K6-jfqrXXpga_6PvfVp0U2Ivp9ga4pgV__WMbG574itAehkhAv0vaTBOT__-ruR6ISiMBwYW95FtUMkn0QhBqO_U/s1600/02-Generate.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;Caution! Tampering with the properties in the property grid may cause unexpected results or errors in code generation. Make sure you understand the&amp;nbsp;behaviour&amp;nbsp;of the code generator before messing with the values&amp;nbsp;in the property grid.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create another method. From the &lt;b&gt;Method type&lt;/b&gt; dropdown list, choose &lt;b&gt;Select (Paging)&lt;/b&gt;. Leave the method name as &lt;b&gt;SelectPage&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;You will need to specify an &lt;b&gt;Order &lt;/b&gt;column for the &lt;b&gt;SelectPage &lt;/b&gt;method. Click on the check box in the &lt;b&gt;Order&lt;/b&gt; grid column for &lt;b&gt;DateSubmitted&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwiFlkw6tmiuGmW-Lzr89C4xuyAp8yNrydBRqpkr2ZdDWVK99Byyn4Wv6v021JTb8upX-iSDPoDOHJzvZdSVAtbbJNm26BxoM2sbSETQoBqRKvbmI766g-O8O_ZZHwNgbzYRyP/s1600/02-SelectPaging.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwiFlkw6tmiuGmW-Lzr89C4xuyAp8yNrydBRqpkr2ZdDWVK99Byyn4Wv6v021JTb8upX-iSDPoDOHJzvZdSVAtbbJNm26BxoM2sbSETQoBqRKvbmI766g-O8O_ZZHwNgbzYRyP/s1600/02-SelectPaging.png&quot; height=&quot;491&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Tip: If you are creating many Select methods, you may want to standardize them to use one common method to load the entities. You can achieve this by checking the&amp;nbsp;&lt;b&gt;Use Load method&lt;/b&gt;&amp;nbsp;check box and entering the method name. To generate the method, check the&amp;nbsp;&lt;b&gt;Generate Load method&amp;nbsp;&lt;/b&gt;check box for the first Select method you create and uncheck it for subsequent methods. For this tutorial, we will leave the checkboxes unchecked.&lt;br /&gt;
&lt;br /&gt;
Warning! Checking these check boxes incorrectly will cause duplicate Load methods to be generated and will result in your code not compiling.&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to add the method to the &lt;b&gt;LeaveDAC &lt;/b&gt;definition.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;We will need the &lt;b&gt;SelectPage&lt;/b&gt; method to return the results ordered by descending. To do this, select the &lt;b&gt;SelectPage &lt;/b&gt;method in the list below the &lt;b&gt;LeaveDAC &lt;/b&gt;definition. Locate the &lt;b&gt;OrderByColumns &lt;/b&gt;in the property grid and click on the ellipses &lt;b&gt;[...] &lt;/b&gt;button beside it.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeT-f0KV5yqk05wvBM_5lzLGaincVnFMM2punLbqcDdNNDjmUhaMBTXRech-dUsU1DaNyevBC9vzd6PIzdqKqwwlSsBsD_iiz_12kvnXw6L1rUWNivHzMpxc1niNLFgunT-BZb/s1600/02-Order+By.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeT-f0KV5yqk05wvBM_5lzLGaincVnFMM2punLbqcDdNNDjmUhaMBTXRech-dUsU1DaNyevBC9vzd6PIzdqKqwwlSsBsD_iiz_12kvnXw6L1rUWNivHzMpxc1niNLFgunT-BZb/s1600/02-Order+By.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;b&gt;OrderColumnModel Collection Editor&lt;/b&gt; dialog, make sure &lt;b&gt;DateSubmitted &lt;/b&gt;is highlighted and locate the &lt;b&gt;OrderDirection &lt;/b&gt;property in the property grid on the right. Change the value to &lt;b&gt;Descending&lt;/b&gt;&amp;nbsp;and click &lt;b&gt;OK&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTnbLuAH2RaSyGRyyK0S5gksALUAjB1pbRDAfCaozXpI6B6ZafbdPNY1Ktk2mH_E08ttPyMiNg9UcXYw3Exd8jff_XTOudJAj5_-qi9Uf1szoSFzY89GQAMhtgG2_i0bFW6Zdx/s1600/02-Order+DESC.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTnbLuAH2RaSyGRyyK0S5gksALUAjB1pbRDAfCaozXpI6B6ZafbdPNY1Ktk2mH_E08ttPyMiNg9UcXYw3Exd8jff_XTOudJAj5_-qi9Uf1szoSFzY89GQAMhtgG2_i0bFW6Zdx/s1600/02-Order+DESC.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create another data access component for the LeaveStatusLogs table. Select &lt;b&gt;dbo.LeaveStatusLogs &lt;/b&gt;in the &lt;b&gt;Sources &lt;/b&gt;dropdown list.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Choose&amp;nbsp;&lt;b&gt;Insert &lt;/b&gt;in the &lt;b&gt;Method type&lt;/b&gt; dropdown list.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check the &lt;b&gt;Columns&lt;/b&gt; check box to ensure all columns are selected.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click the&amp;nbsp;&lt;b&gt;Add to Code Generation&lt;/b&gt;&amp;nbsp;button to queue the definition.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Create a Select method for the LeaveStatusLogDAC. Choose&amp;nbsp;&lt;b&gt;Select&amp;nbsp;&lt;/b&gt;in the&amp;nbsp;&lt;b&gt;Method type&lt;/b&gt;&amp;nbsp;dropdown list.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;We will define a filter for this method. Check the check box in the&amp;nbsp;&lt;b&gt;Filter &lt;/b&gt;grid column&amp;nbsp;for &lt;b&gt;LeaveID&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiILhB3o_6-2klIW22NcpYNIjwYYn_NUOb7Iobo7RmeYNFLiZ8geB9y9VNnYcKaIs0NxJWGuWrxWITv7xNrs67yKhMnDb3m5ZoaOilfuqIz5zXUcYxssP8k0ST4ZYV_RO0221b/s1600/02-LogSelect.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiILhB3o_6-2klIW22NcpYNIjwYYn_NUOb7Iobo7RmeYNFLiZ8geB9y9VNnYcKaIs0NxJWGuWrxWITv7xNrs67yKhMnDb3m5ZoaOilfuqIz5zXUcYxssP8k0ST4ZYV_RO0221b/s1600/02-LogSelect.png&quot; height=&quot;492&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: Notice that the &lt;b&gt;Referenced tables&lt;/b&gt; dropdown list is now enabled and the &lt;b&gt;Reference columns&lt;/b&gt; list shows all the columns that belongs to the referenced table. If you have borrowed columns from other tables previously in &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-entities.html&quot;&gt;Inertia&lt;/a&gt;, you will need to specify them again in here for your DAC. Momentum will automatically create a JOIN clause in the generated SQL statement for you.&lt;br /&gt;
&lt;br /&gt;
To add a borrowed column, select the reference column and click the&lt;b&gt; [&amp;nbsp;+ ]&lt;/b&gt; button below the &lt;b&gt;Reference column&lt;/b&gt; list. To remove any borrowed columns, simply select it in the &lt;b&gt;Columns &lt;/b&gt;grid and press the &lt;b&gt;Delete &lt;/b&gt;key on the keyboard. For this exercise, we shall skip adding any borrowed columns.&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;span style=&quot;background-color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;4. Generate Data Access Components&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt; section, you can perform various action from the tool-bar. You can&amp;nbsp;&lt;b&gt;Preview&amp;nbsp;&lt;/b&gt;the code that will be generated, set&amp;nbsp;&lt;b&gt;Options&lt;/b&gt;, reposition the methods,&amp;nbsp;&lt;b&gt;Reset&lt;/b&gt;&amp;nbsp;the definitions so that they will be code-generated again or&amp;nbsp;&lt;b&gt;Delete&amp;nbsp;&lt;/b&gt;the definitions.&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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.png&quot; height=&quot;120&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: red;&quot;&gt;Warning! Deleted definitions will not be recoverable.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note: All definitions will be marked as code generated (indicated by the&amp;nbsp;&lt;b&gt;IsUpdated&lt;/b&gt;&amp;nbsp;property) after code generation. They will continue to appear in the list but will not be code generated the next time. Clicking&amp;nbsp;&lt;b&gt;Reset&lt;/b&gt;&amp;nbsp;will change one or more definitions&#39;&amp;nbsp;&lt;b&gt;IsUpdated&lt;/b&gt;&amp;nbsp;value to&amp;nbsp;&lt;i&gt;true&lt;/i&gt;&amp;nbsp;and mark them for code generation again.&lt;br /&gt;&lt;br /&gt;You can also&amp;nbsp;&lt;b&gt;Delete&lt;/b&gt;&amp;nbsp;a method, a DAC definition or all DAC definitions from the tool-bar. Clicking on the&amp;nbsp;&lt;b&gt;Options&lt;/b&gt;&amp;nbsp;icon will open the&amp;nbsp;&lt;b&gt;Code Generation Options&lt;/b&gt;&amp;nbsp;dialog that will allow you to set a few standard options. Leave the settings alone and click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check the&lt;b&gt; Add connection string to host config file&lt;/b&gt; check box to instruct Momentum to create a connection string entry in the config file of your host project. Also make sure the &lt;b&gt;Generate base class&lt;/b&gt; check box is checked for the first time you generate classes for your data access component project.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTb1k8TZDKUOmNrwq6ompO22UII6ZOS_nqlXZpBvw83hF86mQsXIrVwXQh1ow4V5cbNkQHBCrr1DajKNpd1PEAwd-9i64UxWxotZS5hdRrULSjRspCoaESsjXl1DVWNNRCtVT2/s1600/02-Generate+Options.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTb1k8TZDKUOmNrwq6ompO22UII6ZOS_nqlXZpBvw83hF86mQsXIrVwXQh1ow4V5cbNkQHBCrr1DajKNpd1PEAwd-9i64UxWxotZS5hdRrULSjRspCoaESsjXl1DVWNNRCtVT2/s1600/02-Generate+Options.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: Momentum supports Enterprise Library DAAB 5.0 and 6.0. By default, it will generate code to use the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SqlDatabase&lt;/span&gt;&amp;nbsp;class but if you prefer to use the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;DatabaseFactory.Create&lt;/span&gt; method, you can check the &lt;b&gt;Use factory&lt;/b&gt; check box. Make sure you also check the&amp;nbsp;&lt;b&gt;Use EntLib 6.0 &lt;/b&gt;check box&lt;b&gt; &lt;/b&gt;if&amp;nbsp;you are using Enterprise Library DAAB 6.0 when using factory.&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Before proceeding, verify you have defined the following DAC definitions in the&amp;nbsp;&lt;span style=&quot;background-color: #6aa84f;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;4. Generate Data Access Components&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;section:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;LeaveDAC &lt;/b&gt;- &lt;i&gt;Create, UpdateById, SelectById&lt;/i&gt; and &lt;i&gt;SelectPage&lt;/i&gt; methods.&lt;br /&gt;&lt;b&gt;LeaveStatusLogDAC&lt;/b&gt; - &lt;i&gt;Create&lt;/i&gt; and &lt;i&gt;Select&lt;/i&gt; methods.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Finally, click the&amp;nbsp;&lt;b&gt;Generate&lt;/b&gt;&amp;nbsp;button to generate the data access component classes.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;b&gt;Code Generation Completed&lt;/b&gt;&amp;nbsp;dialog, click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The &lt;b&gt;Tutorial.Data&lt;/b&gt; project should contain the generated code files for the data access components.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZY1SG6ybdnaG0C_VSG9ZU2eOuujEHg2ZmV-lwz7Rzg2uRTsbeBGOXbfh2sAaAGwzTfB8vIWuxqLBbfZAqrtyzLQ0Nlo3lUqRodEWY9Thr9Y0vg2sG6-bKDjjMMpXUcPKbFzsB/s1600/02-Project.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZY1SG6ybdnaG0C_VSG9ZU2eOuujEHg2ZmV-lwz7Rzg2uRTsbeBGOXbfh2sAaAGwzTfB8vIWuxqLBbfZAqrtyzLQ0Nlo3lUqRodEWY9Thr9Y0vg2sG6-bKDjjMMpXUcPKbFzsB/s1600/02-Project.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Extra Tip:&amp;nbsp;If you are regenerating code and the code file already exist in the project, you will be prompted to either Append, Backup, Overwrite or Cancel the process.&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/AVvXsEit5K6cyu1aoGqDD1oP8zGWbZbjdpRPvXTnxX34LBmZKrSs7tYq89SptASJaoC5eM8A2EQqNvx6eO8ot1rYvzO_1PhIgSYX2lFLcGdRbwwjCQpKFfXnsu4CZgyJ7k_twYSPBOwL/s1600/02-Exist+Warning.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/AVvXsEit5K6cyu1aoGqDD1oP8zGWbZbjdpRPvXTnxX34LBmZKrSs7tYq89SptASJaoC5eM8A2EQqNvx6eO8ot1rYvzO_1PhIgSYX2lFLcGdRbwwjCQpKFfXnsu4CZgyJ7k_twYSPBOwL/s1600/02-Exist+Warning.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Append &lt;/b&gt;will append whatever new methods to the bottom of the class. Take note it is not an intelligent append and duplicate methods may be appended to your class. You also need to make sure that you do not have any comments or commented code at the end of your class files.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Backup &lt;/b&gt;creates a copy of your code file with a .bak extension and requires you to manually include its contents into your project.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Overwrite &lt;/b&gt;will replace your existing code with the newly generated one. Any previously defined methods that were not included in the latest code generation will be lost.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Cancel &lt;/b&gt;will discard the generated code from memory and preserves the existing code file.&lt;br /&gt;&lt;br /&gt;You can choose to apply the same option for all the files by checking the&lt;b&gt; Do the same for all occurrence&lt;/b&gt; check box.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We have basically gone through how to use the Momentum: Data Access Component generator to create data access components for our layered application. Take note that the methods generated are just the basic logic. You can still make any necessary changes to the code as you please but take note that any changes made in your code will not be reflected in the definitions stored in Momentum. Therefore, practice caution when you are regenerating code on existing code file.&lt;br /&gt;
&lt;br /&gt;
Coming up next - &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-business-components.html&quot;&gt;How-To: Create Business Components with Motion in LASG&lt;/a&gt;.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/3445496177306268068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/3445496177306268068' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3445496177306268068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3445496177306268068'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/lasg-creating-data-access-components.html' title='How-To: Create Data Access Components with Momentum in LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEj0fYXEtAxPzmTKVqZNhdK24OyZVwMPMi-vfHibIkqHzhxsjc-7sF7_Cet-49zRuz7r2TzUtLcRj6yiW69Tbd_rn9goseAvRHjn8Kbj0_AjLRZ4pqgVmW49e2UNQoKxgZiX4gn3/s72-c/02-Guide.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-7706859862641653026</id><published>2014-03-05T16:04:00.001+08:00</published><updated>2014-03-18T11:57:09.058+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><title type='text'>How-To: Create Entities with Inertia in LASG</title><content type='html'>This walk-through will get you started with the &lt;b&gt;Inertia: Business Entity Component Generator&lt;/b&gt;&amp;nbsp;that is available in &lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance 2013&lt;/a&gt;. The first step in creating layered applications after designing the database is to create the entity classes. Before beginning this guide, please make sure that you have completed the previous tutorial on &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/02/lasg-getting-started.html&quot;&gt;Getting Started with LASG&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This walk-through also uses the &lt;b&gt;LeaveSample &lt;/b&gt;database that is part of the&amp;nbsp;&lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;Layered Architecture Sample for .NET&lt;/a&gt;&amp;nbsp;but you may use your own database to follow through.&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/AVvXsEhEUndN_Dgt73khW1bjR5O6XdVNLfv5RgizB18dMdwSx14PbnYNQQiR0WSMEItszN5e-JLr5bRnW5P5fMLr66JFdBEL6JerhkizBRzntfPfnFJGjTiJkUo78QhBti14v7Vn6kw8/s1600/01-Guide.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/AVvXsEhEUndN_Dgt73khW1bjR5O6XdVNLfv5RgizB18dMdwSx14PbnYNQQiR0WSMEItszN5e-JLr5bRnW5P5fMLr66JFdBEL6JerhkizBRzntfPfnFJGjTiJkUo78QhBti14v7Vn6kw8/s1600/01-Guide.png&quot; height=&quot;362&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt;, expand the &lt;b&gt;Tutorial &lt;/b&gt;solution, go to the &lt;b&gt;Shared &lt;/b&gt;folder, right-click on the &lt;b&gt;Tutorial.Entities&lt;/b&gt; project and click &lt;b&gt;Add Entities... &lt;/b&gt;&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/AVvXsEiyx8k1fsHVZxqM5gVrIbj8ZA0uUVDOrENzJmipNiOWs1h4cqQPex6lCejRwIt0W2YgK4QTGrhSbjp8r3lZ6Za5OomeW44YZYloj-lbu5ndwY8ayTuob2Xrdjijk5FQxC2QLbuU/s1600/01-Launch.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/AVvXsEiyx8k1fsHVZxqM5gVrIbj8ZA0uUVDOrENzJmipNiOWs1h4cqQPex6lCejRwIt0W2YgK4QTGrhSbjp8r3lZ6Za5OomeW44YZYloj-lbu5ndwY8ayTuob2Xrdjijk5FQxC2QLbuU/s1600/01-Launch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The &lt;b&gt;Inertia: Business Entity Component Generator &lt;/b&gt;will launch. The code generator is divided into 3 sections.&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/AVvXsEifg5Zv6dRm4JogzdvFu9t2Z2kAk3VijUpvngdNRdS_-ySXSxxdhgtfI_0Idajy_JILYE34cnUoQkKKcHnxYjL5-ddrpj4OFI2uTh35zqeI6m1tA00M3Ca-TmRwP4CzaY0l0fH6/s1600/01-Inertia.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/AVvXsEifg5Zv6dRm4JogzdvFu9t2Z2kAk3VijUpvngdNRdS_-ySXSxxdhgtfI_0Idajy_JILYE34cnUoQkKKcHnxYjL5-ddrpj4OFI2uTh35zqeI6m1tA00M3Ca-TmRwP4CzaY0l0fH6/s1600/01-Inertia.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
Tip: Notice the code generator is colour coded to the code generation guide.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;span style=&quot;background-color: #674ea7; color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;1.&amp;nbsp;Choose Data Source and Columns&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;section, click the&amp;nbsp;&lt;b&gt;Connect&lt;/b&gt;&amp;nbsp;button to connect to a Microsoft SQL Server.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In the &lt;b&gt;Connect... &lt;/b&gt;dialog, enter the &lt;b&gt;Server name&lt;/b&gt; and select the appropriate authentication method. Click &lt;b&gt;Connect&lt;/b&gt; to connect to the SQL server. &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/AVvXsEhlUnXg4e8ADuNZ5C9ha0t1xfS9sostC7HNF5X0SowpxGVCyqSnjnowqonnM61RBTIvCn5azJnL9dnfP0rYkCT4MzzcCzZ1FskI8sBKfR1U6Yt6ssr7d4Yo8SvqniP1j2VgSrk0/s1600/01-Connection.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/AVvXsEhlUnXg4e8ADuNZ5C9ha0t1xfS9sostC7HNF5X0SowpxGVCyqSnjnowqonnM61RBTIvCn5azJnL9dnfP0rYkCT4MzzcCzZ1FskI8sBKfR1U6Yt6ssr7d4Yo8SvqniP1j2VgSrk0/s1600/01-Connection.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red; text-align: left;&quot;&gt;Note: LASG uses the SQL Server Management Objects and therefore, only Microsoft SQL Server is supported. You can use any editions of SQL Server including the Express edition.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Select the &lt;b&gt;LeaveSample&lt;/b&gt;&amp;nbsp;database from the database list located beside the &lt;b&gt;Connect&lt;/b&gt; button.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;In the &lt;b&gt;Source&lt;/b&gt; tab, select the &lt;b&gt;Leaves&lt;/b&gt; table from the &lt;b&gt;Sources&lt;/b&gt; dropdown list. All its columns will be listed in the list box below the &lt;b&gt;Columns&lt;/b&gt; check box.&lt;br /&gt;&lt;br /&gt;Tip:&amp;nbsp;Inertia will attempt to suggest the entity class name for you based on the selected table’s name.&amp;nbsp;If your tables have plural names, the &lt;b&gt;Singularize class names&lt;/b&gt; option will attempt to suggest singular entity class names for you.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;If you are not using the LeaveSample database tables and have abbreviated column names i.e. hr_wkflowID, PrdName, StdMercName etc., you can create meaningful property names for them by clicking on the&amp;nbsp;&lt;b&gt;bar&amp;nbsp;&lt;/b&gt;above the column list. This launches the&amp;nbsp;&lt;b&gt;Define Column Mappings&lt;/b&gt;&amp;nbsp;dialog. Make any necessary changes to the &lt;b&gt;Property Name&lt;/b&gt; and click&amp;nbsp;&lt;b&gt;OK&amp;nbsp;&lt;/b&gt;when done.&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/AVvXsEhG_gjW5fvE73mwCnfyv3nsxL8t8zkKcmWufGpA0rePCph0fmxgGWSEhnl6Q26DVu7SgA6gzJwPlOWZ4KMdMSLmQwkdGyLpbSEKTIrpp1izyVlQhLMymcuGgGmyaXOvAAHs3RJk/s1600/01-Define-Map.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/AVvXsEhG_gjW5fvE73mwCnfyv3nsxL8t8zkKcmWufGpA0rePCph0fmxgGWSEhnl6Q26DVu7SgA6gzJwPlOWZ4KMdMSLmQwkdGyLpbSEKTIrpp1izyVlQhLMymcuGgGmyaXOvAAHs3RJk/s1600/01-Define-Map.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;Note: It is recommended that you have well defined meaningful column names in the tables than to rely on the column mappings.&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Check on the &lt;b&gt;Columns&lt;/b&gt; check box to select all the columns and click on the &amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;
&amp;nbsp;button to add them to the &lt;span style=&quot;background-color: #674ea7;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;2.&amp;nbsp;Define Entity Settings&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt; section.&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/AVvXsEgfZuKMRJL3XkbZsocgR6vKbAnJC9qH6AbQ-N8EPLzDtlUvyHR92ydr-Gz9XjOvYntE7Gn8FqETJOaPbfrd_B8d3jD7fcZV3Q3mtxBA4HfJ0DKsi7-DX9schyphenhyphenluee0a6RgavoBY/s1600/01-Selected.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/AVvXsEgfZuKMRJL3XkbZsocgR6vKbAnJC9qH6AbQ-N8EPLzDtlUvyHR92ydr-Gz9XjOvYntE7Gn8FqETJOaPbfrd_B8d3jD7fcZV3Q3mtxBA4HfJ0DKsi7-DX9schyphenhyphenluee0a6RgavoBY/s1600/01-Selected.png&quot; height=&quot;640&quot; width=&quot;633&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;Tip: You can also individually select or deselect columns. Press the &lt;b&gt;Ctrl&lt;/b&gt; key while clicking on the columns to select/deselect individual columns or use the &lt;b&gt;Shift&lt;/b&gt; key to select/deselect a range of adjacent columns.&lt;br /&gt;&lt;br /&gt;Note: Not all data-types are supported. Complex data-types are currently not supported.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The&lt;b&gt; Reference To&lt;/b&gt; tab will show all the tables that the current table is referencing to with a foreign key. You can choose to relate to the entire table as a reference object or individually select the columns which you want to include as part of the current entity (a.k.a. borrowed columns). Once you are done with your selections,&amp;nbsp;click on the &amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;button to add them to the&amp;nbsp;&lt;b&gt;Entity properties&amp;nbsp;&lt;/b&gt;grid.&amp;nbsp;For simplicity, we shall not add anything from here in this tutorial.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The &lt;b&gt;Reference By&lt;/b&gt; tab shows all the tables that is referencing the current table with a foreign key. You can choose to relate the tables here as a collection of Entities. Click on the&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSyta4UyIzbW31GJMq5jAJoaHUg66varnsyKJsNzYdkMTTVPzezRdG47jgihcT_NIcmUCuUHb2IOttqS_y27O2mZI5DowAX6CBDF7J8zDjMBdoc-qCgieOFtVRPYQUS5H4KcAF/s1600/01-Right-Button.png&quot; style=&quot;margin: -10px; padding: 0px;&quot; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;button to add them to the&amp;nbsp;&lt;b&gt;Entity properties&amp;nbsp;&lt;/b&gt;grid.&amp;nbsp;You will also need to generate the Entity classes individually for the tables you selected here later. For simplicity, we shall not add anything from here in this tutorial.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The columns that you choose will appear in the &lt;b&gt;Entity properties &lt;/b&gt;grid under the &lt;span style=&quot;background-color: #674ea7;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;2.&amp;nbsp;&lt;b&gt;Define Entity Settings&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt; section&amp;nbsp;as properties to be generated for the Entity. You can make adjustments here i.e. changing the comments or marking a property to accept nulls.&lt;br /&gt;&lt;br /&gt;Tip: In case you want to remove any columns from the properties list, just select the row and press the&amp;nbsp;&lt;b&gt;Delete &lt;/b&gt;key on the keyboard or your can&lt;b&gt; right-click&lt;/b&gt; on the selected row to invoke a context menu to delete it.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Once you are ready, click on the &lt;b&gt;Add to Code Generation&lt;/b&gt; button to queue the definition to the &lt;span style=&quot;background-color: #674ea7;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;3.&amp;nbsp;Generate Entities&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt; section.&amp;nbsp;You can queue as many entities for code generation as you wish. To create another entity, simply click on the &lt;b&gt;New&lt;/b&gt; button. For this tutorial, we shall create 2 entities - &lt;i&gt;Leave&lt;/i&gt;&amp;nbsp;and &lt;i&gt;LeaveStatusLog&lt;/i&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Each queued entity definition will be listed in the &lt;span style=&quot;background-color: #674ea7; color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;3.&amp;nbsp;Generate Entities&lt;/b&gt;&amp;nbsp;&lt;/span&gt; section. You can review the definitions and make any last moment changes in the property grid located at the bottom of the section. You can delete any entity properties by selecting the row and pressing the &lt;b&gt;Delete &lt;/b&gt;key.&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/AVvXsEgtUjvJVcj-Ngwj0q9HxLGdK2m7MfkjBtPBsn6DF_H6t9AgI3jSu8TEUAS01FVOyZ07o2b8HiEJboLExJnQ6MU8lvOxZtMXI_ZFOtWF8ex_32re0xjTJDaLQjJ5K6nRRU8XX_vi/s1600/01-Generate.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/AVvXsEgtUjvJVcj-Ngwj0q9HxLGdK2m7MfkjBtPBsn6DF_H6t9AgI3jSu8TEUAS01FVOyZ07o2b8HiEJboLExJnQ6MU8lvOxZtMXI_ZFOtWF8ex_32re0xjTJDaLQjJ5K6nRRU8XX_vi/s1600/01-Generate.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Caution! Tampering with the properties in the property grid may cause unexpected results or errors in code generation. Make sure you understand the&amp;nbsp;behaviour&amp;nbsp;of the code generator before messing with the values&amp;nbsp;in the property grid.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;You can perform various action from the tool-bar at the &lt;span style=&quot;background-color: #674ea7;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;b&gt;3. Generate Entities&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt; section. You can &lt;b&gt;Preview &lt;/b&gt;the code that will be generated, set &lt;b&gt;Options&lt;/b&gt;, reposition the properties, &lt;b&gt;Reset&lt;/b&gt; the definitions so that they will be code-generated again or &lt;b&gt;Delete &lt;/b&gt;the definitions.&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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.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/AVvXsEgul2GHyBEGwPUybDSIhVBmTCb2JO2fA4FzQJbQ9AOHayPNyvTFWTLCtPnj-0RlMkhymY2NvElyfvGLazv81FskV7qNcX51munO3gVyc_v2WUKaoLSbar8M1Clr4E7KwZYFm16l/s1600/01-Toolbar.png&quot; height=&quot;120&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: red;&quot;&gt;Warning! Deleted definitions will not be recoverable.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Note: All definitions will be marked as code generated (indicated by the &lt;b&gt;IsUpdated&lt;/b&gt; property) after code generation. They will continue to appear in the list but will not be code generated the next time. Clicking &lt;b&gt;Reset&lt;/b&gt; will change one or more definitions&#39; &lt;b&gt;IsUpdated&lt;/b&gt; value to &lt;i&gt;true&lt;/i&gt; and mark them for code generation again.&lt;br /&gt;
&lt;br /&gt;
You can also &lt;b&gt;Delete&lt;/b&gt; an entity property, an entity definition or all entity definitions from the tool-bar. Clicking on the &lt;b&gt;Options&lt;/b&gt; icon will open the &lt;b&gt;Code Generation Options&lt;/b&gt; dialog that will allow you to set a few standard options. Leave the settings alone and click &lt;b&gt;OK&lt;/b&gt;.&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/AVvXsEhDoLHVd6-TPx8Zwjmli2j3yj2cBOFaZhTTTlX26N7ZWc71ALjTzuv3uDTR1p1aHGsKWCMLc3y2GrEOou7YcLKvgLN2P8xw5n-ozHQsFICnV9xF0DkPyoX7JVSN6Tn_DBNyYsZm/s1600/01-Options.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/AVvXsEhDoLHVd6-TPx8Zwjmli2j3yj2cBOFaZhTTTlX26N7ZWc71ALjTzuv3uDTR1p1aHGsKWCMLc3y2GrEOou7YcLKvgLN2P8xw5n-ozHQsFICnV9xF0DkPyoX7JVSN6Tn_DBNyYsZm/s1600/01-Options.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Finally, click the &lt;b&gt;Generate&lt;/b&gt; button to generate the entity classes.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the &lt;b&gt;Code Generation Completed&lt;/b&gt; dialog, click &lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;The &lt;b&gt;Tutorial.Entities&lt;/b&gt; project should contain the generated code files for the entities.&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/AVvXsEia9OAHqhk6EdYTAnQuF3rJaMxyxJyZ3WMkwqazRSdvbsKuvKI8665VELRGwxQcNtTS55TzMtIzOpwK8UvZqSkAmkaE8n-iN0js3Ny0UycbpT3Dtpknu2ZbXrAdQEpGHluvx9_h/s1600/01-Project.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/AVvXsEia9OAHqhk6EdYTAnQuF3rJaMxyxJyZ3WMkwqazRSdvbsKuvKI8665VELRGwxQcNtTS55TzMtIzOpwK8UvZqSkAmkaE8n-iN0js3Ny0UycbpT3Dtpknu2ZbXrAdQEpGHluvx9_h/s1600/01-Project.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
We have basically gone through how to use the Inertia: Business Entity Component Generator to create Entity classes for our layered application. You can make any necessary changes to the code but take note that any changes made in your code will not be reflected in the definitions stored in Inertia. Therefore, practice caution when you are regenerating code on existing code file.&lt;br /&gt;
&lt;br /&gt;
Coming up next - &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-data-access-components.html&quot;&gt;How-To: Create Data Access Components with Momentum in LASG&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/7706859862641653026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/7706859862641653026' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7706859862641653026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7706859862641653026'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/03/lasg-creating-entities.html' title='How-To: Create Entities with Inertia in LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEhEUndN_Dgt73khW1bjR5O6XdVNLfv5RgizB18dMdwSx14PbnYNQQiR0WSMEItszN5e-JLr5bRnW5P5fMLr66JFdBEL6JerhkizBRzntfPfnFJGjTiJkUo78QhBti14v7Vn6kw8/s72-c/01-Guide.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-3924882306982506679</id><published>2014-02-27T23:23:00.002+08:00</published><updated>2014-03-17T13:55:21.141+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Code"/><title type='text'>Boost Android Emulator Performance</title><content type='html'>As a&amp;nbsp;&lt;i&gt;n00b &lt;/i&gt;trying to figure out&amp;nbsp;Android development, I fell into the same experience of many who have wondered and complained about the slow performance of the Android Emulator. Fortunately, I was pointed to this &lt;a href=&quot;http://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture&quot;&gt;article&lt;/a&gt; before a training. The article describes that we can actually download and install the&amp;nbsp;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager&quot;&gt;Intel® Hardware Accelerated Execution Manager&lt;/a&gt;&amp;nbsp;&lt;/b&gt;(HAXM) to boost the performance of the Android emulator on Windows machines.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
Since I&#39;m running on Windows Server 2012 R2, I&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;downloaded the version which promises to be a hotfix for Windows 8.1 but when I try to install it, I got the following:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&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/AVvXsEjHSPjTlOATM4aPyr03QNlwREglKaeF1jvs06UwTtUUWr5DJYgcN0BLq3wTI07sV5mm_7SHFeihPBu1QAO6T67O-CWeY-BdTbUibpgbbADSdIGCQZQdhzWN1Vd62pMOoPL0w2Bn/s1600/AVD-HAMX-Error.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/AVvXsEjHSPjTlOATM4aPyr03QNlwREglKaeF1jvs06UwTtUUWr5DJYgcN0BLq3wTI07sV5mm_7SHFeihPBu1QAO6T67O-CWeY-BdTbUibpgbbADSdIGCQZQdhzWN1Vd62pMOoPL0w2Bn/s1600/AVD-HAMX-Error.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;This computer does not support Intel Virtualization Technology (VT-x). HAXM cannot be installed. Please refer to the Intel HAXM documentation for more information.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
I was puzzled by the error message since my machine has Hyper-V installed and I&#39;m pretty sure that my VT-x was enabled in the BIOS. I proceeded to download the&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;a href=&quot;http://www.intel.com/support/processors/tools/piu/sb/CS-014921.htm&quot; style=&quot;font-weight: bold;&quot;&gt;Intel® Processor Identification Utility&lt;/a&gt;&amp;nbsp;just to be sure and I got the following:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&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/AVvXsEgyoCxVOYNL09xIvHm370gfxalCqvJG5bheH33rOFTq2YQdfndi4HmeXHmKEfmg5pgeQe5DzhxljrIwkpAcYDXpjocM6CW1k98WiKSJqBhQZWF2rz3kPl-L1ch11QHVYaFw88j_/s1600/AVD-CPUID.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/AVvXsEgyoCxVOYNL09xIvHm370gfxalCqvJG5bheH33rOFTq2YQdfndi4HmeXHmKEfmg5pgeQe5DzhxljrIwkpAcYDXpjocM6CW1k98WiKSJqBhQZWF2rz3kPl-L1ch11QHVYaFw88j_/s1600/AVD-CPUID.png&quot; height=&quot;473&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
What the ...&lt;br /&gt;
&lt;br /&gt;
Anyway, after some research I found out that the hypervisor layer that Hyper-V installed was interfering with the tool. Now, I&#39;m caught in-between. I am running on a Server workstation (is there such a term?) and I need Hyper-V for my VMs and Windows Phone 8 development. I don&#39;t want to un-install Hyper-V just because I &lt;i&gt;wanna&lt;/i&gt; try out some Android development.&lt;br /&gt;
&lt;br /&gt;
Fortunately, I discovered a trick which can let me boot my Windows without loading the hypervisor layer temporarily. To achieve this, some &lt;b&gt;bcdedit&lt;/b&gt; acrobatics is required. Please take note that playing with bcdedit may lead you into disastrous results such as not being able to boot up your machine - so don&#39;t say I didn&#39;t warn ya. ;)&lt;br /&gt;
&lt;br /&gt;
If you open up a &lt;b&gt;command prompt&lt;/b&gt; (in Administrator mode please!) and type in &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;bcdedit&lt;/span&gt;, you should get something like the following:&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/AVvXsEjy7c4vaPZWBF0Ltx1mhsxHLmtSA5bcuhGTn92mVHD6aHJVOSclzZJ8StaWr_Az6eXWv7uugiQzYOgB8DtIZ6W08kWENeXLNUHjbhEGCqGGWk_WxeQeIgFFZHvZWm2K-UVL4wwS/s1600/AVD-BCD-Hyper-V.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/AVvXsEjy7c4vaPZWBF0Ltx1mhsxHLmtSA5bcuhGTn92mVHD6aHJVOSclzZJ8StaWr_Az6eXWv7uugiQzYOgB8DtIZ6W08kWENeXLNUHjbhEGCqGGWk_WxeQeIgFFZHvZWm2K-UVL4wwS/s1600/AVD-BCD-Hyper-V.png&quot; height=&quot;460&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Notice the &lt;b&gt;hypervisorlaunchtype &lt;/b&gt;is set to &lt;b&gt;Auto&lt;/b&gt;. Now, let&#39;s create a backup entry of that for our no Hyper-V version (&lt;i&gt;cos&lt;/i&gt; I don&#39;t want to screw up the original). Issue this command to clone an entry.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;bcdedit /copy {current} /d &quot;Windows Server 2012 - No Hyper-V&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You should get a message telling you that the current entry has been copied to a new entry with some identifier GUID. If you type bcdedit again, you should be able to see the new entry with the same hypervisor setting. Issue the following command to disable it.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;bcdedit /set {the-identifier-GUID-of-the-entry-you-just-created} hypervisorlaunchtype off&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
If you have done it correctly, you should be able to get something like the following:&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/AVvXsEj_OUu6sD-zhGq0o0KyTXPHQrueOyxl6tZGwbF1bOhDPbHu19QQswWfCbtmsb3KL2EqnIpLlbk7RJ19ASr7JRZqus-S5gp4yfQVnsUXquThJIbx05UMBDFw2_XL0yQi8A65X9md/s1600/AVD-BCD-No-Hyper-V.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/AVvXsEj_OUu6sD-zhGq0o0KyTXPHQrueOyxl6tZGwbF1bOhDPbHu19QQswWfCbtmsb3KL2EqnIpLlbk7RJ19ASr7JRZqus-S5gp4yfQVnsUXquThJIbx05UMBDFw2_XL0yQi8A65X9md/s1600/AVD-BCD-No-Hyper-V.png&quot; height=&quot;460&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now that the setting is off, you can reboot your machine (and pray) and when prompted, select to boot with the &lt;b&gt;Windows Server 2012 - No Hyper-V&lt;/b&gt; entry. You should not feel any difference other than Hyper-V is being switched off. With this you can now install HAXM without any problems.&lt;br /&gt;
&lt;br /&gt;
Note: When installing HAXM, you will be asked to allocate an amount of memory. I took the default 2GB.&lt;br /&gt;
&lt;br /&gt;
Now stuff doesn&#39;t just stop here. After you have HAXM installed, launch the &lt;b&gt;Android SDK Manager&lt;/b&gt; from your Android IDE i.e. eclipse or Xamarin. Make sure you checked on the &lt;b&gt;Intel x86 Atom System Images&lt;/b&gt; for the Android API levels that you want and install it.&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/AVvXsEjRyvp57Ez83jZ5-uU4tH_Lfb7832WVJxFT4lIiJu1Agz_3QKkXdD_gSvQ9VSsVWlcTdcL8_s0WHwQdyiiC1gvH3Ed4nccufaJpWjNsHFeHSMD_m0aIA4hN-JQMLDpBbUtSYd5l/s1600/AVD-Atom.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/AVvXsEjRyvp57Ez83jZ5-uU4tH_Lfb7832WVJxFT4lIiJu1Agz_3QKkXdD_gSvQ9VSsVWlcTdcL8_s0WHwQdyiiC1gvH3Ed4nccufaJpWjNsHFeHSMD_m0aIA4hN-JQMLDpBbUtSYd5l/s1600/AVD-Atom.png&quot; height=&quot;640&quot; width=&quot;615&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Also remember to scroll to the bottom and check the &lt;b&gt;Intel x86 Emulator Accelerator (HAXM)&lt;/b&gt; to install it.&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/AVvXsEjichQsJjVuATpENplfgNkXXhxggRLRCZYAxUrPw_BpXwmgQebMxya42iEgOo6eRgwTW-9YCtM4HnauEOT3GSESgXDXBE_hrvBJ9ZdFnhB1ulTQv6rO5l84OW_N-3ZC9uYyDIS1/s1600/AVD-HAMX-Emul.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/AVvXsEjichQsJjVuATpENplfgNkXXhxggRLRCZYAxUrPw_BpXwmgQebMxya42iEgOo6eRgwTW-9YCtM4HnauEOT3GSESgXDXBE_hrvBJ9ZdFnhB1ulTQv6rO5l84OW_N-3ZC9uYyDIS1/s1600/AVD-HAMX-Emul.png&quot; height=&quot;640&quot; width=&quot;614&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Once they are installed, launch the &lt;b&gt;Android Virtual Device Manager &lt;/b&gt;and create a new &lt;b&gt;Android Virtual Device (AVD)&lt;/b&gt;. At the create screen, select &lt;b&gt;Intel Atom x86&lt;/b&gt; for the &lt;b&gt;CPU/ABI&lt;/b&gt; and make sure you check &lt;b&gt;Use Host GPU&lt;/b&gt;.&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/AVvXsEgb05REAW8XE-oqgecWe7j_1zajLjAFjZdMEkAc5A3weJn9nRqe4EdLKNkdk4aV4AwhFGGKb6fmSWD2WJsbKt-IWTYovjJhkEBxkKu4VInmJeO3tBQ0kAvfLT8ToBC_SGSnpHIQ/s1600/AVD-New.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/AVvXsEgb05REAW8XE-oqgecWe7j_1zajLjAFjZdMEkAc5A3weJn9nRqe4EdLKNkdk4aV4AwhFGGKb6fmSWD2WJsbKt-IWTYovjJhkEBxkKu4VInmJeO3tBQ0kAvfLT8ToBC_SGSnpHIQ/s1600/AVD-New.png&quot; height=&quot;640&quot; width=&quot;382&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Note: If you decide to put anything higher than 768 for RAM here you will get a warning saying:&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;&quot;On Windows, emulating RAM greater than 768M may fail depending on the system load. Try progressively smaller values of RAM if the emulator fails to launch.&quot;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
You may ignore that&amp;nbsp;and give it something larger. I gave mine 2048 but if you try to start the emulator now, you may encounter the following error:&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/AVvXsEgg6kBALMDXmbJ75r_dqTj0tbzS928VDVshGwVxj2F-Bdd8jzm1vA3TfL82v-Hmc7bwJucOpbyQJpqGdT4yu6DEevZBZEn5YZffAh2oOuLJsBffAHMF-MeicOG_us8LxrmYmvt2/s1600/AVD-RAM-Error.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/AVvXsEgg6kBALMDXmbJ75r_dqTj0tbzS928VDVshGwVxj2F-Bdd8jzm1vA3TfL82v-Hmc7bwJucOpbyQJpqGdT4yu6DEevZBZEn5YZffAh2oOuLJsBffAHMF-MeicOG_us8LxrmYmvt2/s1600/AVD-RAM-Error.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
To fix this, go to your user folder and locate the folder of the AVD that you are trying to start i.e.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;C:\Users\Administrator\.android\avd\Note3.avd&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Open up the &lt;b&gt;config.ini&lt;/b&gt; file with a text editor and locate the&amp;nbsp;&lt;b&gt;hw.ramSize=&lt;/b&gt; entry. Change whatever value that it has to suffix with an &#39;&lt;b&gt;mb&lt;/b&gt;&#39;. i.e.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #fff2cc; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;hw.ramSize=2048mb&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Save it and &lt;i&gt;whalla&lt;/i&gt;! Your Android Virtual Device can now be started and will run at awesome speed.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/3924882306982506679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/3924882306982506679' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3924882306982506679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/3924882306982506679'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/02/boost-performance-of-android-emulator.html' title='Boost Android Emulator Performance'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEjHSPjTlOATM4aPyr03QNlwREglKaeF1jvs06UwTtUUWr5DJYgcN0BLq3wTI07sV5mm_7SHFeihPBu1QAO6T67O-CWeY-BdTbUibpgbbADSdIGCQZQdhzWN1Vd62pMOoPL0w2Bn/s72-c/AVD-HAMX-Error.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-6542401727058300550</id><published>2014-02-27T10:11:00.001+08:00</published><updated>2014-02-27T10:11:45.926+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Server"/><title type='text'>Get Asset Tag from BIOS</title><content type='html'>It was that time of the year where the auditors are visiting again and I found out this handy command to retrieve the&lt;b&gt; Serial Number&lt;/b&gt; and &lt;b&gt;Asset Tag&lt;/b&gt; from the system BIOS.&lt;br /&gt;
&lt;br /&gt;
Open a &lt;b&gt;command prompt&lt;/b&gt;, and type in:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;wmic SystemEnclosure get SerialNumber, SMBIOSAssetTag&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
... and the values will be shown.&lt;br /&gt;
&lt;br /&gt;
Note: Somehow the BIOS on my Dell machine only allow up to 10 characters for the tag. If your company uses anything longer, then it won&#39;t fit :&#39;( Darn! And I was hoping I don&#39;t have to flip my notebook the next time they &lt;i&gt;wanna&lt;/i&gt; see it.</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/6542401727058300550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/6542401727058300550' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/6542401727058300550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/6542401727058300550'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/02/get-asset-tag-from-bios.html' title='Get Asset Tag from BIOS'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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-7549567.post-7760583007484769616</id><published>2014-02-26T13:36:00.000+08:00</published><updated>2014-03-17T09:58:19.844+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="LASG"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><title type='text'>How-To: Get Started with LASG</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
Welcome to the first tutorial in a 7 series walk-through to introduce you to the &lt;b&gt;&lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/caa8f808-d4a5-4f48-a88e-da572834f37e&quot;&gt;Layered Architecture Solution Guidance (LASG)&lt;/a&gt;&lt;/b&gt;&amp;nbsp;visual studio extension. This tutorial will get you started in using the extension to unfold the basic structure for a layered web application and in the upcoming posts, we will be going through each of the code-generators individually.&lt;/div&gt;
&lt;ol&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Launch&amp;nbsp;&lt;strong&gt;Visual Studio 2013&amp;nbsp;&lt;/strong&gt;with administrator privileges.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Open the&amp;nbsp;&lt;strong&gt;File&amp;nbsp;&lt;/strong&gt;menu, click&amp;nbsp;&lt;strong&gt;New&amp;nbsp;&lt;/strong&gt;and then click&amp;nbsp;&lt;strong&gt;Project...&lt;/strong&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;At the&amp;nbsp;&lt;strong&gt;New Project&amp;nbsp;&lt;/strong&gt;dialog, under&amp;nbsp;&lt;strong&gt;Installed Templates &lt;/strong&gt;on the left pane, expand&amp;nbsp;&lt;strong&gt;Guidance Packages&lt;/strong&gt;&amp;nbsp;and click&amp;nbsp;&lt;strong&gt;Layered Architecture Solution Guidance&lt;/strong&gt;.&lt;/li&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/AVvXsEioDYJcjbJftrbnqwelQyP3kadnTjlbOz_v6CsrMi0ViWyWMhxvKRwyOrHpEPbeAP9L_kv5CSVEq_vGKUx8nCWNOWMOqSANESAu4OfYHWOEPtWZ6pijKerO7CsHKVVhr0YJEhx1/s1600/00-Project+Dialog.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/AVvXsEioDYJcjbJftrbnqwelQyP3kadnTjlbOz_v6CsrMi0ViWyWMhxvKRwyOrHpEPbeAP9L_kv5CSVEq_vGKUx8nCWNOWMOqSANESAu4OfYHWOEPtWZ6pijKerO7CsHKVVhr0YJEhx1/s1600/00-Project+Dialog.png&quot; height=&quot;442&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Leave the&amp;nbsp;&lt;b&gt;Layered Application &lt;/b&gt;solution template selected as default.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Enter a &lt;b&gt;Name&lt;/b&gt; for the solution i.e. &lt;i&gt;Tutorial&amp;nbsp;&lt;/i&gt;and click &lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
At the &lt;b&gt;Choose LASG Solution Template&lt;/b&gt; dialog, select &lt;b&gt;Layered Web Application&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&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/AVvXsEgumDIBESTS_k5Wp8eLvMbSfmirYabbmSRqZ5Z-M8SeeYOo0WzpzElbyAeJZJVfc81DW2JNKcKpPYQxPSGuUQLoBtPw7TXzPpu92yF9D_Wzjku1jkQMGzfVDh3iNHXYXVs4HCi-/s1600/00-Template-Chooser.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/AVvXsEgumDIBESTS_k5Wp8eLvMbSfmirYabbmSRqZ5Z-M8SeeYOo0WzpzElbyAeJZJVfc81DW2JNKcKpPYQxPSGuUQLoBtPw7TXzPpu92yF9D_Wzjku1jkQMGzfVDh3iNHXYXVs4HCi-/s1600/00-Template-Chooser.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Note: The&lt;b&gt; Project Namespace&lt;/b&gt; will follow the solution name that was provided earlier. You can also check/uncheck the projects which you want to add to/remove from your solution from the &lt;b&gt;Project templates&lt;/b&gt; list.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px; text-align: left;&quot;&gt;Click &lt;b&gt;OK&lt;/b&gt;,&amp;nbsp;and wait for the projects to unfold. &lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
For Layered Web Applications, the &lt;b&gt;New ASP.NET Project&lt;/b&gt; dialog box will be displayed. This is Visual Studio 2013&#39;s default prompt for creating Web Projects. Choose the &lt;b&gt;Empty &lt;/b&gt;template and check the &lt;b&gt;Web Forms&lt;/b&gt;&amp;nbsp;check box in the &lt;b&gt;Add folders and core reference for&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&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/AVvXsEiPYhrwdP75KI3ssvPiHXAl1RwBOhZ79945QV0r7OSyV2NrKuJK7WkMG1ctvFOHOmAS2Y-rcp2l87v91YgHS8pGrMJItS1i0rebO2gx8cPYO68SrBqjcMlzvJn7L1bEgcPN2J3e/s1600/00-ASPNET.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/AVvXsEiPYhrwdP75KI3ssvPiHXAl1RwBOhZ79945QV0r7OSyV2NrKuJK7WkMG1ctvFOHOmAS2Y-rcp2l87v91YgHS8pGrMJItS1i0rebO2gx8cPYO68SrBqjcMlzvJn7L1bEgcPN2J3e/s1600/00-ASPNET.png&quot; height=&quot;448&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Note: You may choose other predefined Visual Studio 2013 web templates if you wish.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Click &lt;b&gt;OK&lt;/b&gt; to complete the unfolding process. Once completed, the Layered Web Application solution is now ready for use.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&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/AVvXsEihWfvBuPcMknUomocPbHoGuJwNk3nZ1rIZArcACgQqoDxj7GPGyGuF2MZAfXey7btqU86tCAFT8NEp5nmpUM4jdK7E1Ekl8qGrWk_nOYcQEsTMPC8lbgHxanG3DuX0bAwMCCxJ/s1600/00-Finish.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/AVvXsEihWfvBuPcMknUomocPbHoGuJwNk3nZ1rIZArcACgQqoDxj7GPGyGuF2MZAfXey7btqU86tCAFT8NEp5nmpUM4jdK7E1Ekl8qGrWk_nOYcQEsTMPC8lbgHxanG3DuX0bAwMCCxJ/s1600/00-Finish.png&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Tip: All the relevant project references were automatically added between the projects for your convenience.&lt;br /&gt;
&lt;br /&gt;
Note: At this point of writing, LASG only supports English version of Visual Studio.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px;&quot;&gt;If you have not installed &lt;b&gt;Enterprise Library - Data Access Application Block&lt;/b&gt; on your machine, you may need to NuGet it. Right-click on the &lt;b&gt;Tutorial.Data&lt;/b&gt; project and select &lt;b&gt;Manage NuGet Packages...&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 10px;&quot;&gt;Search for&lt;i&gt; Enterprise Library&lt;/i&gt; and select the&lt;b&gt; Enterprise Library - Data Access Application Block&lt;/b&gt; package for installation.&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/AVvXsEhnFFlhYmlH9E9EnkmIxxlJRP3fcylr1LYcaVAolgVRc8bTZf6BZvCf3YLbv0IWa2Qi1wTd3A8_5W5dCD-gWw4BqCcjgwk7UNphSXXvBq3qECHwZzRTyik3dCXxTgkTUyKJ5XDU/s1600/00-Nuget.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/AVvXsEhnFFlhYmlH9E9EnkmIxxlJRP3fcylr1LYcaVAolgVRc8bTZf6BZvCf3YLbv0IWa2Qi1wTd3A8_5W5dCD-gWw4BqCcjgwk7UNphSXXvBq3qECHwZzRTyik3dCXxTgkTUyKJ5XDU/s1600/00-Nuget.png&quot; height=&quot;426&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
We have basically gone through the simple steps of unfolding a layered web application using LASG.&lt;br /&gt;
&lt;br /&gt;
If you would like to learn more about Layered Architecture concepts, please visit the following links:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2013/06/layered-architecture-for-net.html&quot;&gt;Layered Architecture: Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2013/07/layered-applications-3-tier.html&quot;&gt;Layered Architecture: Deployment Strategies&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/applied-technologies-in-layered.html&quot;&gt;Layered Architecture: Applied Technologies&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/layered-architecture-components.html&quot;&gt;Layered Architecture: Component Interactions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Coming up next - &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/03/lasg-creating-entities.html&quot;&gt;How-To: Create Entities with Inertia in LASG&lt;/a&gt;.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/7760583007484769616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/7760583007484769616' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7760583007484769616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/7760583007484769616'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/02/lasg-getting-started.html' title='How-To: Get Started with LASG'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEioDYJcjbJftrbnqwelQyP3kadnTjlbOz_v6CsrMi0ViWyWMhxvKRwyOrHpEPbeAP9L_kv5CSVEq_vGKUx8nCWNOWMOqSANESAu4OfYHWOEPtWZ6pijKerO7CsHKVVhr0YJEhx1/s72-c/00-Project+Dialog.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-6571696855745085700</id><published>2014-02-24T16:35:00.002+08:00</published><updated>2014-02-25T08:46:51.759+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="Code"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="Layered Architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="N-tier"/><title type='text'>Runtime Caching with SqlChangeMonitor</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
I was looking for a cache solution similar to the one provided by &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.caching(v=vs.110).aspx&quot;&gt;System.Web.Caching&lt;/a&gt; for my services layer and I was introduced to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.runtime.caching(v=vs.110).aspx&quot;&gt;System.Runtime.Caching&lt;/a&gt; by my &lt;a href=&quot;http://sylvester-lee.blogspot.com/&quot;&gt;associate&lt;/a&gt; (after he completed the &lt;a href=&quot;http://sylvester-lee.blogspot.com/2014/02/appfabric-caching.html&quot;&gt;research assignment&lt;/a&gt; which I gave him that is ;p ). New in .NET 4, System.Runtime.Caching provides an easy to use cache solution for non-ASP.NET Web applications and is just what I needed.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Sometime back I talked about &lt;a href=&quot;http://serena-yeoh.blogspot.com/2013/05/query-notifications-sqldependency.html&quot;&gt;Query Notifications &amp;amp; SqlDependency&lt;/a&gt;. Now, I&#39;m &lt;i&gt;gonna &lt;/i&gt;do something similar but I will attempt to wire-up a SqlDependency to the SqlChangeMonitor to allow our cache data to be auto-refreshed when there are changes to the database table. This is useful for caching reference data for services that are built on WCF (or WEB API).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I will show it with a very rough code example. Please refactor it to your needs.&lt;br /&gt;
&lt;br /&gt;
Start by declaring a few global variables.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;MemoryCache&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; _cache;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;SqlChangeMonitor&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; _monitor;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;SqlDependency&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; _dependency&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; line-height: 107%;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas; line-height: 107%;&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt; _hasDataChanged;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The static &lt;b&gt;MemoryCache &lt;/b&gt;variable is defined for coding convenience so that we don&#39;t have to keep referring to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;MemoryCache.Default&lt;/span&gt; all the time.&lt;br /&gt;
&lt;br /&gt;
At the constructor of the class, initialize the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;_cache&lt;/span&gt; and call the &lt;b&gt;SqlDependency.Start() &lt;/b&gt;method.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;_cache
= &lt;/span&gt;&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; font-size: 12.0pt; mso-highlight: white;&quot;&gt;MemoryCache&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;.Default;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background: white; color: #2b91af; font-family: Consolas; font-size: 12.0pt; line-height: 107%; mso-highlight: white;&quot;&gt;SqlDependency&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt; line-height: 107%;&quot;&gt;.Start(&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt; line-height: 107%;&quot;&gt;CONNECTION_STRING);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
Next, create the main function that loads the data into a &lt;b&gt;CacheItem&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;CacheItem&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; LoadData(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;CacheItemPolicy&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; policy)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; SQL_STATEMENT = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;SELECT
[ID], [Data] FROM dbo.TestData&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;data = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; db = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;SqlDatabase&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas; font-size: 16px; line-height: 17.1200008392334px;&quot;&gt;CONNECTION_STRING&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbCommand&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; cmd = db.GetSqlStringCommand(SQL_STATEMENT))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Initialize SqlDependency&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;_dependency = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;SqlDependency&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;(cmd &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;SqlCommand&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;_dependency.OnChange +=
dependency_OnChange;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;IDataReader&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; dr = db.ExecuteReader(cmd))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (dr.Read())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Create a new TestData&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;testData = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Read values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; testData.ID = GetDataValue&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;gt;(dr, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;ID&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; testData.Data =
GetDataValue&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;gt;(dr, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;Data&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Add to List.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; data.Add(testData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Create a new monitor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;_monitor = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;SqlChangeMonitor&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;(_dependency);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;// Create
a policy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;policy = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;CacheItemPolicy&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;policy.ChangeMonitors.Add(_monitor);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;policy.UpdateCallback =
CacheUpdateCallback;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;// Put
results into Cache Item.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; item = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;CacheItem&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&quot;TestData&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;, data);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;// Reset
the data changed flag.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _hasDataChanged = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; item;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;}&lt;span style=&quot;font-size: small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Few things to note in this code-snippet:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;CONNECTION_STRING&lt;/span&gt;&amp;nbsp;is a constant I defined for my connection string and its value is not shown in this example.&lt;/li&gt;
&lt;li&gt;I&#39;m using &lt;b&gt;Enterprise Library Data Access Application Block (DAAB)&lt;/b&gt; but you can use standard ADO.NET.&lt;/li&gt;
&lt;li&gt;I&#39;m loading the data into an Entity called &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; &lt;/span&gt;&lt;/b&gt;with a custom &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;GetDataValue&lt;t&gt;&lt;/t&gt;&lt;/span&gt;&lt;/b&gt; method that checks for null before assigning the values.&lt;/li&gt;
&lt;li&gt;I&#39;m using a hard-coded SQL statement but you can change it to a stored procedure if you wish.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
In the example, we pass the command into a new&amp;nbsp;&lt;b&gt;SqlDependency &lt;/b&gt;instance after creating it and subscribe to the &lt;b&gt;OnChange &lt;/b&gt;event. After loading the data, we create a new &lt;b&gt;SqlChangeMonitor &lt;/b&gt;and pass in the SqlDependency instance to its constructor. We then create a new &lt;b&gt;CacheItemPolicy &lt;/b&gt;and add the SqlChangeMonitor to its &lt;b&gt;ChangeMonitors &lt;/b&gt;collection. Next, we register to the &lt;b&gt;UpdateCallback &lt;/b&gt;and create a new &lt;b&gt;CacheItem &lt;/b&gt;to store the data. Finally, we set the &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;_hasDataChanged&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; &lt;/span&gt;&lt;/b&gt;flag to false before returning the CacheItem.&lt;br /&gt;
&lt;br /&gt;
The OnChange event doesn&#39;t really do much other than setting the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;_hasDataChanged&lt;/span&gt; flag to true when there is a change in the TestData table.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; dependency_OnChange(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; sender, &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;SqlNotificationEventArgs&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
DataChange Detection&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _hasDataChanged = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
The &lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;CacheUpdateCallback&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; &lt;/span&gt;&lt;/b&gt;method contains a little more code to refresh the cache item in memory.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; CacheUpdateCallback(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;CacheEntryUpdateArguments&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Dispose of monitor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (_monitor != &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _monitor.Dispose();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Disconnect event to prevent recursion.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _dependency.OnChange -=
dependency_OnChange;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Refresh the cache if tracking data changes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (_hasDataChanged)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Refresh the cache item.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; color: #2b91af; font-family: Consolas;&quot;&gt;CacheItemPolicy&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt; policy;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;args.UpdatedCacheItem = LoadData(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt; policy);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;args.UpdatedCacheItemPolicy = policy;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
The &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;_monitor&lt;/span&gt; and the OnChange event subscription will be cleaned up in this method and the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;_hasDataChanged&lt;/span&gt; flag is checked to see if the items in cache should be refreshed. Without doing this, the data in the cache will be invalidated and reset to null.&lt;br /&gt;
&lt;br /&gt;
Finally, the method that we want to expose out to callers to call will be like the following:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;gt; Select()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (_cache[&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;TestData&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;] == &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a policy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CacheItemPolicy&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; policy = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Load data into Cache Item.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; item =
LoadData(&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;
policy);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set Cache Item into cache with the
policy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt; _cache.Set(item, policy);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; _cache[&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;TestData&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
The method first checks the cache for any data and if none is available, it will query the database for it and sets it to the cache. If the data is available, it will be retrieved directly from the cache.&lt;br /&gt;
&lt;br /&gt;
I hope this post is useful to you. Please make sure that you follow the rules and guidelines of SQL Server Service Broker (i.e.&amp;nbsp;&lt;span style=&quot;background-color: white; color: #2a2a2a; font-family: monospace; font-size: 13px; line-height: 18px; text-align: justify;&quot;&gt;ALTER DATABASE LeaveSample SET ENABLE_BROKER&lt;/span&gt;) and &lt;a href=&quot;http://msdn.microsoft.com/library/ms181122.aspx&quot;&gt;Query Notifications&lt;/a&gt; to get it working. :)&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/6571696855745085700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/6571696855745085700' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/6571696855745085700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/6571696855745085700'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/02/runtime-caching-with-sqlchangemonitor.html' title='Runtime Caching with SqlChangeMonitor'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-4287251160775064006</id><published>2014-02-14T21:55:00.000+08:00</published><updated>2014-02-18T09:57:55.377+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Development"/><title type='text'>Entity Framework 6 vs EL6 DAAB Performance - Rematched</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
After I published the benchmark results for&amp;nbsp;&lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/02/entity-framework-vs-el-daab-performance.html&quot;&gt;&lt;b&gt;Entity Framework (EF) vs. DAAB&lt;/b&gt;&lt;/a&gt;, I was asked to verify whether the performance of EF can be improved by using &lt;b&gt;Stored Procedures (SP)&lt;/b&gt;. Logically speaking, using SP may help improve performance, but it should improve for both frameworks and not favour one over the other. Meaning if DAAB is shown to be faster than EF, any tuning on the database side should not be able to make EF faster than DAAB - at best, it can only make EF perform better than its own previous results.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To make sure there are no stones unturned, I have decided to do a rematch of the performance testing using the same methods and machine specifications from the &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/02/entity-framework-vs-el-daab-performance.html&quot;&gt;previous&lt;/a&gt;&amp;nbsp;test. The only differences are the code have all been converted to use Stored Procedures.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Here&#39;s a code snippet for one of the methods used in the DAAB code that has been converted to use SP:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; SelectById(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leaveID)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; SQL_STATEMENT = &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;GetLeaveById&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leave = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Connect to database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Database&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; db = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DatabaseFactory&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.CreateDatabase(CONNECTION_NAME);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbCommand&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; cmd = db.&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; font-family: Consolas;&quot;&gt;GetStoredProcCommand&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;(SQL_STATEMENT))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@LeaveID&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.Int64, leaveID);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;IDataReader&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; dr = db.ExecuteReader(cmd))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (dr.Read())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Create a new Leave&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&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;&amp;nbsp;&amp;nbsp; leave = LoadLeave(dr);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leave;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
And here&#39;s the equivalent method in EF:&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; SelectById(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leaveID)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; db = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbContext&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;(CONNECTION_NAME))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; paramLeaveID = CreateParameter(&lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;LeaveID&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;.Int64, leaveID);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; result = db.Database.SqlQuery&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;GetLeaveById @LeaveID&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;paramLeaveID).ToList&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; leave = result.Count &amp;gt; 0 ? result[0] : &lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;null&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Return result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt; leave;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
All the SPs were imported and mapped in the EF Model.&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/AVvXsEjCfud12MEiNijGpTZPBTvfIMpipyh_UAeQS5xeUM49h8o3E6xKS2pB-E6eTG7_BPIdDyb17zxTKfgGJokIllWgEMGG6XXUDyZ6NyUENGUmKP_PoJqZ_pTEqZBpucb3uAxvanNN/s1600/EF-Model.jpg&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/AVvXsEjCfud12MEiNijGpTZPBTvfIMpipyh_UAeQS5xeUM49h8o3E6xKS2pB-E6eTG7_BPIdDyb17zxTKfgGJokIllWgEMGG6XXUDyZ6NyUENGUmKP_PoJqZ_pTEqZBpucb3uAxvanNN/s1600/EF-Model.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
I was also tipped-off by some friends who have experience in EF to try to have these settings set to improvement performance.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;db.Configuration.LazyLoadingEnabled
= &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; font-size: 12.0pt; mso-highlight: white;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;db.Configuration.AutoDetectChangesEnabled
= &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; font-size: 12.0pt; mso-highlight: white;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt; line-height: 107%;&quot;&gt;db.Configuration.ValidateOnSaveEnabled
= &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: Consolas; font-size: 12.0pt; line-height: 107%; mso-highlight: white;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 12pt; line-height: 107%;&quot;&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
However, they don&#39;t make much difference because the Entities that were used are &lt;b&gt;Plain-Old-CLR-Objects (POCO)&lt;/b&gt; so change-tracking is not available, and they are not linked by navigation properties, so lazy-loading won&#39;t kick-in.&lt;br /&gt;
&lt;br /&gt;
Now let the rematch begin.&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Unit Test: Single Run&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The &lt;b&gt;ApplyThenApproveTest&lt;/b&gt; unit test method was chosen again for the test and the results are:&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/AVvXsEiGK0bhBKr3Sr6rDXDdgLouv5etL7g1oeMmYGHvNttEeCQgHePpqrJN4y_Wq26uBdLWaYYd7UFX6wArTGqUqm94F0FTMKU9x8rksSWg8ij2jAO-xCHrBOs7OSbr7rhGGyTnLTOi/s1600/EF-SP.jpg&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/AVvXsEiGK0bhBKr3Sr6rDXDdgLouv5etL7g1oeMmYGHvNttEeCQgHePpqrJN4y_Wq26uBdLWaYYd7UFX6wArTGqUqm94F0FTMKU9x8rksSWg8ij2jAO-xCHrBOs7OSbr7rhGGyTnLTOi/s1600/EF-SP.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Method using&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Entity Framework 6.0.2&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;took&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;168 ms&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;to complete 1 transaction.&lt;/span&gt;&lt;/div&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/AVvXsEgJ7W3a4Bt2aHCOd6v0xXtctVKrdp3wOD-1Lzl2SN_NR3GBNtQFEY3n7mEGxWPwCJ3OMBeE4i3uEn662fYCzfnKn8cMkDIV9dC-CuYqobyBV1qUHnU0ZZeP9WmhuSlwBtihTC07/s1600/DAAB-SP.jpg&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/AVvXsEgJ7W3a4Bt2aHCOd6v0xXtctVKrdp3wOD-1Lzl2SN_NR3GBNtQFEY3n7mEGxWPwCJ3OMBeE4i3uEn662fYCzfnKn8cMkDIV9dC-CuYqobyBV1qUHnU0ZZeP9WmhuSlwBtihTC07/s1600/DAAB-SP.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Method using&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;took&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;137 ms&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;to complete 1 transaction.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; font-size: 14px; line-height: 19.600000381469727px; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: center;&quot;&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;Looks like the performance of EF has indeed been improved a little with SP but the performance of DAAB has dropped slightly. Nevertheless, the performance gap between EF and DAAB is almost consistent compared to the previous non-SP test.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Unit Test: Looping in 1000&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
Let&#39;s see how both of them fair in loops.&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/AVvXsEhTU-4r9s-QdAPQFHPFKhl1FNfrFF9MbyxvDTWeCG1PWkp1hOM39Tg0_rfFxpg_ZBJXHdSqFl0TJLFgGh5uAB5a8cxF11uKwXxEeQQBjMKL-xB_LiXzznKmA5uRbXRWN7Vxy9IB/s1600/EF-Loop.jpg&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/AVvXsEhTU-4r9s-QdAPQFHPFKhl1FNfrFF9MbyxvDTWeCG1PWkp1hOM39Tg0_rfFxpg_ZBJXHdSqFl0TJLFgGh5uAB5a8cxF11uKwXxEeQQBjMKL-xB_LiXzznKmA5uRbXRWN7Vxy9IB/s1600/EF-Loop.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Method using&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Entity Framework 6.0.2&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;took&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;46 secs&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;to complete 1000 transactions.&lt;/span&gt;&lt;/div&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/AVvXsEhKyapsMhYtMJJZgIZxRkwTjEpj6nNAi1XIC8-FhxF7T3_re2Ajw9-VSw-JkfuHDDu9VyWmIdd0GZJFRKDWvo8T9qItuiqVpojOBfSkZgJQkACqkqHpp5uei9mhPSJ9L2fnH6Yv/s1600/DAAB-Loop.jpg&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/AVvXsEhKyapsMhYtMJJZgIZxRkwTjEpj6nNAi1XIC8-FhxF7T3_re2Ajw9-VSw-JkfuHDDu9VyWmIdd0GZJFRKDWvo8T9qItuiqVpojOBfSkZgJQkACqkqHpp5uei9mhPSJ9L2fnH6Yv/s1600/DAAB-Loop.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Method using&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;took&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;32 secs&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;to complete 1000 transactions.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Once again the results show that EF performs slower than DAAB and both seems to be 2 secs slower than their previous non-SP results.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Instrumented Performance and Diagnostics Profiler&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Let&#39;s dig into the profiler and see some results:&lt;/div&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/AVvXsEg8gMKfjAmmxx8DdDQneLAKxArs7HGQJuvUN3gDj5AGoDLgOs-XQxflR0AcD91A96v_YPdH6hIu9nav7kjIsMMbcXFrDTofTxntYStRTGbErs0EobDpyfee_g4ZYmRWN0guRvFG/s1600/EF-Perf.jpg&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/AVvXsEg8gMKfjAmmxx8DdDQneLAKxArs7HGQJuvUN3gDj5AGoDLgOs-XQxflR0AcD91A96v_YPdH6hIu9nav7kjIsMMbcXFrDTofTxntYStRTGbErs0EobDpyfee_g4ZYmRWN0guRvFG/s1600/EF-Perf.jpg&quot; height=&quot;350&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; margin: 0px; outline: none; padding: 0px; text-align: center;&quot;&gt;
&lt;b style=&quot;text-align: left;&quot;&gt;Create&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;method in data layer for&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;text-align: left;&quot;&gt;Entity Framework 6.0.2&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;took an &amp;nbsp;Avg. Elapse Time of&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;1,299.91&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;text-align: left;&quot;&gt;. The EF methods&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;text-align: left;&quot;&gt;DbContext.SaveChanges()&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;took Avg. Elapse Time of&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;1,133.98&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;text-align: left;&quot;&gt;DbSet.Add()&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;took&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;150.57&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;text-align: left;&quot;&gt;.&lt;/span&gt;&lt;/div&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/AVvXsEhEtr58n3t3mYT8FdnbLWCteIbe2wfre8qgQoFH4MN475dytvdNs2m6EsyQt-7ceFmvp_0vQzPlQa7eVVrMB_yJ6ZlCHbfWDH6jEmuaFyM0sPFs_-vGRWV8x-laidNU_LdE3ayi/s1600/DAAB-Perf.jpg&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/AVvXsEhEtr58n3t3mYT8FdnbLWCteIbe2wfre8qgQoFH4MN475dytvdNs2m6EsyQt-7ceFmvp_0vQzPlQa7eVVrMB_yJ6ZlCHbfWDH6jEmuaFyM0sPFs_-vGRWV8x-laidNU_LdE3ayi/s1600/DAAB-Perf.jpg&quot; height=&quot;350&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; margin: 0px; outline: none; padding: 0px; text-align: center;&quot;&gt;
&lt;b style=&quot;text-align: left;&quot;&gt;Create&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;method in data layer for&amp;nbsp;&lt;/span&gt;&lt;b&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;took an Avg. Elapse Time of&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;23.06&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;text-align: left;&quot;&gt;. The DAAB methods&lt;/span&gt;&lt;b style=&quot;text-align: left;&quot;&gt;&amp;nbsp;Database.ExecuteScalar()&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;took Avg. Elapse Time of&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;19.71.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Strangely, it shows that both EF and DAAB takes longer when SPs are used (could this be due to the extra processing needed to map to SPs internally?). From the call tree we can observe that EF is still slower than DAAB.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Load Test&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now for the grand finale! Let&#39;s see how they perform in load testing.&lt;/div&gt;
&lt;div&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/AVvXsEjf2OcMb32y3oETkezsQpIF4ysS1C831ZQAJTA_TCm0fcwR9KaR8Vs1XsziwP68FjYKcrKah2cJ6e2yga37e0_iZxbPa60e26wYyX7ZeDf7woW9TzhjCP4ShdYcMEenLZr90vzg/s1600/EF-Load.jpg&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/AVvXsEjf2OcMb32y3oETkezsQpIF4ysS1C831ZQAJTA_TCm0fcwR9KaR8Vs1XsziwP68FjYKcrKah2cJ6e2yga37e0_iZxbPa60e26wYyX7ZeDf7woW9TzhjCP4ShdYcMEenLZr90vzg/s1600/EF-Load.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Entity Framework 6.0.2&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;completed with&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;&lt;i&gt;6945&amp;nbsp;&lt;/i&gt;&lt;/span&gt;Total Test runs with an Avg. Test Time of&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;0.84 sec&lt;/span&gt;&lt;/i&gt;&amp;nbsp;and gave&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;0&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;errors.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&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/AVvXsEhrClXqi5Rb8jZk3PekvvrW6-svKiXyHLNVAoI0h7gdkivbvecroxX7jPDmMrgl6NpG-F-4Ut3GUkTFkhEd1st1K0If7ae_J2EDhnEyAI5IWjTD5IljC-5dZUtQRAmBmmTLrgDO/s1600/DAAB-Load.jpg&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/AVvXsEhrClXqi5Rb8jZk3PekvvrW6-svKiXyHLNVAoI0h7gdkivbvecroxX7jPDmMrgl6NpG-F-4Ut3GUkTFkhEd1st1K0If7ae_J2EDhnEyAI5IWjTD5IljC-5dZUtQRAmBmmTLrgDO/s1600/DAAB-Load.jpg&quot; height=&quot;438&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Enterprise Library 6.0 DAAB&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;completed with&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;i&gt;7310&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;Total Test runs with an Avg. Test Time of&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;0.79 sec&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;&amp;nbsp;and gave&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;0&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px; text-align: left;&quot;&gt;errors.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Unlike the previous non-SP test, EF runs more stable this time and produces no errors under high load. Because of that, its performance has also been able to almost match the new results for DAAB. This could be due to the more optimized SQL statements which are used in the SPs as opposed to the ones auto-generated by EF&#39;s engine. The performance of DAAB somewhat fell when using SPs.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Behind The Scene&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Let&#39;s take a look at what&#39;s going on behind the scene.&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/AVvXsEgiDEPK8JEaD2GfafAOBBK5rLi8cqyB8F0JVzN3gANWltRSM5uV2CxfLcQ5TX2CvO432RNOn4R9Q-dAwWORPMBEWRkQAr8xDQ3ROMLKJcsnU8qb-cz0y8YfbmTC5upGvj8dXd_n/s1600/EF-Insert.jpg&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/AVvXsEgiDEPK8JEaD2GfafAOBBK5rLi8cqyB8F0JVzN3gANWltRSM5uV2CxfLcQ5TX2CvO432RNOn4R9Q-dAwWORPMBEWRkQAr8xDQ3ROMLKJcsnU8qb-cz0y8YfbmTC5upGvj8dXd_n/s1600/EF-Insert.jpg&quot; height=&quot;274&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;INSERT operation using Stored Procedure using&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Entity Framework 6.0.2&lt;/b&gt;&lt;/div&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/AVvXsEhMxus6R0cIQPtKQlcswc_GqGaCinwhaD9yu1m1J-MU-9YkDCFbhjVtkrynePiAD2D5z2t8tyfTGqS30ml8k6vDZ0JG889R_kZgPv7DVa1se6GATuLGJnHMXVNU8hEQVHMJjsy0/s1600/DAAB-Insert.jpg&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/AVvXsEhMxus6R0cIQPtKQlcswc_GqGaCinwhaD9yu1m1J-MU-9YkDCFbhjVtkrynePiAD2D5z2t8tyfTGqS30ml8k6vDZ0JG889R_kZgPv7DVa1se6GATuLGJnHMXVNU8hEQVHMJjsy0/s1600/DAAB-Insert.jpg&quot; height=&quot;274&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;INSERT operation using Stored Procedure using&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&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/AVvXsEjqKpjMV0kiDNHNUCbRjUzTc4v6CTnpfpV95hiywTWvC8lOwQGIkV6SAsaa9GwoxOJfzYLi-7W_zGFiJPkkziCtoRyQn23uE6xkJgQhu7XoI3SQi8tFylo9MJ-BWamGNNQRNM0p/s1600/EF-Query.jpg&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/AVvXsEjqKpjMV0kiDNHNUCbRjUzTc4v6CTnpfpV95hiywTWvC8lOwQGIkV6SAsaa9GwoxOJfzYLi-7W_zGFiJPkkziCtoRyQn23uE6xkJgQhu7XoI3SQi8tFylo9MJ-BWamGNNQRNM0p/s1600/EF-Query.jpg&quot; height=&quot;274&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;SELECT operation using Stored Procedure using&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;Entity Framework 6.0.2&lt;/b&gt;&lt;/div&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/AVvXsEjInq1U-bdN9Qf4lQyWZv2uVtWDixK0RyhVax3hHnWdvz4OenUvKwSi1PoIV3p8JzCnrY8FmTidqNAPhjNyOIwWNDUoZQX5h7P3dD_bqUGO67U6RdNRKgon0oVZAlFrA9fszIvg/s1600/DAAB-Query.jpg&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/AVvXsEjInq1U-bdN9Qf4lQyWZv2uVtWDixK0RyhVax3hHnWdvz4OenUvKwSi1PoIV3p8JzCnrY8FmTidqNAPhjNyOIwWNDUoZQX5h7P3dD_bqUGO67U6RdNRKgon0oVZAlFrA9fszIvg/s1600/DAAB-Query.jpg&quot; height=&quot;274&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;SELECT operation using Stored Procedure&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;&amp;nbsp;using&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
From &lt;b&gt;SQL Server Profiler&lt;/b&gt;, we can see that both EF and DAAB now use the specified stored procedures to perform their operations. Curiously, EF still uses sp_executesql for the queries but you can see that it is no longer using the verbose auto-generated SQL statements previously.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
It is common for us to think that using Stored Procedures (SP) may help improve the performance of our applications but it seems that RDBMS have came a long way and have evolved tremendously in providing us with the required performance. It should be noted that both native ADO.NET and EF uses &lt;a href=&quot;http://technet.microsoft.com/en-us/library/ms175170(v=sql.105).aspx&quot;&gt;sp_executesql&lt;/a&gt; internally which provides us the safety of preventing SQL-injection attacks (when used with named parameters) and cached execution plans. While sp_executesql can also be tuned further, it is suffice for general purpose usage.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The results in this rematch may not be able to prove that EF could perform better than DAAB by employing SPs but it does prove that EF is more stable and provides better query performance with properly written SPs. The only challenge I experienced is the rigid nature of SPs which makes it difficult to accommodate EF&#39;s dynamic nature i.e. difficult to support dynamic column sorting and parameter filtering, and I would certainly not encourage constructing dynamic SQL inside SPs.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
For now, I will still need to stick with DAAB.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;Disclaimer: The results are based on my own research and it is just a simple benchmark for EF and DAAB. It is not about performance tuning. If you are unhappy with the results, I would urge that you conduct your own tests in your own environment for verification. You never know, some things work differently in different environments.&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/4287251160775064006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/4287251160775064006' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/4287251160775064006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/4287251160775064006'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/02/entity-framework-6-vs-el6-daab.html' title='Entity Framework 6 vs EL6 DAAB Performance - Rematched'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEjCfud12MEiNijGpTZPBTvfIMpipyh_UAeQS5xeUM49h8o3E6xKS2pB-E6eTG7_BPIdDyb17zxTKfgGJokIllWgEMGG6XXUDyZ6NyUENGUmKP_PoJqZ_pTEqZBpucb3uAxvanNN/s72-c/EF-Model.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7549567.post-8216748586914450920</id><published>2014-02-10T17:04:00.002+08:00</published><updated>2014-02-11T20:41:00.746+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="3-tier"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Developer Community"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Development"/><title type='text'>Entity Framework 6 vs. EL6 DAAB Performance</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
Lately, I have encountered several questions regarding the performance of &lt;b&gt;Entity Framework (EF)&lt;/b&gt;. I have been conducting feasibility study on EF since version 4.0 and followed through several versions but every time I see the performance results, I was not convinced to use it. But I can see performance improvements in every new version. Wanting to satisfy my curiosity and also to update my impressions towards EF, I have thought to conduct another round of performance test on it.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I realized that not only have I built an arsenal of&amp;nbsp;&lt;a href=&quot;https://layersample.codeplex.com/&quot;&gt;samples&lt;/a&gt;&amp;nbsp;but I have also created an avenue to use those samples for performance testing (all thanks to my Associate who reminded me by always &lt;strike&gt;playing with&lt;/strike&gt; using the samples in demos and test runs). For the showdown, I will pit the&amp;nbsp;&lt;a href=&quot;https://layersample.codeplex.com/releases&quot;&gt;ASPNET-WCF-EF&lt;/a&gt;&amp;nbsp;sample against the&amp;nbsp;&lt;a href=&quot;https://layersample.codeplex.com/releases&quot;&gt;ASPNET-WCF-DAAB&lt;/a&gt; sample, since both uses &lt;b&gt;exactly the same code for all the layers but only differs in data access technology&lt;/b&gt; (all thanks to the swap-in-swap-out capability of &lt;a href=&quot;http://serena-yeoh.blogspot.com/2013/06/layered-architecture-for-net.html&quot;&gt;Layered Architecture&lt;/a&gt;).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;The Test Machine&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;ul style=&quot;background-color: white; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; outline: none; padding: 0px 0px 0px 2em; text-align: justify;&quot;&gt;
&lt;li style=&quot;margin: 0px; outline: none; padding: 0px;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Windows Server 2012 R2 x64&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; outline: none; padding: 0px;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Intel Core i7-4800MQ CPU 2.7GHz (Quad Core HT)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; outline: none; padding: 0px;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: Arimo;&quot;&gt;&lt;span style=&quot;line-height: 19.600000381469727px;&quot;&gt;16 GB RAM&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; outline: none; padding: 0px;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: Arimo;&quot;&gt;&lt;span style=&quot;line-height: 19.600000381469727px;&quot;&gt;500 GB Solid-State Hybrid Drive&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; outline: none; padding: 0px;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: Arimo; line-height: 19.600000381469727px;&quot;&gt;Visual Studio 2013 Ultimate Update 1&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #333333; font-family: Arimo;&quot;&gt;Microsoft SQL Server 2012 x64&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Preparation&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To make use of the samples for the performance tests, few changes had to be made to both sets of code.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;1. Disabling IsOverlap Check in Business Component&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The samples contain an IsOverlap business logic check to prevent duplicate records from being inserted into the Leaves table. This will cause the unit tests to fail if high volume of test data were induced into it. To allow the application to continue to run even with overlaps, I commented out the line where the exception is thrown. You can locate the line of code in the &lt;b&gt;Apply &lt;/b&gt;method of the &lt;b&gt;LeaveComponent.cs&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Check for overlapping leaves.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (leaveDAC.IsOverlap(leave))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;//throw
new ApplicationException(&quot;Date range is overlapping with another
leave.&quot;);&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This will allow the query to continue to run but the exception will be suppressed.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;2. Disable Enable Edit and Continue&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Enable Edit and Continue&lt;/b&gt;&amp;nbsp;needs to be disabled in the &lt;b&gt;LeaveSample.Hosts.Web&lt;/b&gt; project to allow it to be running (See &lt;a href=&quot;http://serena-yeoh.blogspot.com/2014/01/new-iis-express-behavior-in-vs-2013.html&quot;&gt;here&lt;/a&gt; for details) for the test. Alternatively, you can publish it to IIS if you want. For this test, I&#39;m using the default IIS Express.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEjnkPKM54XZ06g90q19mPJGdNuX4oz9o8Nxmt_TtAAzPqS57VqAzWF3cLNnSMDuv-TxYmeLx1Hjq85KhwLV3pxByQX1M2H0UJYCChusiKzdx3EQ4LDHQ0yqtlTvQAQJaX457KJj/s1600/Host-Settings.jpg&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/AVvXsEjnkPKM54XZ06g90q19mPJGdNuX4oz9o8Nxmt_TtAAzPqS57VqAzWF3cLNnSMDuv-TxYmeLx1Hjq85KhwLV3pxByQX1M2H0UJYCChusiKzdx3EQ4LDHQ0yqtlTvQAQJaX457KJj/s1600/Host-Settings.jpg&quot; height=&quot;596&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
With this done, we can start the&amp;nbsp;&lt;b&gt;LeaveSample.Hosts.Web&lt;/b&gt;&amp;nbsp;project in debug mode to launch the IIS Express instance and then close the browser that was launch. The Host will be running in the background.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Take note that this needs to be done for both samples and at any one time, only one of the samples can be opened and run in Visual Studio. This is to avoid any conflicts.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;A Glimpse of the Code&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In case you do not want to download the samples and wondering how the code looks like, basically, here are some code snippets to give you an idea. I will recommend you download the &lt;a href=&quot;http://layersample.codeplex.com/&quot;&gt;samples&lt;/a&gt; and play with it yourself.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The EF code looks like...&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; Create(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leave)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; db = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbContext&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;(CONNECTION_NAME))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.Set&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;gt;().Add(leave);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.SaveChanges();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leave;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
and the DAAB code looks like...&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: Consolas;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; Create(&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #2b91af; font-family: Consolas;&quot;&gt;Leave&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leave)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; SQL_STATEMENT =&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;INSERT
INTO dbo.Leaves ([CorrelationID], [Category], [Employee], [StartDate],
[EndDate], [Description], [Duration], [Status], [IsCompleted], [Remarks],
[DateSubmitted]) &quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; +&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;VALUES(@CorrelationID,
@Category, @Employee, @StartDate, @EndDate, @Description, @Duration, @Status,
@IsCompleted, @Remarks, @DateSubmitted); SELECT SCOPE_IDENTITY();&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;//
Connect to database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Database&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; db = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DatabaseFactory&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.CreateDatabase(CONNECTION_NAME);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbCommand&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; cmd = db.GetSqlStringCommand(SQL_STATEMENT))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;// Set
parameter values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@CorrelationID&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;,
&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.Guid,
leave.CorrelationID);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@Category&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.Byte,
leave.Category);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@Employee&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.AnsiString,
leave.Employee);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@StartDate&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.DateTime,
leave.StartDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@EndDate&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.DateTime,
leave.EndDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@Description&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;,
&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.AnsiString,
leave.Description);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@Duration&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.Byte,
leave.Duration);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@Status&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.Byte,
leave.Status);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@IsCompleted&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;,
&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.Boolean,
leave.IsCompleted);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@Remarks&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.AnsiString,
leave.Remarks);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.AddInParameter(cmd, &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #a31515; font-family: Consolas;&quot;&gt;&quot;@DateSubmitted&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;,
&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;DbType&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.DateTime,
leave.DateSubmitted);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: green; font-family: Consolas;&quot;&gt;// Get
the primary key value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; leave.LeaveID = &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #2b91af; font-family: Consolas;&quot;&gt;Convert&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;.ToInt64(db.ExecuteScalar(cmd));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: blue; font-family: Consolas;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Consolas;&quot;&gt; leave;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Consolas; line-height: 107%;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I know you are already screaming - &quot;Holy Cow!!!&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Unit Test: Single Run&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I noticed that the Unit Test in Visual Studio now provides execution times. This is very handy and I would like to take advantage of it. I chose the &lt;b&gt;ApplyThenApproveTest &lt;/b&gt;unit test method since it simulates a complete Apply and Approval of a leave transaction which should give a good mix of INSERTs and UPDATEs to multiple tables and SELECT operations.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Running a single unit test on each sample produces the following results:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEiNk0SYlRGDEAMYQ3Ubvx4yIUXyK30hJEerYAsb3cGdziTd1h-OBPz7YAdH0uOK_nPLE7y2tPjOGKr61TsxdlTBDmOu60Bn42fcZuS6lXggmWgW11mf5xat5aez-5CKtlv2lCsJ/s1600/EF-1.jpg&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/AVvXsEiNk0SYlRGDEAMYQ3Ubvx4yIUXyK30hJEerYAsb3cGdziTd1h-OBPz7YAdH0uOK_nPLE7y2tPjOGKr61TsxdlTBDmOu60Bn42fcZuS6lXggmWgW11mf5xat5aez-5CKtlv2lCsJ/s1600/EF-1.jpg&quot; height=&quot;416&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Method using &lt;b&gt;Entity Framework 6.0.2 &lt;/b&gt;took &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;171 ms&lt;/span&gt;&lt;/i&gt; to complete 1 transaction.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgsBBZiXUFf3JNrmU-a_8a_mglTb80Z0dhZk8rEnflIv9MmwuEvruRJZMES1gyou0Oba2tTGI1RTup9xsFrNEBZK3gLkeBuTgsJNMaaHVnN9mP2ygsCw20p_uByM-fE6vlESVkn/s1600/DAAB-1.jpg&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/AVvXsEgsBBZiXUFf3JNrmU-a_8a_mglTb80Z0dhZk8rEnflIv9MmwuEvruRJZMES1gyou0Oba2tTGI1RTup9xsFrNEBZK3gLkeBuTgsJNMaaHVnN9mP2ygsCw20p_uByM-fE6vlESVkn/s1600/DAAB-1.jpg&quot; height=&quot;452&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Method using&lt;b&gt; Enterprise Library 6.0 DAAB&lt;/b&gt;&amp;nbsp;took&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;139 ms&lt;/span&gt;&lt;/i&gt;&amp;nbsp;to complete 1 transaction.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Unit Test: Looping in 1000&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
That&#39;s pretty good for both since they completed in milliseconds. Let&#39;s raise the stake to loop 1000 times and see the results:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhPqilg-kjH0RvvuhPDFZ1uw1vxtnWywxp6nAqtQzWD3b2R9Md534B4wuBvuH6LLef2g0wcgUkEnVYKhlutfMq2IF3bMvf_r8xNufLLyUG5TY3ef5XhhrPkOQ9ZuGebNpZUMcua/s1600/EF.jpg&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/AVvXsEhPqilg-kjH0RvvuhPDFZ1uw1vxtnWywxp6nAqtQzWD3b2R9Md534B4wuBvuH6LLef2g0wcgUkEnVYKhlutfMq2IF3bMvf_r8xNufLLyUG5TY3ef5XhhrPkOQ9ZuGebNpZUMcua/s1600/EF.jpg&quot; height=&quot;452&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Method using &lt;b&gt;Entity Framework 6.0.2&lt;/b&gt; took &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;44 secs&lt;/span&gt;&lt;/i&gt; to complete 1000 transactions.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEiCUZ_7PotPaYtwMlbBx1W9JJMYTenrAAVFi-KT0_h3owvTVWSxnSrtWcr0CN78gybKKFdBhZpoOihnW8rX0lr72_V5JpjLe305H_G1IccQewsLR2mMy8caJo4IYzSqpknXB0jL/s1600/DAAB.jpg&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/AVvXsEiCUZ_7PotPaYtwMlbBx1W9JJMYTenrAAVFi-KT0_h3owvTVWSxnSrtWcr0CN78gybKKFdBhZpoOihnW8rX0lr72_V5JpjLe305H_G1IccQewsLR2mMy8caJo4IYzSqpknXB0jL/s1600/DAAB.jpg&quot; height=&quot;452&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Method using &lt;b&gt;Enterprise Library 6.0 DAAB&lt;/b&gt; took &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;30 secs&lt;/span&gt;&lt;/i&gt; to complete 1000 transactions.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Instrumented Performance and Diagnostics Profiler&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Let&#39;s dig slightly deeper to see the time breakdown. Visual Studio Ultimate comes with an awesome&amp;nbsp;&lt;b&gt;Performance and Diagnostics Profiler&lt;/b&gt;. I used&amp;nbsp;&lt;b&gt;Instrumented &lt;/b&gt;profiling on both the samples and here are the results from the web-server&#39;s perspective. The result is from web-server to database.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhUmAZLtmCV2nSz7eOu3KM60rswk-ULXLtyHGqa_ROhohUeDwIMYn5BhC94XdkYe1axI2Q-2GgtRZzX-weZFqeXRe7ZNAvW538mrNH9hGNgBWY8G2Tz9aD0ihJLofxSPouDQJXV/s1600/EF-Profiled.jpg&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/AVvXsEhUmAZLtmCV2nSz7eOu3KM60rswk-ULXLtyHGqa_ROhohUeDwIMYn5BhC94XdkYe1axI2Q-2GgtRZzX-weZFqeXRe7ZNAvW538mrNH9hGNgBWY8G2Tz9aD0ihJLofxSPouDQJXV/s1600/EF-Profiled.jpg&quot; height=&quot;350&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Apply method using&amp;nbsp;&lt;b style=&quot;text-align: center;&quot;&gt;Entity Framework 6.0.2 &lt;/b&gt;&lt;span style=&quot;text-align: center;&quot;&gt;took&amp;nbsp;&lt;/span&gt;an Average Elapse Time of&amp;nbsp;&lt;span style=&quot;text-align: center;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;1,124.97&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Extra observation: Querying took an Average Elapse Time of &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;2,937.66&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhiX0v7Skk6m7ujqrJeH8e0ltrmplZStGTYZ2AUsNuJALgmGEGiIuvMzb7oPrWDaBCAEdo9h2mfENTkzxoHYSELu0BomwQDO_VBq_c4eHMEtjvm-0R8UzI9XSNjvVStVVbryd9z/s1600/DAAB-Profiled.jpg&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/AVvXsEhiX0v7Skk6m7ujqrJeH8e0ltrmplZStGTYZ2AUsNuJALgmGEGiIuvMzb7oPrWDaBCAEdo9h2mfENTkzxoHYSELu0BomwQDO_VBq_c4eHMEtjvm-0R8UzI9XSNjvVStVVbryd9z/s1600/DAAB-Profiled.jpg&quot; height=&quot;350&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Apply method using&amp;nbsp;&lt;b&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;took&amp;nbsp;an Average Elapse Time of &lt;span style=&quot;color: red;&quot;&gt;&lt;i&gt;432.23&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Extra observation: Querying took an Average Elapse Time of&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;&lt;i&gt;861.90&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
And here are the detail breakdown of how much time it took for instrumenting only the app-server side. Results are from app-server to database:&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/AVvXsEjGZtTZoHMIdAYAt6VPWdAhSxDmXXwvDRt7ypKJ8iMFH5tJpagd5LlhQ6dn6BIfWjRbYNEsPprp0GXXpTnDRLKG7uI3R2PewDzWxv42SKkHLr0t6d3oBI9SbkFG5hU2g3NB4YOz/s1600/EF-depth.jpg&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/AVvXsEjGZtTZoHMIdAYAt6VPWdAhSxDmXXwvDRt7ypKJ8iMFH5tJpagd5LlhQ6dn6BIfWjRbYNEsPprp0GXXpTnDRLKG7uI3R2PewDzWxv42SKkHLr0t6d3oBI9SbkFG5hU2g3NB4YOz/s1600/EF-depth.jpg&quot; height=&quot;350&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Create&lt;/b&gt; method in data layer for &lt;b&gt;Entity Framework 6.0.2&lt;/b&gt; took an &amp;nbsp;Avg. Elapse Time of&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;517.30&lt;/span&gt;&lt;/i&gt;. The EF methods &lt;b&gt;DbContext.SaveChanges()&lt;/b&gt; took Avg. Elapse Time of&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;477.78&lt;/span&gt;&lt;/i&gt;&amp;nbsp;and &lt;b&gt;DbSet.Add()&lt;/b&gt; took&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;38.74&lt;/span&gt;&lt;/i&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEivWye0BXzQlPHyIX5d0ai108lHeVgTy9dsiGdJlex8yCrSdDo1lkZAc4pPY_oIym6oY3VHk1pGh7VLYxKPGDwf3KoQWv1GkOVeBnUSnTKgfp7GNiY8JYplouB6gFLlPbUSyE3I/s1600/DAAB-depth.jpg&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/AVvXsEivWye0BXzQlPHyIX5d0ai108lHeVgTy9dsiGdJlex8yCrSdDo1lkZAc4pPY_oIym6oY3VHk1pGh7VLYxKPGDwf3KoQWv1GkOVeBnUSnTKgfp7GNiY8JYplouB6gFLlPbUSyE3I/s1600/DAAB-depth.jpg&quot; height=&quot;350&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Create&lt;/b&gt;&amp;nbsp;method in data layer for&amp;nbsp;&lt;b style=&quot;text-align: center;&quot;&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&amp;nbsp;took an Avg. Elapse Time of&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;9.27&lt;/span&gt;&lt;/i&gt;. The DAAB methods&lt;b&gt;&amp;nbsp;Database.ExecuteScalar()&amp;nbsp;&lt;/b&gt;took Avg. Elapse Time of&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;4.96&lt;/span&gt;&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;DatabaseFactory.CreateDatabase()&lt;/b&gt;&amp;nbsp;took&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;0.02&lt;/span&gt;&lt;/i&gt;.&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
From the &lt;b&gt;Call Tree&lt;/b&gt; we can observe that the functions using DAAB is considerably faster than EF.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Load Test&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Finally, let&#39;s see how the two perform under load. I will use&amp;nbsp;&lt;b&gt;Visual Studio Load Test&lt;/b&gt; to load the single run &lt;b&gt;ApplyThenApproveTest &lt;/b&gt;unit test method. I will use a &lt;b&gt;constant load of 100 users&lt;/b&gt; and run the test for &lt;b&gt;1 minute&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgqUqfkWNj9B9kqSet7XZLlZEZMgAE8JU1Ytl1COaJaIjzLxuuJvw03RCMZoiV949AxC93K2NIxwUgbvqquYMJT9OpS3UMMueY3ts63P7gEL0S9zT1HAPhaRf9snyir87Xh2GT7/s1600/EF-Load.jpg&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/AVvXsEgqUqfkWNj9B9kqSet7XZLlZEZMgAE8JU1Ytl1COaJaIjzLxuuJvw03RCMZoiV949AxC93K2NIxwUgbvqquYMJT9OpS3UMMueY3ts63P7gEL0S9zT1HAPhaRf9snyir87Xh2GT7/s1600/EF-Load.jpg&quot; height=&quot;470&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;text-align: center;&quot;&gt;Entity Framework 6.0.2 &lt;/b&gt;&lt;span style=&quot;text-align: center;&quot;&gt;completed with &lt;span style=&quot;color: red;&quot;&gt;&lt;i&gt;1692 &lt;/i&gt;&lt;/span&gt;Total Test runs with an Avg. Test Time of &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;3.41 sec&lt;/span&gt;&lt;/i&gt; but it gave &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;154 &lt;/span&gt;&lt;/i&gt;errors. The error thrown was &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;An error occurred while reading from the store provider&#39;s data reader&#39;&lt;/span&gt;&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgvXGLNohTgpyOgoGOMrH6Q1X3G5VFUOdwy2tyTDWHnY5zYoOByv0L0RTaAdsrNAmTiqHkK1Kyb_wYWI4eW9khc7AbH_47s7TcDVJ-stEoUEMlLiWuv9WvrhlPASDANn5sk7PBK/s1600/DAAB-Load.jpg&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/AVvXsEgvXGLNohTgpyOgoGOMrH6Q1X3G5VFUOdwy2tyTDWHnY5zYoOByv0L0RTaAdsrNAmTiqHkK1Kyb_wYWI4eW9khc7AbH_47s7TcDVJ-stEoUEMlLiWuv9WvrhlPASDANn5sk7PBK/s1600/DAAB-Load.jpg&quot; height=&quot;468&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;text-align: center;&quot;&gt;Enterprise Library 6.0 DAAB&amp;nbsp;&lt;/b&gt;completed with &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;8236 &lt;/span&gt;&lt;/i&gt;Total Test runs with an Avg. Test Time of &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;0.70 sec&lt;/span&gt;&lt;/i&gt; and gave &lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;0 &lt;/span&gt;&lt;/i&gt;errors.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I was surprised (and concerned) by this result as it appears that EF may not be able to perform under high stressed load.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;What is Going On Behind The Scene?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Out of curiosity, I fired-up SQL Profiler to see what is being sent to the SQL Server.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEgXizxwEQtoTl7JQyVpbvMsjaYEnvsuOtUtVs7JGjeIHqQj9wEdRgITl9k_tKJy0g29MbQepRO_v7ToL9IR8LevDz8NmwRXRIJf2KcsragqmiLK5xE88YXUcgsJQ_S39PVJBtbD/s1600/EF-Insert.jpg&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/AVvXsEgXizxwEQtoTl7JQyVpbvMsjaYEnvsuOtUtVs7JGjeIHqQj9wEdRgITl9k_tKJy0g29MbQepRO_v7ToL9IR8LevDz8NmwRXRIJf2KcsragqmiLK5xE88YXUcgsJQ_S39PVJBtbD/s1600/EF-Insert.jpg&quot; height=&quot;472&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
INSERT statement generated by&amp;nbsp;&lt;b&gt;Entity Framework 6.0.2&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhOpnVuBOS5lzTFpTmFZUf6X5BzG-a8WWHRdXO4SoKd-rIj1brynwGntKoa-zp5z-FiVqvjSWjtQajhwNbi1raoNcCu7m91vvKaEFDI6TsleixQQeQ9aPETfyEO9FgZNG7GvfL8/s1600/DAAB-Insert.jpg&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/AVvXsEhOpnVuBOS5lzTFpTmFZUf6X5BzG-a8WWHRdXO4SoKd-rIj1brynwGntKoa-zp5z-FiVqvjSWjtQajhwNbi1raoNcCu7m91vvKaEFDI6TsleixQQeQ9aPETfyEO9FgZNG7GvfL8/s1600/DAAB-Insert.jpg&quot; height=&quot;472&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
INSERT statement going through&amp;nbsp;&lt;b style=&quot;text-align: center;&quot;&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEi-AlSxGMZ8fWdFKJ1O4MucoCwhu5MagziqXhjti4LHzWp89s97D8x9cS9sV6s_eqyZvctGnwTJ45qreX3z7HB4J_S9cME-5gbh12jv-20YUtq_izx2IBzK7QcZhxQl25oaZUA8/s1600/EF-Select.jpg&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/AVvXsEi-AlSxGMZ8fWdFKJ1O4MucoCwhu5MagziqXhjti4LHzWp89s97D8x9cS9sV6s_eqyZvctGnwTJ45qreX3z7HB4J_S9cME-5gbh12jv-20YUtq_izx2IBzK7QcZhxQl25oaZUA8/s1600/EF-Select.jpg&quot; height=&quot;588&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
SELECT statement with Paging generated by&lt;b&gt; Entity Framework 6.0.2&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhBNB3OUIW5wHTTSCb1x1J0PvNV3LPlwjJAz6PpAvpMh1lp8Fwd0fzT79SJ3VOjL9X-A4d1f6ctDewWxK5KPMlyx8Bl_jD-Ur6Z5tj8ZR45pClyB8bikrpYDVZb-jSoIXyHyd3s/s1600/DAAB-Select.jpg&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/AVvXsEhBNB3OUIW5wHTTSCb1x1J0PvNV3LPlwjJAz6PpAvpMh1lp8Fwd0fzT79SJ3VOjL9X-A4d1f6ctDewWxK5KPMlyx8Bl_jD-Ur6Z5tj8ZR45pClyB8bikrpYDVZb-jSoIXyHyd3s/s1600/DAAB-Select.jpg&quot; height=&quot;472&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Custom Paging SELECT statement going through&amp;nbsp;&lt;b style=&quot;text-align: center;&quot;&gt;Enterprise Library 6.0 DAAB&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Summary and Wrap Up&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
From the performance test results it clearly shows that Entity Framework is still not as efficient as wrapper libraries such as DAAB which uses native ADO.NET. However, EF does make code a lot more easier to read and a lot less to write. The load test findings do raise some concerns for high performance applications that requires high concurrency.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Because of these findings, I would have to skip EF implementation again for this round :( and wait for more improvements to it. The choice of not being able to use EF for me is bind by the constraints I have in my environment that requires the applications to process millions of transactions per hour. This is the volume of processing in Telco environment.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Whether to use EF or not is entirely up to your environment and choice (as long as you know the limitations of the chosen technology). If your system does not require such crazy high loads, I don&#39;t foresee you will have any problems in using EF.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I hope this post has given you good enough insights into Entity Framework. If you have ideas for me to fix the EF exception, please feel free to post it in the comments.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://serena-yeoh.blogspot.com/feeds/8216748586914450920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7549567/8216748586914450920' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8216748586914450920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7549567/posts/default/8216748586914450920'/><link rel='alternate' type='text/html' href='http://serena-yeoh.blogspot.com/2014/02/entity-framework-vs-el-daab-performance.html' title='Entity Framework 6 vs. EL6 DAAB Performance'/><author><name>Firedancer</name><uri>http://www.blogger.com/profile/11579064485123436723</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/AVvXsEjnkPKM54XZ06g90q19mPJGdNuX4oz9o8Nxmt_TtAAzPqS57VqAzWF3cLNnSMDuv-TxYmeLx1Hjq85KhwLV3pxByQX1M2H0UJYCChusiKzdx3EQ4LDHQ0yqtlTvQAQJaX457KJj/s72-c/Host-Settings.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>