<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Tuna Toksoz</title><link>http://devlicio.us/blogs/tuna_toksoz/default.aspx</link><description>It is the blog where I share my findings and experiences on projects like NH and Castle. I also try to promote good programming practices here.</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/devlicious-tunatoksoz" /><feedburner:info uri="devlicious-tunatoksoz" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>CodeBetter/Devlicio.us/LosTechies MSDN Ultimate Giveaways</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/mhwXBf1E7lE/codebetter-devlicio-us-msdn-ultimate-giveaways.aspx</link><pubDate>Tue, 27 Jul 2010 11:46:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:61254</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>6</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=61254</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=61254</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2010/07/27/codebetter-devlicio-us-msdn-ultimate-giveaways.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;UPDATE: I have added subscription donors/contributors who made this possible.     &lt;br /&gt;UPDATE: Our friends from &lt;/strong&gt;&lt;a href="http://www.lostechies.com"&gt;&lt;strong&gt;LosTechies&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; also wanted to participate, and they donated a number of licenses (6 and counting). Thank you guys!&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In an internal discussion we had, an interesting idea popped up. MVP bloggers we had at &lt;a href="http://www.codebetter.com"&gt;CodeBetter&lt;/a&gt;/&lt;a href="http://www.devlicio.us"&gt;Devlicio.us&lt;/a&gt; were generous enough to donate some of their MSDN subscriptions they were given as part of MVP program. Then the cool kids at &lt;a href="http://www.lostechies.com"&gt;LosTechies&lt;/a&gt; stepped in, and donated a number of licenses as well! Currently we have 13-16 licenses available, and this number may change depending on the demand and outside donations. The subscriptions are for one year.&lt;/p&gt;  &lt;p&gt;We decided to give them away to successful/promising OSS projects that are in need of licenses. The rules are simple.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The project has to be opensource &lt;/li&gt;    &lt;li&gt;The project has to be in need of MSDN license. We’ll trust your word in this. &lt;/li&gt;    &lt;li&gt;The selection will be based on our discretion, we’ll do our best on being fair. &lt;/li&gt;    &lt;li&gt;We may change the number of licenses available during the selection progress. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;You can send me an email (tehlike (hat) gmail (hot) com) with title starting with [CDL/MSDN] (or [CD/MSDN]), or DM me on twitter (&lt;a href="http://twitter.com/tehlike" target="_blank"&gt;@tehlike&lt;/a&gt;) if you want to participate. You have to include&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Public URL for the project page &lt;/li&gt;    &lt;li&gt;Your name and your position in the project      &lt;br /&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;It wouldn’t have been possible with the help of following fellow bloggers. Thanks to &lt;strong&gt;Codebetter Crew&lt;/strong&gt;: &lt;a href="http://codebetter.com/blogs/benhall" target="_blank"&gt;Ben Hall&lt;/a&gt;, &lt;a href="http://codebetter.com/blogs/wardbell/" target="_blank"&gt;Ward Bell&lt;/a&gt;, &lt;a href="http://codebetter.com/blogs/james.kovacs" target="_blank"&gt;James Kovacs&lt;/a&gt;. &lt;strong&gt;Devlicious Crew&lt;/strong&gt;: &lt;a href="http://devlicio.us/blogs/hadi_hariri" target="_blank"&gt;Hadi Hariri&lt;/a&gt;, &lt;a href="http://devlicio.us/blogs/christopher_bennage" target="_blank"&gt;Christopher Bennage&lt;/a&gt;, &lt;a href="http://devlicio.us/blogs/tim_barcz" target="_blank"&gt;Tim Barcz&lt;/a&gt;, &lt;a href="http://devlicious.com/blogs/rob_reynolds/" target="_blank"&gt;Rob Reynolds&lt;/a&gt;.&amp;#160; &lt;strong&gt;Lostechies Crew&lt;/strong&gt;: &lt;a href="http://www.lostechies.com/blogs/hex/" target="_blank"&gt;Eric Hexter&lt;/a&gt;, &lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/default.aspx" target="_blank"&gt;Jimmy Bogard&lt;/a&gt;, &lt;a href="http://www.lostechies.com/blogs/dahlbyk/" target="_blank"&gt;Keith Dahlby&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Good luck!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=61254" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/mhwXBf1E7lE" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/opensource/default.aspx">opensource</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/msdn/default.aspx">msdn</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2010/07/27/codebetter-devlicio-us-msdn-ultimate-giveaways.aspx</feedburner:origLink></item><item><title>Feedback to my department (Computer Science/Bogazici University)</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/uevFFkpV-S0/feedback-to-my-department-computer-science-bogazici-university.aspx</link><pubDate>Mon, 31 May 2010 06:40:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:59443</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=59443</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=59443</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2010/05/31/feedback-to-my-department-computer-science-bogazici-university.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;PS: This blog post is in the oven for last 8 months, because I waited for some time to make sure it is not something I wrote because of my feelings. I don&amp;rsquo;t really think it is unique to Bogazici University, but I see some value in sharing it on Devlicio.us, too. &lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you can read this, it means that I have almost finished my undergrad&lt;a href="http://www.boun.edu.tr" target="_blank"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;margin-left:0px;border-top:0px;margin-right:0px;border-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_04B90FD0.png" align="right" border="0" height="177" width="177" /&gt;&lt;/a&gt;uate education.&lt;/p&gt;
&lt;p&gt;Being a good student, I believe I have a few words to say on my school and its people. &lt;/p&gt;
&lt;p&gt;I have transferred there from another great university, namely ITU. There were several reasons behind my transfer, one of which was better instructor-student communication and better relationship with schools aboard. After 4 years, I believe it was overall a good decision but unfortunately nothing perfect, and actually I am not expecting it to be perfect, everything comes with its flaws.&lt;/p&gt;
&lt;p&gt;What I see in Bogazici, in general, is that everything was designed to decrease bureaucracy. Compared to my former school, you can see the difference. When a class is overquota, you send a message to the instructor of that course and expect him/her to allow you into the class. In the former school, you have to write a petition to the faculty, they gather those petitions and inform the student affairs and then student affairs increase the &amp;ldquo;overall&amp;rdquo; quota. This takes several days and in the end, you may not be able to register for this course at all.&lt;/p&gt;
&lt;p&gt;Another thing is that you are informed about every little thing that has to do something with students. We get scholarship announcements, information about campus events and so. In the older school this doesn&amp;rsquo;t hold, you have to follow everything by yourself. &lt;/p&gt;
&lt;p&gt;Having said the above, now it comes to my department: Computer Engineering and its faculty. We have, no doubt, greatest minds of Turkey in various areas. I am going to share the points that I am not comfortable with, and I hope this is a constructive critic.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Your students you give reference are your face abroad! And it is your &amp;ldquo;duty&amp;rdquo; to give reference&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_5B07DFD6.png" align="right" border="0" height="172" width="244" /&gt; &lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Every student, for some reasons like for a job or for a grad school application, needs references from the instructors/professors s/he took from. It is a very natural process especially during fall terms of sophomore year to ask for it. Professors should be aware of these very tough times, and should be constructive at those times. I have taken references from 3 professors (which is the bare minimum for universities) from whom I took a class from or worked with, I am very thankful to every single one of them. Some were very constructive, but probably more than half was not very helpful at all. I didn&amp;rsquo;t have any problem with taking reference, and I was even surprised because I was able to take reference from a professor whom I worked when I was a sophomore 2.5 years ago. He was very friendly since we met and even though I asked way too many letters of recommendations (app. 18), he sent every single recommendation letter I requested. &lt;/p&gt;
&lt;p&gt;Anyway, going back to people from my school (with some exceptions, of course), I didn&amp;rsquo;t hear good things, I had to say. I learnt that one of them said he can&amp;rsquo;t write one because he didn&amp;rsquo;t work with this student, then he changed his mind and said he could only send online recommendations (probably for the fear of student opening a letter and read the recommendation, ie. for the sake of privacy). This student wasn&amp;rsquo;t an ordinary student, he was an exceptional one, very smart and he had really good GPA. One of them didn&amp;rsquo;t even care and &amp;ldquo;ignored&amp;rdquo; another friend of mine when he asked for letter of recommendation. That&amp;rsquo;s our experience.&lt;/p&gt;
&lt;p&gt;We had chance to discuss about ways to improve our department. Their answer to our complaints was worse than what we thought it would. First they said every good student will get very good references from any instructor they asked. When we had told our experience about this process, they then changed their mouths and said &amp;ldquo;we cannot enforce to make them give you one&amp;rdquo;. This is really not the case; they can do something, even if it is just a discussion between profs. One other said he gave more than hundred letters of recommendation, and if we asked one, we could get one. &lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s true that they may not give a LOR if they haven&amp;rsquo;t worked with this student, but think of it for a second. &lt;a href="http://www.cmpe.boun.edu.tr/undergrad/curriculum/"&gt;Our curriculum&lt;/a&gt; is fixed until we are senior student! They don&amp;rsquo;t leave much chance to take elective courses until we are senior student. The pool of professors we can take LOR from is fixed, and I can say there aren&amp;rsquo;t many who will give LOR without any problem. With all due respect, we don&amp;rsquo;t really deserve this. Time is valuable for you, so are ours to us. There is a method that I have seen in both US professors I worked with. They ask you to write a draft as if the Prof is writing to him. This is very beneficial in many ways: It informs the prof about what the student did and achieved during his undergraduate life, it significantly decreases the time to write a LOR, the LOR will be unique (it won&amp;rsquo;t be a generic one like &amp;ldquo;he took my class got an A, he is smart and handsome&amp;rdquo;) which admission offices say to be very important. It also gives an idea about how he think he is in the eye of the professor. &lt;/p&gt;
&lt;p&gt;Moreover, comparing my department with some others, I can say my profs are not very doing good at this. I&amp;rsquo;ve heard that Profs from electronics department, for example are very helpful, they look for what professor to choose, whom to ask for funding etc. They even try to establish some kind of meeting with professors abroad. I haven&amp;rsquo;t seen and heard such behavior from my department. This will hurt our education a lot.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;It is, in my opinion, the responsibility of an instructor to raise interest&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_24B6B7C7.png" align="right" border="0" height="204" width="204" /&gt; After my internship at MIT, one of the instructors, namely Ayse Basar Bener, asked me if I am interested in taking CMPE 491 (the complementary project course). I was surprised and I have to say I like the way she approached me. She suggested me to talk with Cem Ersoy and Levent Akin for that because she believed I would be interested in their areas of research based on my internship. This was what I had been thinking for a while, to get involved in some academic research in my current school but I was sort of busy with other things(as Baris Gokce says, if you are not enforced to do things, you are most likely not going to do it). Sometimes you need a good motivator, and a suggestion may be the one you&amp;rsquo;re looking for.&lt;/p&gt;
&lt;p&gt;When I talked with Cem Ersoy and Levent Akin, all was kind enough to spend half an hour on discussion. They told what they do, and I told them what I was interested in. Cem Ersoy, while we were talking, mentioned that they always appreciate newcomers but they don&amp;rsquo;t have enough energy and time to draw people&amp;rsquo;s attention. This is what I don&amp;rsquo;t get at all (don&amp;rsquo;t get me wrong, he is one of the most amazing instructors over there). &lt;/p&gt;
&lt;p&gt;Being the department with highest ranked students, all the students we have in department are extremely smart and talented. Some are less focused but they can do very well if they pay attention. I believe that it is the responsibility of an instructor to draw attention to their field. They don&amp;rsquo;t have to do much; it suffices to tell about what they really do and how students could contribute into their research. Freshman orientation is definitely not the best time for such things. Some people don&amp;rsquo;t even know what network really means, for example. It should be done sometime in 3&lt;sup&gt;rd&lt;/sup&gt; year. They can even ask students to come by and ask their questions. Some of the instructors I know did this very well, but some didn&amp;rsquo;t even care. This is also directly related with interaction, and it is really important. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;Feedback/Interaction is an essential part of education&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Everybody would agree that feedback is an important process in everything in life, and it is even more important in the context of education. By feedback, I don&amp;rsquo;t mean the course evaluation forms we fill at the end of each semester. Those are actually what I care the least. Every term, the results of previous survey is being announced but I don&amp;rsquo;t know if people care for them (except for the ABET. I try to be optimistic in that forms) &lt;/p&gt;
&lt;p&gt;What I mean by feedback is the feedback mechanism &lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_58127B23.png" align="right" border="0" height="190" width="244" /&gt;right in the classroom. It is the ability to be flexible in the course schedule (definitely not a drastic change in syllabus). Depending on what students do understand and don&amp;rsquo;t understand, it is the ability to spend more attention on some topics and less on others. It is the ability to give the students the feeling that they are important and their thoughts are important. &lt;/p&gt;
&lt;p&gt;From what I saw and heard about several instructors, I can say that some are really openminded and open to what I said above. However, some of them just write on the board what is exactly on the book. No matter how well you do in your field of area, and no matter how famous you are, you&amp;rsquo;re definitely not doing good in teaching. Teaching is an interactive process that consists of students. Students are the main part of the process and instructors are responsible from making them understand. One can do that in many ways, the simplest one is asking questions. Please, dear instructor, don&amp;rsquo;t hesitate to ask questions in the class, and please talk on interesting topics, not just write everything on the board and leave the room after the class is over.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Our time is valuable, please think about us.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I have been to two different undergraduate colleges, and I know their systems more or less. I &lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_3D65DF0A.png" align="right" border="0" height="244" width="184" /&gt;am a big fan of &lt;b&gt;&amp;ldquo;self-improvement&amp;rdquo;&lt;/b&gt;. I believe that people learn best what they do when they are not enforced to. Giving assignments just to keep students busy does not make any sense. Quite often, I hear TA&amp;rsquo;s giving homework (usually the first one) tell that this is just a warm up. What I talk is for the majority of courses that has homeworks, but to give a special example one would be the embedded system assignment. The instructor is a very good one, and I really learnt a lot (I don&amp;rsquo;t say this much for courses). In that assignment we are asked to implement spline interpolations in a limited amount of memory. Code took only 1-2 hours to finalize, while its report took forever to finish. In the report, we had to take the output of the spline for 100 points (in which we have to use copy &amp;amp; paste and do some processing to get the data, there wasn&amp;rsquo;t an easy way really. If we are talking about an embedded system, give something that really makes sense, and do not expect us to write report that is of little value. Part of that report really made sense, like optimizations, like constraints etc but those parts took only a couple of hours to write. &lt;/p&gt;
&lt;p&gt;Another thing that I would like to mention is the overhead we have been given in our lab experiments (hardware labs, to name one, embedded systems and digital design). In those experiments and assignments, we are asked to make &amp;ldquo;good looking circuits&amp;rdquo;. By good looking, I mean straight cables, cables not crossing each other etc. The reason they want us to do such thing, they say, is that circle-like wire might act as a coil and induce magnetic field. This is completely senseless. It might be true that it can cause magnetic field, but it is negligible for &amp;ldquo;our purposes&amp;rdquo;. Cutting those wires in appropriate length takes a lot of valuable time. Sometimes you cut it short, sometimes you cut it long. The time we spent on just cutting wires is basically at least 3/5 of the lab time. This time could be spend for more valuable things, like learning new stuff, or combining many components for new circuits.&lt;/p&gt;
&lt;p&gt;I am not complaining, in fact, I was probably one of few people who had completed his all assignments with high grades; this is because I care about them a lot. However, this also comes at a cost: You have to sacrifice from other things. This sort of stuff usually steals from the time that I spend with my family, girlfriend or self-improvement. For the first couple of weeks of the first term, I was extremely busy with just doing homeworks. Spending less time for sleep, less time for self-improvement (I have no commits to any OSS during that period), less time for my beloved one. &lt;/p&gt;
&lt;p&gt;Another point I criticize about embedded system course is that so-called lab hours. In theory, this is a 3 credit course. We also have 2 hour demonstration for the assignment we did that time. We spend 5 hours just to satisfy course requirements. All is okay up to now. The problem is the assignment itself. This assignment takes at least 1.5 full day of cutting wires, connecting cables and debugging. Those assignments are weekly, meaning that the same busy days every week. Result? Sleepless nights. Should it be like this? I don&amp;rsquo;t know. Will I do such thing if I ever become an instructor? Surely NOT.&lt;/p&gt;
&lt;p&gt;I will quote one of the professionals that I respect, &lt;a href="http://codebetter.com/blogs/karlseguin/"&gt;Karl Seguin&lt;/a&gt; : &amp;ldquo;You learn so much more from your own project, because you aren&amp;#39;t constrained by technology or risk, or time lines. You implement BDD, NoSQL, Python, memcached, NHibernate, etc.. on your own projects first, then use them at work. Maybe that&amp;#39;s why the 15% rule at Google, 3M and Atlassian works so well...its the ultimate training opportunity &amp;ldquo; (can be found on &lt;a href="http://twitter.com/karlseguin/status/4992717387"&gt;his&lt;/a&gt; &lt;a href="http://twitter.com/karlseguin/status/4992740508"&gt;public&lt;/a&gt; &lt;a href="http://twitter.com/karlseguin/status/4992931107"&gt;profile&lt;/a&gt;). I put my name under it. This is what it has to be like. I completely agree with giving assignments but I also support to keep the overhead at a minimum level. &lt;/p&gt;
&lt;p&gt;I may add some other things as the time goes by, but this is what I can remember for now. I hope someday people will read this material and benefit from it. This is my feedback to my school.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=59443" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/uevFFkpV-S0" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/feedback/default.aspx">feedback</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/computer+science/default.aspx">computer science</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/education/default.aspx">education</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2010/05/31/feedback-to-my-department-computer-science-bogazici-university.aspx</feedburner:origLink></item><item><title>Not So Hidden Gems of NHibernate – Formula Discriminators</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/vjA7lv1dvSE/not-so-hidden-gems-of-nhibernate-formula-discriminators.aspx</link><pubDate>Sat, 15 May 2010 20:49:46 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:58882</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=58882</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=58882</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2010/05/15/not-so-hidden-gems-of-nhibernate-formula-discriminators.aspx#comments</comments><description>&lt;p&gt;A friend of mine, &lt;a href="http://www.cprieto.com/"&gt;Cristian Prieto&lt;/a&gt;, told me that he didn’t know how to do mapping of some entities to (in his terms) an evil legacy database. &lt;/p&gt;  &lt;p&gt;There were two entities: &lt;strong&gt;Advertiser &lt;/strong&gt;and &lt;strong&gt;Affiliate. &lt;/strong&gt;As I said, this was a crazy legacy database. Both shares the same table with only one difference: If an entity is &lt;strong&gt;Affiliate&lt;/strong&gt;, then it’s &lt;strong&gt;affiliate_id &lt;/strong&gt;column will have a value, otherwise, a non-empty &lt;strong&gt;advertiser_id&lt;/strong&gt; means it’s an Advertiser. Both cannot be the same at the same time.&lt;/p&gt;  &lt;p&gt;Having gone through &lt;strong&gt;NHibernate code&lt;/strong&gt; a while ago, I remember being able to discriminate on an expression (or in NH terms: Formula). I wasn’t sure about it, but Cristian verified that there is such thing that exists, and you can use it for such thing.&lt;/p&gt;  &lt;p&gt;Here is the description of &lt;strong&gt;formula discriminator &lt;/strong&gt;from &lt;a href="http://www.nhforge.org/doc/nh/en/index.html#mapping-declaration-discriminator"&gt;the documentation&lt;/a&gt;.&lt;/p&gt;   &lt;pre name="code" class="xml"&gt;&amp;lt;discriminator
        column=&amp;quot;discriminator_column&amp;quot;  
        type=&amp;quot;discriminator_type&amp;quot;      
        force=&amp;quot;true|false&amp;quot;             
        insert=&amp;quot;true|false&amp;quot;            
        formula=&amp;quot;arbitrary SQL expression&amp;quot;
