PageRenderTime 172ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Help/html/_mongo_services_config_8cs_source.html

http://mongoservices.codeplex.com
HTML | 176 lines | 169 code | 3 blank | 4 comment | 0 complexity | 8771657f19511e1280c52badfb851229 MD5 | raw file
Possible License(s): MIT, Apache-2.0, BSD-3-Clause
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <title>MongoServices: C:/Development/MongoServices/Source/MongoServices/Configuration/MongoServicesConfig.cs Source File</title>
  6. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  7. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  8. <script type="text/javascript" src="search/search.js"></script>
  9. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="navtree.js"></script>
  12. <script type="text/javascript" src="resize.js"></script>
  13. <script type="text/javascript">
  14. $(document).ready(initResizable);
  15. </script>
  16. <link href="doxygen.css" rel="stylesheet" type="text/css"/>
  17. </head>
  18. <body onload='searchBox.OnSelectItem(0);'>
  19. <!-- Generated by Doxygen 1.7.4 -->
  20. <script type="text/javascript"><!--
  21. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  22. --></script>
  23. <div id="top">
  24. <div id="titlearea">
  25. <table cellspacing="0" cellpadding="0">
  26. <tbody>
  27. <tr style="height: 56px;">
  28. <td style="padding-left: 0.5em;">
  29. <div id="projectname">MongoServices&#160;<span id="projectnumber">0.2.0</span></div>
  30. <div id="projectbrief">A Service/Repository Framework for mongoDB</div>
  31. </td>
  32. </tr>
  33. </tbody>
  34. </table>
  35. </div>
  36. <div id="navrow1" class="tabs">
  37. <ul class="tablist">
  38. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  39. <li><a href="namespaces.html"><span>Packages</span></a></li>
  40. <li><a href="annotated.html"><span>Classes</span></a></li>
  41. <li class="current"><a href="files.html"><span>Files</span></a></li>
  42. <li id="searchli">
  43. <div id="MSearchBox" class="MSearchBoxInactive">
  44. <span class="left">
  45. <img id="MSearchSelect" src="search/mag_sel.png"
  46. onmouseover="return searchBox.OnSearchSelectShow()"
  47. onmouseout="return searchBox.OnSearchSelectHide()"
  48. alt=""/>
  49. <input type="text" id="MSearchField" value="Search" accesskey="S"
  50. onfocus="searchBox.OnSearchFieldFocus(true)"
  51. onblur="searchBox.OnSearchFieldFocus(false)"
  52. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  53. </span><span class="right">
  54. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  55. </span>
  56. </div>
  57. </li>
  58. </ul>
  59. </div>
  60. <div id="navrow2" class="tabs2">
  61. <ul class="tablist">
  62. <li><a href="files.html"><span>File&#160;List</span></a></li>
  63. </ul>
  64. </div>
  65. </div>
  66. <div id="side-nav" class="ui-resizable side-nav-resizable">
  67. <div id="nav-tree">
  68. <div id="nav-tree-contents">
  69. </div>
  70. </div>
  71. <div id="splitbar" style="-moz-user-select:none;"
  72. class="ui-resizable-handle">
  73. </div>
  74. </div>
  75. <script type="text/javascript">
  76. initNavTree('_mongo_services_config_8cs.html','');
  77. </script>
  78. <div id="doc-content">
  79. <div class="header">
  80. <div class="headertitle">
  81. <div class="title">C:/Development/MongoServices/Source/MongoServices/Configuration/MongoServicesConfig.cs</div> </div>
  82. </div>
  83. <div class="contents">
  84. <a href="_mongo_services_config_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ???using System;
  85. <a name="l00002"></a>00002 <span class="keyword">using</span> System.Collections.Generic;
  86. <a name="l00003"></a>00003 <span class="keyword">using</span> System.Linq;
  87. <a name="l00004"></a>00004 <span class="keyword">using</span> System.Text;
  88. <a name="l00005"></a>00005 <span class="keyword">using</span> System.Reflection;
  89. <a name="l00006"></a>00006 <span class="keyword">using</span> MongoDB.Driver;
  90. <a name="l00007"></a>00007
  91. <a name="l00008"></a>00008 <span class="keyword">namespace </span>MongoServices
  92. <a name="l00009"></a>00009 {
  93. <a name="l00013"></a>00013 <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class </span>MongoServicesConfig
  94. <a name="l00014"></a>00014 {
  95. <a name="l00015"></a>00015 <span class="keyword">private</span> <span class="keyword">static</span> Action&lt;Assembly, Type, List&lt;Type&gt;&gt; getTypes = (assembly, type, list) =&gt; {
  96. <a name="l00016"></a>00016 list.AddRange(assembly.GetTypes().Where(t =&gt; type.IsAssignableFrom(t) &amp;&amp; t.IsClass));
  97. <a name="l00017"></a>00017 };
  98. <a name="l00018"></a>00018
  99. <a name="l00024"></a>00024 <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> Initialize()
  100. <a name="l00025"></a>00025 {
  101. <a name="l00026"></a>00026 var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
  102. <a name="l00027"></a>00027
  103. <a name="l00028"></a>00028 InitializeServiceConfig(assemblies);
  104. <a name="l00029"></a>00029 InitializeRepositoryConfig(assemblies);
  105. <a name="l00030"></a>00030 InitializeModelConfig(assemblies);
  106. <a name="l00031"></a>00031 }
  107. <a name="l00032"></a>00032
  108. <a name="l00033"></a>00033 <span class="keyword">private</span> <span class="keyword">static</span> <span class="keywordtype">void</span> InitializeModelConfig(List&lt;Assembly&gt; assemblies)
  109. <a name="l00034"></a>00034 {
  110. <a name="l00035"></a>00035 var types = <span class="keyword">new</span> List&lt;Type&gt;();
  111. <a name="l00036"></a>00036
  112. <a name="l00037"></a>00037 assemblies.ForEach(a =&gt; getTypes(a, typeof(IMongoServicesModelInitializer), types));
  113. <a name="l00038"></a>00038
  114. <a name="l00039"></a>00039 <span class="keywordflow">foreach</span> (var t <span class="keywordflow">in</span> types)
  115. <a name="l00040"></a>00040 {
  116. <a name="l00041"></a>00041 ((IMongoServicesModelInitializer)Activator.CreateInstance(t)).Setup();
  117. <a name="l00042"></a>00042 }
  118. <a name="l00043"></a>00043 }
  119. <a name="l00044"></a>00044
  120. <a name="l00045"></a>00045 <span class="keyword">private</span> <span class="keyword">static</span> <span class="keywordtype">void</span> InitializeRepositoryConfig(List&lt;Assembly&gt; assemblies)
  121. <a name="l00046"></a>00046 {
  122. <a name="l00047"></a>00047 var types = <span class="keyword">new</span> List&lt;Type&gt;();
  123. <a name="l00048"></a>00048
  124. <a name="l00049"></a>00049 assemblies.ForEach(a =&gt; getTypes(a, typeof(IMongoServicesRepositoryInitializer), types));
  125. <a name="l00050"></a>00050
  126. <a name="l00051"></a>00051 <span class="keywordflow">foreach</span> (var t <span class="keywordflow">in</span> types)
  127. <a name="l00052"></a>00052 {
  128. <a name="l00053"></a>00053 ((IMongoServicesRepositoryInitializer)Activator.CreateInstance(t)).Setup();
  129. <a name="l00054"></a>00054 }
  130. <a name="l00055"></a>00055 }
  131. <a name="l00056"></a>00056
  132. <a name="l00057"></a>00057 <span class="keyword">private</span> <span class="keyword">static</span> <span class="keywordtype">void</span> InitializeServiceConfig(List&lt;Assembly&gt; assemblies)
  133. <a name="l00058"></a>00058 {
  134. <a name="l00059"></a>00059 var types = <span class="keyword">new</span> List&lt;Type&gt;();
  135. <a name="l00060"></a>00060
  136. <a name="l00061"></a>00061 assemblies.ForEach(a =&gt; getTypes(a, typeof(IMongoServicesServiceInitializer), types));
  137. <a name="l00062"></a>00062
  138. <a name="l00063"></a>00063 <span class="keywordflow">foreach</span> (var t <span class="keywordflow">in</span> types)
  139. <a name="l00064"></a>00064 {
  140. <a name="l00065"></a>00065 ((IMongoServicesServiceInitializer)Activator.CreateInstance(t)).Setup();
  141. <a name="l00066"></a>00066 }
  142. <a name="l00067"></a>00067 }
  143. <a name="l00068"></a>00068
  144. <a name="l00073"></a>00073 <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> SetMongoUrlProvider(Func&lt;MongoUrl&gt; provider)
  145. <a name="l00074"></a>00074 {
  146. <a name="l00075"></a>00075 GlobalConfigContainer.Instance.MongoUrlProvider = provider;
  147. <a name="l00076"></a>00076 }
  148. <a name="l00077"></a>00077 }
  149. <a name="l00078"></a>00078 }
  150. </pre></div></div>
  151. </div>
  152. <div id="nav-path" class="navpath">
  153. <ul>
  154. <li class="navelem"><a class="el" href="_mongo_services_config_8cs.html">MongoServicesConfig.cs</a> </li>
  155. <li class="footer">Generated on Thu May 26 2011 20:24:47 for MongoServices by&#160;
  156. <a href="http://www.doxygen.org/index.html">
  157. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
  158. </ul>
  159. </div>
  160. <!-- window showing the filter options -->
  161. <div id="MSearchSelectWindow"
  162. onmouseover="return searchBox.OnSearchSelectShow()"
  163. onmouseout="return searchBox.OnSearchSelectHide()"
  164. onkeydown="return searchBox.OnSearchSelectKey(event)">
  165. <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Properties</a></div>
  166. <!-- iframe showing the search results (closed by default) -->
  167. <div id="MSearchResultsWindow">
  168. <iframe src="javascript:void(0)" frameborder="0"
  169. name="MSearchResults" id="MSearchResults">
  170. </iframe>
  171. </div>
  172. </body>
  173. </html>