/&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;&lt;tt&gt;formula&lt;/tt&gt; (optional) &lt;strong&gt;an arbitrary SQL expression&lt;/strong&gt; that is executed when a type has to be evaluated. Allows content-based discrimination&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Bingo! “an arbitrary sql expression” is just what we wanted.&lt;/p&gt;

&lt;p&gt;Going back to Cristian’s problem, we can now use this:&lt;/p&gt;

&lt;pre name="code" class="xml"&gt;&amp;lt;discriminator 
        type=&amp;quot;Int32&amp;quot; 
        formula=&amp;quot;(case when not affiliate_id is null then 0 else 1 end)&amp;quot;
/&amp;gt;&lt;/pre&gt;
The rest is left as an exercise for the reader (I always wanted to say this!)

&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=58882" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/vjA7lv1dvSE" height="1" width="1"/&gt;</description><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2010/05/15/not-so-hidden-gems-of-nhibernate-formula-discriminators.aspx</feedburner:origLink></item><item><title>Testing on Android</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/yl-HUd4LK8E/testing-on-android.aspx</link><pubDate>Wed, 06 Jan 2010 00:30:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54931</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=54931</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=54931</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2010/01/06/testing-on-android.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/android_5F00_15CDAE53.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="android" border="0" alt="android" align="right" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/android_5F00_thumb_5F00_3099D45F.png" width="210" height="240" /&gt;&lt;/a&gt;For the last couple of months, I have been working on Android platform as part of Software Engineering course(more on that later, i hope). Even though there are a lot of things I don’t like about android (like XML layouts and the ids of widgets being held in some other class etc but perhaps this is just me), I overall find it a good platform to work with.&lt;/p&gt;  &lt;p&gt;What I really liked in Android is that it provides an Out-of-the-box environment for easy testing android applications. I don’t know how Windows Mobile projects handle this situation, but what android does is that it executes the test in the context of virtual machine. Android integrates nicely with &lt;a href="http://www.junit.org/"&gt;JUnit&lt;/a&gt; framework, which is the java brother of &lt;a href="http://nunit.org"&gt;NUnit&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;What is more interesting than this is that Android also has UI testing framework. Being a person who hasn’t written UI tests much (as in none), I can’t say if it is a good one or not. I just liked the feature that came out of the box. &lt;/p&gt;  &lt;p&gt;I have created a simple Activity (you can think of it as a window, but not exactly)&lt;/p&gt;  &lt;pre class="java" name="code"&gt;
public class SampleActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final Button b=(Button)findViewById(R.id.Button01);
        final EditText t=(EditText)findViewById(R.id.EditText01);
        b.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				// TODO Auto-generated method stub
				t.setText(t.getText().toString()+&amp;quot;hello&amp;quot;);
			}
		});
    }
}&lt;/pre&gt;

&lt;p&gt;And created the following test. &lt;/p&gt;

&lt;pre class="java" name="code"&gt;
public class SampleActivityInstrumentation extends
		android.test.ActivityInstrumentationTestCase2 {

	public SampleActivityInstrumentation() {
		super(&amp;quot;com.myandroid&amp;quot;, SampleActivity.class);
		// TODO Auto-generated constructor stub
	}

	public void test_OK_button_appends_hello() throws Throwable {
		SampleActivity tne = (SampleActivity) getActivity();

		final Button btn=(Button) tne.findViewById(com.myandroid.R.id.Button01);
		final EditText titleEdit = (EditText) tne.findViewById(com.myandroid.R.id.EditText01);
		runTestOnUiThread(new Runnable() {
			public void run() {
				titleEdit.performClick();
			}
		});
		sendKeys(&amp;quot;H E L L O&amp;quot;);
		runTestOnUiThread(new Runnable() {
			public void run() {
				btn.performClick();
			}
		});
		assertEquals(&amp;quot;hellohello&amp;quot;,titleEdit.getText().toString());
		
	}

}&lt;/pre&gt;

&lt;p&gt;I found it very cool to have such a nice integration. More than that is that they use proven testing framework out of the box. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54931" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/yl-HUd4LK8E" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/ui/default.aspx">ui</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/android/default.aspx">android</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/testing/default.aspx">testing</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2010/01/06/testing-on-android.aspx</feedburner:origLink></item><item><title>Feature Request For Visual Studio 2010: Local Revision History</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/ylTKDlA_Utg/feature-request-for-visual-studio-2010-local-revision-history.aspx</link><pubDate>Wed, 18 Nov 2009 22:38:15 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53765</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>10</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=53765</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=53765</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/11/19/feature-request-for-visual-studio-2010-local-revision-history.aspx#comments</comments><description>&lt;p&gt;This feature is a life saver. I was working on my school project, and I was drawing UML Diagram with an Eclipse plugin. All of a sudden, the diagram went off, and all I saw was a screen with blank class boxes. I was going crazy, trying to find differences between a valid document and a buggy one with my eyes etc. Then i remembered a feature that Eclipse had: Local Revisions.&lt;/p&gt;  &lt;p&gt;Every time you modify a file, Eclipse saves a copy of the old one in .metadata folder of the project. I was unable to reach the history in the IDE, but i can see the changes in the history folder.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_484D8B0F.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_thumb_5F00_46308C46.png" width="334" height="249" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The last version that worked was somewhere around 10 PM, and I manually copied the contents of that time period.&lt;/p&gt;  &lt;p&gt;And now I can see my diagrams.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Admittedly, this is what SCM is for, but think of it that way: you wouldn’t commit a diagram until it is not near complete. You also wouldn’t want to waste 1 hour just to redraw the diagram.&lt;/p&gt;  &lt;p&gt;My request is that they incorporate this small feature into VS 2010, or perhaps some good soul can do this as a free plugin into R# or directly into VS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53765" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/ylTKDlA_Utg" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/vs+2010/default.aspx">vs 2010</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/extension/default.aspx">extension</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/11/19/feature-request-for-visual-studio-2010-local-revision-history.aspx</feedburner:origLink></item><item><title>My Thoughts on ORM comparisons</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/9hYWd4_Wf-I/my-thoughts-on-orm-comparisons.aspx</link><pubDate>Fri, 21 Aug 2009 16:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:50165</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>7</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=50165</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=50165</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/08/21/my-thoughts-on-orm-comparisons.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;UPDATE 1: I made clear that NH actually performs better in those posts, when a simple optimization such as Enabled Batching.&lt;br /&gt;UPDATE 2: Please check &lt;a href="http://ayende.com/Blog/archive/2009/08/22/nhibernate-perf-tricks.aspx"&gt;Ayende&amp;#39;s latest post&lt;/a&gt;&amp;nbsp;for how those benchmarks can be made fair.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;I am a bit late to the party but there we go.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Last several days, there have been a hot debate on the performance and capability of NH vs some other commercial/noncommercial ORMs. This issue has been discussed both in NHibernate Developer List and in &lt;a href="http://ayende.com"&gt;Ayende&amp;rsquo;s&lt;/a&gt; blog. I have recently noticed another benchmark between NH and EF, which I hope to address, too. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Fallacies of benchmark&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What I have seen in those benchmarks is the wrong use of ORMs. This statement has two aspects: Wrong use of ORM and wrong use of NH itself.&lt;/p&gt;
&lt;p&gt;In ORM, you don&amp;rsquo;t use it to do bulk operations. And 0.001 second difference will not differ anything in your application. If it does, you don&amp;rsquo;t also use RDBMS, you use something else.&lt;/p&gt;
&lt;p&gt;There is no point on making a loop of thousands of iterations which saves an entity. &lt;a href="http://davybrion.com"&gt;Davy&lt;/a&gt; has well pointed out that this has a lot of implications in NHibernate, unlike some other ORMs. First of all, NHibernate first-level cache will be in action and it will fill the cache with each item saved. Secondly, as NH makes use of POCO it has no mechanism of things like INotifyPropertyChanged, it has to compare the old to the new value. As you may guess, the more entity you have, the longer it will take. No exception. If you want to leave first-level cache out of the game, you use &lt;a href="http://nhforge.org/blogs/nhibernate/archive/2008/10/30/bulk-data-operations-with-nhibernate-s-stateless-sessions.aspx"&gt;StatelessSession&lt;/a&gt; feature of NHibernate, no exception. Actually when you check &lt;a href="http://fabiomaulo.blogspot.com/2009/08/nhibernate-perfomance-cramer-vs-cramer.html"&gt;Fabio Maulo&amp;rsquo;s post&lt;/a&gt; you&amp;rsquo;ll see it can even become faster without Stateless Session.&lt;/p&gt;
&lt;p&gt;Another point I have noticed in both benchmarks is that they are/were not fair. If I compare it to EF, lets say, ctx.SaveChanges() will batch the chages and send the query to the database in one go. NH has this feature, as Ayende already pointed out, &lt;a href="http://ayende.com/Blog/2006/09/16/BatchingSupportInNHibernate.aspx"&gt;since 2006.&lt;/a&gt; However, NH by default doesn&amp;rsquo;t make use of it, and this is not a bug, it is a feature. You have to use setting to enable it. &lt;/p&gt;
&lt;p&gt;Gergely Orosz has made his own benchmark and didn&amp;#39;t use batching support and NH fell well behind of EF. I contacted him and he was kind enough to discuss the issues. I showed him how to enable batching and why not to flush everytime, as it wouldn&amp;#39;t be fair. Now NH performs much better and he said he will update his post.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Benchmark the community, too&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;NHibernate has a big community, and great minds as committers. It really does matter. Let me give you some statistics about NHibernate development and its community&lt;/p&gt;
&lt;p&gt;Here is the commit statistics.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_1A86DDE0.png"&gt;&lt;img border="0" width="456" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_thumb_5F00_4D766E47.png" alt="image" height="138" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is one of the most active projects in .net environment. The image above doesn&amp;rsquo;t include the contrib projects. A great kiss goes&amp;nbsp; to &lt;a href="http://fabiomaulo.blogspot.com/"&gt;Fabio Maulo&lt;/a&gt; for his massive efforts.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look at discussion group, shall we?&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_0F99D6CB.png"&gt;&lt;img border="0" width="459" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_thumb_5F00_3C4290A4.png" alt="image" height="108" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Do you know any other group with that activity? I don&amp;rsquo;t know.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In addition, NHibernate gives you more than _ANY_ ORM can give. It gives you a lot of extensibility points which can be used in a lot of scenario. Validator, Search, Spatial, Shards to name a few.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;NHibernate is the obvious winner.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=50165" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/9hYWd4_Wf-I" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/nhibernate/default.aspx">nhibernate</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/benchmarking/default.aspx">benchmarking</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/orm/default.aspx">orm</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/08/21/my-thoughts-on-orm-comparisons.aspx</feedburner:origLink></item><item><title>Making Transient as Default Lifestyle in Castle Windsor</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/aBt2MMX7KyE/making-transient-as-default-lifestyle-in-castle-windsor.aspx</link><pubDate>Thu, 06 Aug 2009 10:30:37 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49873</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49873</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49873</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/08/06/making-transient-as-default-lifestyle-in-castle-windsor.aspx#comments</comments><description>&lt;p&gt;This is actually an answer to fellow blogger &lt;a href="http://devlicio.us/blogs/casey"&gt;Jak Charlton&lt;/a&gt;, but I see a benefit in sharing it.&lt;/p&gt;  &lt;p&gt;Casey pointed out that the default lifestyle should be transient. Even though I understand his reasonings, I am used to this way. &lt;/p&gt;  &lt;p&gt;There is a solution for those who wants Transient as the default.&lt;/p&gt;  &lt;p&gt;You know what? Yes, the events ! Here is how.&lt;/p&gt;  &lt;pre class="c-sharp" name="code"&gt;container.Kernel.ComponentModelCreated += new ComponentModelDelegate(Kernel_ComponentModelCreated);


void Kernel_ComponentModelCreated(Castle.Core.ComponentModel model)
{
	if (model.LifestyleType == LifestyleType.Undefined)
		model.LifestyleType = LifestyleType.Transient;
}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49873" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/aBt2MMX7KyE" height="1" width="1"/&gt;</description><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/08/06/making-transient-as-default-lifestyle-in-castle-windsor.aspx</feedburner:origLink></item><item><title>NHibernate Linq Released</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/LJ7KMVLWOMA/nhibernate-linq-released.aspx</link><pubDate>Sun, 26 Jul 2009 20:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49565</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49565</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49565</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/26/nhibernate-linq-released.aspx#comments</comments><description>&lt;p&gt;Just as a reminder, even though you might have seen it before on twitter or &lt;a href="http://www.nhforge.org"&gt;nhforge&lt;/a&gt; or &lt;a href="http://nhforge.org"&gt;Ayende&amp;rsquo;s blog&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As of today, we released the first version of NHibernate.Linq. It is currently based on Criteria API, and can handle many situations that it can handle. &lt;/p&gt;
&lt;p&gt;NHibernate.Linq was the first project that I contribute as a committer (it was in Rhino Tools), it is a strange feeling to see its release.&lt;/p&gt;
&lt;p&gt;I would like to thank &lt;a href="http://ayende.com/blog"&gt;Oren Eini(Ayende),&lt;/a&gt; &lt;a href="http://chadly.net"&gt;Chad Lee&lt;/a&gt; and &lt;a href="http://www.primedigit.com/"&gt;Will Shaver&lt;/a&gt; for making this project come true.&lt;/p&gt;
&lt;p&gt;You can read the official announcement &lt;a href="http://nhforge.org/blogs/nhibernate/archive/2009/07/26/nhibernate-linq-1-0-ga-released.aspx"&gt;here on NHForge&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49565" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/LJ7KMVLWOMA" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/nhibernate/default.aspx">nhibernate</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/linq/default.aspx">linq</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/26/nhibernate-linq-released.aspx</feedburner:origLink></item><item><title>Implementing EnrichWith(of StructureMap) with Castle</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/fPEPEpUZoVI/implementing-enrichwith-of-structuremap-with-castle.aspx</link><pubDate>Tue, 14 Jul 2009 13:30:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49379</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49379</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49379</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/14/implementing-enrichwith-of-structuremap-with-castle.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;UPDATE: This facility made its way into Castle Microkernel, with name OnCreateFacility. I also made it possible to specify more than one actions. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In one of &lt;a href="http://www.lostechies.com/blogs/joshuaflanagan/archive/2009/07/12/how-we-handle-application-configuration.aspx"&gt;Joshua Flanagan&amp;#39;s recent post&lt;/a&gt; he mentioned about how they handle application configuration and I have to say that I liked their way. I also liked how SM can post-modify an object created, and looked for a way to do it in Castle. As many other stuff, I was able to achieve the same effect with a custom Facility. &lt;/p&gt;
&lt;p&gt;If I go further in the details, I had to catch ComponentCreated event of Kernel.&lt;/p&gt;
&lt;pre name="code" class="c-sharp"&gt;public class EnrichWithFacility:AbstractFacility
{
	public const string ExtendWithPropertyKey = &amp;quot;extendwith&amp;quot;;
	protected override void Init()
	{
		Kernel.ComponentCreated += new Kernel_ComponentCreated;
	}
	void Kernel_ComponentCreated(ComponentModel model, object instance)
	{
		if(model.ExtendedProperties.Contains(ExtendWithPropertyKey))
		{
			var action = model.ExtendedProperties[ExtendWithPropertyKey] as ExtendComponentDelegate;
			action(this.Kernel, instance);
		}
	}
}&lt;/pre&gt;
&lt;p&gt;Whenever a component is created, I will catch it and ask if there is any EnrichWith registered for the ComponentModel, and if there is any, invoke the action.&lt;/p&gt;
&lt;p&gt;I also added a fluent registration extensions (Castle style!) in order to make it easy to register enrichments.&lt;/p&gt;
&lt;pre name="code" class="c-sharp"&gt;container.Register(Component.For&amp;lt;IService&amp;gt;().ImplementedBy&amp;lt;MyService&amp;gt;()
			 .EnrichWith((kernel, instance) =&amp;gt; ((IService) instance).I++));&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The code for &lt;a href="http://code.google.com/p/blogsharp/source/browse/trunk/BlogSharp.CastleExtensions/Facilities/EnrichFacility/EnrichWithFacility.cs?spec=svn112&amp;amp;r=108"&gt;the facility&lt;/a&gt;, &lt;a href="http://code.google.com/p/blogsharp/source/browse/trunk/BlogSharp.CastleExtensions/Facilities/EnrichFacility/FluentRegistration.cs?spec=svn112&amp;amp;r=108"&gt;fluent registration interface&lt;/a&gt;,and &lt;a href="http://code.google.com/p/blogsharp/source/browse/trunk/BlogSharp.CastleExtensions.Tests/Facilities/EnrichWithFacilityTests.cs?spec=svn112&amp;amp;r=108"&gt;the tests&lt;/a&gt; can be found on our never-ending blog engine, BlogSharp codebase.&lt;/p&gt;
&lt;p&gt;If you like the post, please kick and/or shout it.&lt;/p&gt;
&lt;p&gt;
  &lt;br /&gt;&lt;a rev="vote-for" href="http://dotnetshoutout.com/Implementing-EnrichWithof-StructureMap-with-Castle-Tuna-Toksoz-Devlicious"&gt;&lt;img src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fdevlicio.us%2Fblogs%2Ftuna_toksoz%2Farchive%2F2009%2F07%2F14%2Fimplementing-enrichwith-of-structuremap-with-castle.aspx" alt="Shout it" style="border-right-width:0px;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49379" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/fPEPEpUZoVI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/castle/default.aspx">castle</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/microkernel/default.aspx">microkernel</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/windsor/default.aspx">windsor</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/14/implementing-enrichwith-of-structuremap-with-castle.aspx</feedburner:origLink></item><item><title>Querying on Child Count With NHibernate</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/661vGXaEzqE/querying-on-child-count-with-nhibernate.aspx</link><pubDate>Thu, 09 Jul 2009 23:23:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49317</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>6</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49317</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49317</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/10/querying-on-child-count-with-nhibernate.aspx#comments</comments><description>&lt;p&gt;This is a recent question raised in &lt;a href="http://groups.google.com/group/nhusers" target="_blank"&gt;NHibernate Users Group&lt;/a&gt;. The user wanted to realize the following query with Criteria api.&lt;/p&gt;  &lt;pre class="c-sharp" name="code"&gt;var result = db.Person.Where(x =&amp;gt; x.Pets.Count &amp;gt; 0 &amp;amp;&amp;amp; x.Alive).OrderBy(x =&amp;gt; x.Name);&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is not a simple query, but it has a solution&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;  
DetachedCriteria crit = DetachedCriteria.For(typeof (Person), &amp;quot;p2&amp;quot;)
    .CreateCriteria(&amp;quot;p2.Pets&amp;quot;,&amp;quot;Pets&amp;quot;)
    .Add(Restrictions.EqProperty(&amp;quot;p.Id&amp;quot;, &amp;quot;p2.Id&amp;quot;))
    .SetProjection(Projections.Count(&amp;quot;Pets.Id&amp;quot;));

ICriteria c = s.CreateCriteria(typeof (Person), &amp;quot;p&amp;quot;)
    .Add(Restrictions.Gt(Projections.SubQuery(crit), 0))
    .Add(Restrictions.Eq(&amp;quot;p.Alive&amp;quot;,true))
    .AddOrder(Order.Asc(&amp;quot;p.Name&amp;quot;));&lt;/pre&gt;

&lt;p&gt;What we had to do is to create a DetachedCriteria and on that execute CreateCriteria so that we can do querying on our collection.&lt;/p&gt;

&lt;p&gt;The other way is simpler, but requires you to use HQL (below query is provided by &lt;a href="http://fabiomaulo.blogspot.com/" target="_blank"&gt;Fabio Maulo&lt;/a&gt;)&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;session.CreateQuery(&amp;quot;from Person p where  size(p.Pets) &amp;gt; 0 and p.Visible = true order by p.Name&amp;quot;)&lt;/pre&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;session.CreateQuery(&amp;quot;from Person p where  p.Pets.size &amp;gt; 0 and p.Visible = true order by p.Name&amp;quot;)&lt;/pre&gt;

&lt;p&gt;I hope this helps.&lt;/p&gt;

&lt;p&gt;&lt;a style="text-decoration:none;" href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdevlicio.us%2fblogs%2ftuna_toksoz%2farchive%2f2009%2f07%2f10%2fquerying-on-child-count-with-nhibernate.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdevlicio.us%2fblogs%2ftuna_toksoz%2farchive%2f2009%2f07%2f10%2fquerying-on-child-count-with-nhibernate.aspx&amp;amp;bgcolor=3333FF" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://dotnetshoutout.com/Querying-on-Child-Count-With-NHibernate-Tuna-Toksoz-Devlicious" rev="vote-for"&gt;&lt;img style="border-right-width:0px;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fdevlicio.us%2Fblogs%2Ftuna_toksoz%2Farchive%2F2009%2F07%2F10%2Fquerying-on-child-count-with-nhibernate.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49317" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/661vGXaEzqE" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/nhibernate/default.aspx">nhibernate</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/10/querying-on-child-count-with-nhibernate.aspx</feedburner:origLink></item><item><title>What is a build script? Writing MsBuild Scripts - Part I</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/wq1TPsYccZI/what-is-a-build-script-writing-msbuild-scripts-part-i.aspx</link><pubDate>Sun, 05 Jul 2009 18:36:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49081</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>9</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49081</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49081</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/05/what-is-a-build-script-writing-msbuild-scripts-part-i.aspx#comments</comments><description>&lt;p&gt;I was thinking of writing post series on NAnt but then I decided to write some on MsBuild first. &lt;/p&gt;
&lt;p&gt;This post will briefly introduce you the basic concepts of automation of build, why we need build tools/scripts, and what alternatives we have. &lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s first start with the definition of build script/tool.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;What is a build script?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A build script is all about automation. When we compile projects, we also want to perform some other steps such as running tests, compiling documentation, create an examples package, move some files from one location to another, and in the end zip them, or create an installer for the project. Doing them by hand is not really an option, and you may have thought of preparing a batch file/shell script before you learnt the build files.&lt;/p&gt;
&lt;p&gt;For me, Makefile was the first place that I heard about the term &amp;ldquo;build script&amp;rdquo;. It is mainly used in Linux to compile applications.&lt;/p&gt;
&lt;p&gt;When we take a look at a sample makefile&lt;/p&gt;
&lt;pre&gt;&lt;tt&gt;&lt;br /&gt;OBJS = main.obj io.obj&lt;br /&gt;CC = bcc&lt;br /&gt;MODEL = s&lt;br /&gt;CFLAGS = &amp;ndash;m$(MODEL) &lt;br /&gt;&lt;/tt&gt;&lt;tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;project.exe : $(OBJS)&lt;br /&gt;	tlink c0$(MODEL) $(OBJS), $(.TARGET),, c$(MODEL) /Lf:\bc\lib&lt;br /&gt;&lt;br /&gt;main.obj : main.c&lt;br /&gt;	$(CC) $(CFLAGS) &amp;ndash;c $(.SOURCE)&lt;br /&gt;&lt;br /&gt;io.obj : io.c&lt;br /&gt;	$(CC) $(CFLAGS) &amp;ndash;c $(.SOURCE)&lt;br /&gt;&lt;br /&gt;  	$(OBJS) : incl.h&lt;/tt&gt; &lt;/pre&gt;
&lt;p&gt;First we have several properties which we&amp;rsquo;ll use later, they are like variables. 
  &lt;br /&gt;Then we have some targets which has &amp;ldquo;:&amp;rdquo; on the right. On the right of &amp;ldquo;:&amp;rdquo;, we have their &amp;ldquo;dependencies&amp;rdquo;. A dependency is a unit that has to be run before the dependent, or a file that our file depends on. For example, main.obj depends on main.c and in case main.c is modified, we will run that target again. The lines after the target are the commands which will be run as part of the target.&lt;/p&gt;
&lt;p&gt;This dependency idea is key to every build system and main points in writing a build script is to find dependencies of your project. After you define them, the rest is a piece of chocolate cake!&lt;/p&gt;
&lt;p&gt;OK, i spoke too much Linux for a .net blog :) Let&amp;rsquo;s turn to our beautiful .net World.&lt;/p&gt;
&lt;p&gt;In .net world, there are 2(AFAIK, if not please comment) build tools written specifically for .NET. One is the famous NAnt, and the other is MsBuild. NAnt is usually used in OpenSource project. MsBuild is being used since VS 2005, and it is part of the framework. Your csproj files are actually MsBuild files.&lt;/p&gt;
&lt;p&gt;Most people say that that nant is more flexible and mature, but they also say that the nativeness of MsBuild into visual studio is a plus. Some they say that they delegate the build to MsBuild while using Nant for other stuff.&lt;/p&gt;
&lt;p&gt;In the next post, we&amp;rsquo;ll write(and use .csproj) a basic MsBuild script. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you like the post, please kick it and shout it.&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdevlicio.us%2fblogs%2ftuna_toksoz%2farchive%2f2009%2f07%2f05%2fwhat-is-a-build-script-writing-msbuild-scripts-part-i.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdevlicio.us%2fblogs%2ftuna_toksoz%2farchive%2f2009%2f07%2f05%2fwhat-is-a-build-script-writing-msbuild-scripts-part-i.aspx&amp;amp;bgcolor=3333FF" alt="kick it on DotNetKicks.com" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;a rev="vote-for" href="http://dotnetshoutout.com/What-is-a-build-script-Writing-MsBuild-Scripts-Part-I-Tuna-Toksoz-Devlicious"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fdevlicio.us%2Fblogs%2Ftuna_toksoz%2Farchive%2F2009%2F07%2F05%2Fwhat-is-a-build-script-writing-msbuild-scripts-part-i.aspx&amp;amp;textBackColor=3333FF&amp;amp;countBackColor=D4E1ED&amp;amp;countForeColor=000000" style="border:0px;" width="103" height="22" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49081" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/wq1TPsYccZI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/msbuild/default.aspx">msbuild</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/05/what-is-a-build-script-writing-msbuild-scripts-part-i.aspx</feedburner:origLink></item><item><title>TeamCity Remote Runs / Personal Builds</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/q4pDaMKkfLI/teamcity-remote-runs-personal-builds.aspx</link><pubDate>Fri, 03 Jul 2009 12:44:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49038</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49038</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49038</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/03/teamcity-remote-runs-personal-builds.aspx#comments</comments><description>&lt;p&gt;This is a killer feature of TeamCity against other CI servers, I believe. &lt;/p&gt;
&lt;p&gt;TC allows you to test your changes before committing them to the Source Control Repository, which means that you don&amp;rsquo;t have to worry about breaking the build, because you won&amp;rsquo;t :)&lt;/p&gt;
&lt;p&gt;I needed this in order to try a fix that I had for an issue in NH, it worked on my machine but&amp;nbsp; not sure if it works on another one.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://kozmic.pl"&gt;Krzysztof Kozmic&lt;/a&gt; told me in the same evening that he&amp;rsquo;s going to try a fix against DP with personal build, and I thought it was a great idea!&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_thumb_5F00_0474E0A7.png" border="0" height="451" width="496" /&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then it runs your changes on one of the build agents.&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_thumb_5F00_621C8986.png" border="0" height="69" width="521" /&gt; &lt;/p&gt;
&lt;p&gt;There we go! Patch didn&amp;rsquo;t break anything (even though it may not be how it should be)&lt;/p&gt;
&lt;p&gt;Keep up the good work, JetBrains!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49038" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/q4pDaMKkfLI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/teamcity/default.aspx">teamcity</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/03/teamcity-remote-runs-personal-builds.aspx</feedburner:origLink></item><item><title>Ignoring files/folders when committing to SVN repository</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/t0Y3Pe5BSdM/ignoring-files-folders-when-committing-to-svn-repository.aspx</link><pubDate>Fri, 03 Jul 2009 12:43:36 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49037</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>7</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=49037</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=49037</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/03/ignoring-files-folders-when-committing-to-svn-repository.aspx#comments</comments><description>&lt;p&gt;This feature of SVN is very handy. After you build your projects, there will be dlls in bin folders etc which you don’t want to commit.&lt;/p&gt;  &lt;p&gt;Using svn:ignore property of SVN, you can eliminate the possibility of committing those files!&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/tuna_5F00_toksoz/image_5F00_thumb_5F00_19025823.png" width="479" height="240" /&gt;&lt;/p&gt;  &lt;p&gt;As many other things, I learnt this from NH :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49037" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/t0Y3Pe5BSdM" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/SVN/default.aspx">SVN</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/source+control/default.aspx">source control</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/Tips-and-Tricks/default.aspx">Tips-and-Tricks</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/Development/default.aspx">Development</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/07/03/ignoring-files-folders-when-committing-to-svn-repository.aspx</feedburner:origLink></item><item><title>Fluent Interface for NH Facility – Take 1</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/N2jUk8si7Nc/fluent-interface-for-nh-facility-take-1.aspx</link><pubDate>Sat, 27 Jun 2009 11:39:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:48777</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=48777</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=48777</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/06/27/fluent-interface-for-nh-facility-take-1.aspx#comments</comments><description>&lt;p&gt;We’ve been getting many requests on having fluent configuration for NHibernate Integration Facility, and as I like programmatic configuration more than XML configuration (did I mention that I hate XML?), I decided to work on it. After 2-3 hours, I got the below more or less working&lt;/p&gt;  &lt;pre class="c-sharp" name="code"&gt;container.Register(
Fluently.ConfigureFacility()
    .Id(&amp;quot;nhibernateFacility&amp;quot;)
    .DefaultConfigurationBuilder&amp;lt;DefaultConfigurationBuilder&amp;gt;()
    .DefaultConfigurationPersister&amp;lt;DefaultConfigurationPersister&amp;gt;()
    .AddFactory(
                    Fluently.ConfigureFactory()
                        .Alias(&amp;quot;myAlias&amp;quot;)
                        .Id(&amp;quot;myId&amp;quot;)
                        .UsingConfiguration(
                        FactoryConfigurator.DefaultBuilder()
                            .ConnectionProvider(&amp;quot;…………………………&amp;quot;)
                            .ConnectionDriver(&amp;quot;…………………………&amp;quot;)
                            .ConnectionString(&amp;quot;…………………………&amp;quot;)
                            .Dialect(&amp;quot;…………………………&amp;quot;)
                            .ProxyFactory(&amp;quot;…………………………&amp;quot;)
                            .Assemblies(&amp;quot;…………………………&amp;quot;)))
    .AddFactory(
                    Fluently.ConfigureFactory()
                        .Alias(&amp;quot;myAlias&amp;quot;)
                        .Id(&amp;quot;myId&amp;quot;)
                        .UsingConfiguration(
                        FactoryConfigurator.XmlBuilder().File(&amp;quot;myFile.xml&amp;quot;))));&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pieces in Italic are not necessary to write as they have their defaults, also we have some generic overloads for things like Dialect, ProxyFactory and ConnectionProvider.&lt;/p&gt;

&lt;p&gt;What the above interface does is that it actually converts all the above configuration to IConfiguration and add them to the container as Facility Configuration, this is actually what is done behind the scenes when you use XML configuration. &lt;/p&gt;

&lt;p&gt;I asked for a review over the syntax from several tweeps (&lt;a href="http://twitter.com/kkozmic"&gt;@kkozmic&lt;/a&gt;, &lt;a href="http://twitter.com/dagda1"&gt;@dagda1&lt;/a&gt;, &lt;a href="http://twitter.com/mikehadlow"&gt;@mikehadlow&lt;/a&gt;, &lt;a href="http://twitter.com/chriscanal"&gt;@chriscanal&lt;/a&gt;) and from one other NH Facility user, German Schuager, and got great feedback.&lt;/p&gt;

&lt;p&gt;One of the issues that they pointed out with the above interface is that it is less discoverable. You have to find Fluently class, and then FactoryConfigurator class. Another issue is that it feels less natural to configure the facility like this. Instead, they prefer the configuration take place right on the facility.&lt;/p&gt;

&lt;p&gt;This one is what &lt;a href="http://blog.schuager.com"&gt;German Schuager&lt;/a&gt; has suggested&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;container.AddFacility&amp;lt;NHibernateFacility&amp;gt;(&amp;quot;nhibernateFacility&amp;quot;, cfg =&amp;gt; cfg
        .DefaultConfigurationBuilder&amp;lt;DefaultConfigurationBuilder&amp;gt;()
        .DefaultConfigurationPersister&amp;lt;DefaultConfigurationPersister&amp;gt;()
        .AddFactory(&amp;quot;id1&amp;quot;, f =&amp;gt; f
                .Alias(&amp;quot;myAlias&amp;quot;)
                .UsingConfiguration&amp;lt;DefaultBuilder&amp;gt;(c =&amp;gt; c
                        .ConnectionProvider(&amp;quot;………&amp;quot;)
                        .ConnectionDriver(&amp;quot;………&amp;quot;)
                        .ConnectionString(&amp;quot;………&amp;quot;)
                        .Dialect(&amp;quot;………&amp;quot;)
                        .ProxyFactory(&amp;quot;………&amp;quot;)
                        .Assemblies(&amp;quot;………&amp;quot;)
                ))
        .AddFactory(&amp;quot;id2&amp;quot;, f =&amp;gt; f
                .Alias(&amp;quot;alias&amp;quot;)
                .UsingConfiguration&amp;lt;XmlBuilder&amp;gt;(c =&amp;gt; c
                        .ReadFrom(&amp;quot;myfile.xml&amp;quot;)
                ))
 });&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and similar one from &lt;a href="http://kozmic.pl"&gt;Krzysztof Kozmic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Looks like i was the only one that is fan of Castle Microkernel style Fluent Interface. &lt;/p&gt;

&lt;p&gt;Let’s see what I’ll come up for the second take, If I ever do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=48777" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/N2jUk8si7Nc" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/nhibernate/default.aspx">nhibernate</category><category domain="http://devlicio.us/blogs/tuna_toksoz/archive/tags/castle/default.aspx">castle</category><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/06/27/fluent-interface-for-nh-facility-take-1.aspx</feedburner:origLink></item><item><title>Two VANs on Castle Project</title><link>http://feedproxy.google.com/~r/devlicious-tunatoksoz/~3/bdT8rRE7gv8/two-vans-on-castle-project.aspx</link><pubDate>Sat, 27 Jun 2009 09:25:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:48776</guid><dc:creator>Tuna Toksoz</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://devlicio.us/blogs/tuna_toksoz/rsscomments.aspx?PostID=48776</wfw:commentRss><wfw:comment>http://devlicio.us/blogs/tuna_toksoz/commentapi.aspx?PostID=48776</wfw:comment><comments>http://devlicio.us/blogs/tuna_toksoz/archive/2009/06/27/two-vans-on-castle-project.aspx#comments</comments><description>&lt;p&gt;I like VAN meetings, and I believe I am gaining a lot from them. Due to some time zone problem, I remember waiting 1 hour in front of the PC :) I had even plans for presenting something on those VANs but nah things don&amp;rsquo;t go like the way I want. Zachariah Young informed me that there are 2 VANs in the following two weeks that cover some topic on Castle. I believe it would be a good idea to join to those meetings, even if you&amp;rsquo;re using some other framework or don&amp;rsquo;t use anything at all. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ryan will be doing a two part series on the Castle Project.&amp;nbsp; Mark your calendar for some Castle Project fun.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;A little information on Ryan Svihla&lt;/b&gt;     &lt;br /&gt;&lt;i&gt;Ryan Svihla has been working as a C# developer Farm Bureau Bank in San Antonio since September 2007. Before that he worked as&amp;nbsp; a Consultant in Lincoln, NE for 3 years, where he had working experience with Php, some Perl, Python and of course C#.&amp;nbsp; Attemping Agile since early 2008 as an eager student with a focus on making programming more useful and relevant for the end user.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt; &lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;   &lt;br /&gt;&lt;b&gt;IoC and Dip through Castle Windsor      &lt;br /&gt;&lt;/b&gt;I assume readers have some familiarity with IoC and DI, so I skip description     &lt;br /&gt;Central Daylight Time     &lt;br /&gt;&lt;b&gt;Start Time:&lt;/b&gt; Web, July 1, 2009 8:00 PM UTC/GMT -5 hours     &lt;br /&gt;&lt;b&gt;End Time:&lt;/b&gt; Web, July 1, 2009 10:00 PM UTC/GMT -5 hours     &lt;br /&gt;&lt;b&gt;Attendee URL:&lt;/b&gt; &lt;a href="http://snipr.com/virtualaltnet"&gt;http://snipr.com/virtualaltnet&lt;/a&gt; (Live Meeting) &lt;/p&gt;
&lt;p&gt;   &lt;br /&gt;&lt;b&gt;Web Development with Castle Monorail, Active Record and Brail view engine&lt;/b&gt;     &lt;br /&gt;Have a look at the first popular MVC&amp;nbsp; .Net based web framework. Also will be covering persistance with ActiveRecord, and view templates using Brail.&amp;nbsp; Bonus, will demo a plugin framework for building CMS like applications.     &lt;br /&gt;Central Daylight Time     &lt;br /&gt;&lt;b&gt;Start Time:&lt;/b&gt; Web, July 8, 2009 8:00 PM UTC/GMT -5 hours     &lt;br /&gt;&lt;b&gt;End Time:&lt;/b&gt; Web, July 8, 2009 10:00 PM UTC/GMT -5 hours     &lt;br /&gt;&lt;b&gt;Attendee URL: &lt;/b&gt;&lt;a href="http://snipr.com/virtualaltnet"&gt;http://snipr.com/virtualaltnet&lt;/a&gt; (Live Meeting) &lt;/p&gt;
&lt;p&gt;   &lt;br /&gt;For more info on VAN go to &lt;a href="http://www.virtualaltnet.com"&gt;www.virtualaltnet.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll try to join those, see you there!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=48776" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/devlicious-tunatoksoz/~4/bdT8rRE7gv8" height="1" width="1"/&gt;</description><feedburner:origLink>http://devlicio.us/blogs/tuna_toksoz/archive/2009/06/27/two-vans-on-castle-project.aspx</feedburner:origLink></item></channel></rss>
