Skip to content
This repository
Browse code

Added initial S#arp Lite codebase including source, example project, …

…and Templify template. See README.txt for setup guidance.
  • Loading branch information...
commit 7f6d31f73e15d232cc6f7e63f6d50fc9dda2ab11 0 parents
authored November 01, 2011

Showing 238 changed files with 95,813 additions and 0 deletions. Show diff stats Hide diff stats

  1. BIN  Example/MyStore.suo
  2. 56  Example/MyStore/MyStore.sln
  3. BIN  Example/MyStore/MyStore.suo
  4. 111  Example/MyStore/app/MyStore.DB/schema/UnitTestGeneratedSchema.sql
  5. 30  Example/MyStore/app/MyStore.Domain/ActionConfirmation.cs
  6. 19  Example/MyStore/app/MyStore.Domain/Address.cs
  7. 38  Example/MyStore/app/MyStore.Domain/Customer.cs
  8. 19  Example/MyStore/app/MyStore.Domain/Money.cs
  9. 78  Example/MyStore/app/MyStore.Domain/MyStore.Domain.csproj
  10. 42  Example/MyStore/app/MyStore.Domain/Order.cs
  11. 33  Example/MyStore/app/MyStore.Domain/OrderLineItem.cs
  12. 18  Example/MyStore/app/MyStore.Domain/OrderStatusType.cs
  13. 33  Example/MyStore/app/MyStore.Domain/ProductMgmt/Product.cs
  14. 37  Example/MyStore/app/MyStore.Domain/ProductMgmt/ProductCategory.cs
  15. 18  Example/MyStore/app/MyStore.Domain/ProductMgmt/Queries/IQueryForProductOrderSummaries.cs
  16. 9  Example/MyStore/app/MyStore.Domain/ProductMgmt/Queries/ProductOrderSummaryDto.cs
  17. 4  Example/MyStore/app/MyStore.Domain/ProductMgmt/Queries/README.txt
  18. 36  Example/MyStore/app/MyStore.Domain/Properties/AssemblyInfo.cs
  19. 9  Example/MyStore/app/MyStore.Domain/Queries/CustomerOrderSummaryDto.cs
  20. 23  Example/MyStore/app/MyStore.Domain/Queries/FindActiveCustomers.cs
  21. 21  Example/MyStore/app/MyStore.Domain/Queries/QueryForCustomerOrderSummaries.cs
  22. 5  Example/MyStore/app/MyStore.Domain/Queries/README.txt
  23. 23  Example/MyStore/app/MyStore.Domain/Validators/DataAnnotationsValidator.cs
  24. 1  Example/MyStore/app/MyStore.Domain/Validators/README.txt
  25. 33  Example/MyStore/app/MyStore.Init/DependencyResolverInitializer.cs
  26. 85  Example/MyStore/app/MyStore.Init/MyStore.Init.csproj
  27. 36  Example/MyStore/app/MyStore.Init/Properties/AssemblyInfo.cs
  28. 33  Example/MyStore/app/MyStore.Init/StructureMapDependencyResolver.cs
  29. 74  Example/MyStore/app/MyStore.NHibernateProvider/Conventions.cs
  30. 91  Example/MyStore/app/MyStore.NHibernateProvider/MyStore.NHibernateProvider.csproj
  31. 30  Example/MyStore/app/MyStore.NHibernateProvider/NHibernateInitializer.cs
  32. 14  Example/MyStore/app/MyStore.NHibernateProvider/Overrides/ContractTypeCustomType.cs
  33. 9  Example/MyStore/app/MyStore.NHibernateProvider/Overrides/IOverride.cs
  34. 19  Example/MyStore/app/MyStore.NHibernateProvider/Overrides/OrderOverride.cs
  35. 41  Example/MyStore/app/MyStore.NHibernateProvider/Overrides/ProductCategoryOverride.cs
  36. 23  Example/MyStore/app/MyStore.NHibernateProvider/Overrides/ProductOverride.cs
  37. 8  Example/MyStore/app/MyStore.NHibernateProvider/Overrides/README.txt
  38. 36  Example/MyStore/app/MyStore.NHibernateProvider/Properties/AssemblyInfo.cs
  39. 47  Example/MyStore/app/MyStore.NHibernateProvider/Queries/QueryForProductOrderSummaries.cs
  40. 12  Example/MyStore/app/MyStore.NHibernateProvider/Queries/README.txt
  41. 145  Example/MyStore/app/MyStore.Tasks/BaseEntityCudTasks.cs
  42. 19  Example/MyStore/app/MyStore.Tasks/CustomerCudTasks.cs
  43. 75  Example/MyStore/app/MyStore.Tasks/MyStore.Tasks.csproj
  44. 60  Example/MyStore/app/MyStore.Tasks/ProductMgmt/ProductCategoryCudTasks.cs
  45. 42  Example/MyStore/app/MyStore.Tasks/ProductMgmt/ProductCudTasks.cs
  46. 11  Example/MyStore/app/MyStore.Tasks/ProductMgmt/ViewModels/EditProductCategoryViewModel.cs
  47. 11  Example/MyStore/app/MyStore.Tasks/ProductMgmt/ViewModels/EditProductViewModel.cs
  48. 3  Example/MyStore/app/MyStore.Tasks/ProductMgmt/ViewModels/README.txt
  49. 36  Example/MyStore/app/MyStore.Tasks/Properties/AssemblyInfo.cs
  50. 9  Example/MyStore/app/MyStore.Tasks/ViewModels/EditCustomerViewModel.cs
  51. 5  Example/MyStore/app/MyStore.Tasks/ViewModels/README.txt
  52. 6  Example/MyStore/app/MyStore.Tests/App.config
  53. 75  Example/MyStore/app/MyStore.Tests/MyStore.Tests.csproj
  54. 52  Example/MyStore/app/MyStore.Tests/NHibernateProvider/MappingIntegrationTests.cs
  55. 36  Example/MyStore/app/MyStore.Tests/Properties/AssemblyInfo.cs
  56. 65  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Controllers/ProductCategoriesController.cs
  57. 81  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Controllers/ProductsController.cs
  58. 21  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/ProductMgmtAreaRegistration.cs
  59. 35  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/ProductCategories/Details.cshtml
  60. 40  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/ProductCategories/Edit.cshtml
  61. 39  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/ProductCategories/Index.cshtml
  62. 20  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/Products/Details.cshtml
  63. 39  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/Products/Edit.cshtml
  64. 54  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/Products/Index.cshtml
  65. 36  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/Products/ShowProductOrderSummaries.cshtml
  66. 58  Example/MyStore/app/MyStore.Web/Areas/ProductMgmt/Views/Web.config
  67. 24  Example/MyStore/app/MyStore.Web/Binders/MoneyBinder.cs
  68. 102  Example/MyStore/app/MyStore.Web/Content/Site.css
  69. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  70. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  71. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  72. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  73. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  74. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  75. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  76. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  77. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-icons_222222_256x240.png
  78. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  79. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-icons_454545_256x240.png
  80. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-icons_888888_256x240.png
  81. BIN  Example/MyStore/app/MyStore.Web/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  82. 24  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.accordion.css
  83. 16  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.all.css
  84. 62  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.autocomplete.css
  85. 11  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.base.css
  86. 43  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.button.css
  87. 46  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.core.css
  88. 73  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.datepicker.css
  89. 26  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.dialog.css
  90. 16  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.progressbar.css
  91. 25  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.resizable.css
  92. 15  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.selectable.css
  93. 29  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.slider.css
  94. 23  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.tabs.css
  95. 257  Example/MyStore/app/MyStore.Web/Content/themes/base/jquery.ui.theme.css
  96. 75  Example/MyStore/app/MyStore.Web/Controllers/CustomersController.cs
  97. 11  Example/MyStore/app/MyStore.Web/Controllers/HomeController.cs
  98. 1  Example/MyStore/app/MyStore.Web/Global.asax
  99. 39  Example/MyStore/app/MyStore.Web/Global.asax.cs
  100. 245  Example/MyStore/app/MyStore.Web/MyStore.Web.csproj
  101. 31  Example/MyStore/app/MyStore.Web/MyStore.Web.csproj.user
  102. 35  Example/MyStore/app/MyStore.Web/Properties/AssemblyInfo.cs
  103. 7,117  Example/MyStore/app/MyStore.Web/Scripts/MicrosoftAjax.debug.js
  104. 6  Example/MyStore/app/MyStore.Web/Scripts/MicrosoftAjax.js
  105. 408  Example/MyStore/app/MyStore.Web/Scripts/MicrosoftMvcAjax.debug.js
  106. 25  Example/MyStore/app/MyStore.Web/Scripts/MicrosoftMvcAjax.js
  107. 883  Example/MyStore/app/MyStore.Web/Scripts/MicrosoftMvcValidation.debug.js
  108. 55  Example/MyStore/app/MyStore.Web/Scripts/MicrosoftMvcValidation.js
  109. 9,110  Example/MyStore/app/MyStore.Web/Scripts/jquery-1.5.1-vsdoc.js
  110. 8,325  Example/MyStore/app/MyStore.Web/Scripts/jquery-1.5.1.js
  111. 19  Example/MyStore/app/MyStore.Web/Scripts/jquery-1.5.1.min.js
  112. 11,700  Example/MyStore/app/MyStore.Web/Scripts/jquery-ui-1.8.11.js
  113. 938  Example/MyStore/app/MyStore.Web/Scripts/jquery-ui-1.8.11.min.js
  114. 165  Example/MyStore/app/MyStore.Web/Scripts/jquery.unobtrusive-ajax.js
  115. 5  Example/MyStore/app/MyStore.Web/Scripts/jquery.unobtrusive-ajax.min.js
  116. 1,299  Example/MyStore/app/MyStore.Web/Scripts/jquery.validate-vsdoc.js
  117. 1,162  Example/MyStore/app/MyStore.Web/Scripts/jquery.validate.js
  118. 53  Example/MyStore/app/MyStore.Web/Scripts/jquery.validate.min.js
  119. 319  Example/MyStore/app/MyStore.Web/Scripts/jquery.validate.unobtrusive.js
  120. 5  Example/MyStore/app/MyStore.Web/Scripts/jquery.validate.unobtrusive.min.js
  121. 969  Example/MyStore/app/MyStore.Web/Scripts/modernizr-1.7.js
  122. 10  Example/MyStore/app/MyStore.Web/Scripts/modernizr-1.7.min.js
  123. 22  Example/MyStore/app/MyStore.Web/Views/Customers/Details.cshtml
  124. 28  Example/MyStore/app/MyStore.Web/Views/Customers/Edit.cshtml
  125. 46  Example/MyStore/app/MyStore.Web/Views/Customers/Index.cshtml
  126. 30  Example/MyStore/app/MyStore.Web/Views/Customers/ShowCustomerOrderSummaries.cshtml
  127. 6  Example/MyStore/app/MyStore.Web/Views/Home/Index.cshtml
  128. 8  Example/MyStore/app/MyStore.Web/Views/Shared/DisplayTemplates/Money.cshtml
  129. 8  Example/MyStore/app/MyStore.Web/Views/Shared/DisplayTemplates/String.cshtml
  130. 9  Example/MyStore/app/MyStore.Web/Views/Shared/EditorTemplates/Money.cshtml
  131. 9  Example/MyStore/app/MyStore.Web/Views/Shared/EditorTemplates/String.cshtml
  132. 15  Example/MyStore/app/MyStore.Web/Views/Shared/Error.cshtml
  133. 34  Example/MyStore/app/MyStore.Web/Views/Shared/_Layout.cshtml
  134. 58  Example/MyStore/app/MyStore.Web/Views/Web.config
  135. 3  Example/MyStore/app/MyStore.Web/Views/_ViewStart.cshtml
  136. 30  Example/MyStore/app/MyStore.Web/Web.Debug.config
  137. 31  Example/MyStore/app/MyStore.Web/Web.Release.config
  138. 84  Example/MyStore/app/MyStore.Web/Web.config
  139. BIN  Example/MyStore/app/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg
  140. BIN  Example/MyStore/app/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll
  141. 13,206  Example/MyStore/app/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.xml
  142. 969  Example/MyStore/app/packages/Modernizr.1.7/Content/Scripts/modernizr-1.7.js
  143. 10  Example/MyStore/app/packages/Modernizr.1.7/Content/Scripts/modernizr-1.7.min.js
  144. BIN  Example/MyStore/app/packages/Modernizr.1.7/Modernizr.1.7.nupkg
  145. 8,325  Example/MyStore/app/packages/jQuery.1.5.1/Content/Scripts/jquery-1.5.1.js
  146. 19  Example/MyStore/app/packages/jQuery.1.5.1/Content/Scripts/jquery-1.5.1.min.js
  147. BIN  Example/MyStore/app/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg
  148. BIN  ...re/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  149. BIN  ...e/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  150. BIN  ...e/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  151. BIN  ...e/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  152. BIN  ...e/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  153. BIN  ...e/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  154. BIN  ...e/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  155. BIN  ...kages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  156. BIN  ...Store/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_222222_256x240.png
  157. BIN  ...Store/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  158. BIN  ...Store/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_454545_256x240.png
  159. BIN  ...Store/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_888888_256x240.png
  160. BIN  ...Store/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  161. 24  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.accordion.css
  162. 16  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.all.css
  163. 62  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.autocomplete.css
  164. 11  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.base.css
  165. 43  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.button.css
  166. 46  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.core.css
  167. 73  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.datepicker.css
  168. 26  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.dialog.css
  169. 16  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.progressbar.css
  170. 25  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.resizable.css
  171. 15  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.selectable.css
  172. 29  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.slider.css
  173. 23  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.tabs.css
  174. 257  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.theme.css
  175. 11,700  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Scripts/jquery-ui-1.8.11.js
  176. 938  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/Content/Scripts/jquery-ui-1.8.11.min.js
  177. BIN  Example/MyStore/app/packages/jQuery.UI.Combined.1.8.11/jQuery.UI.Combined.1.8.11.nupkg
  178. 1,299  Example/MyStore/app/packages/jQuery.Validation.1.8.0/Content/Scripts/jquery.validate-vsdoc.js
  179. 1,162  Example/MyStore/app/packages/jQuery.Validation.1.8.0/Content/Scripts/jquery.validate.js
  180. 53  Example/MyStore/app/packages/jQuery.Validation.1.8.0/Content/Scripts/jquery.validate.min.js
  181. BIN  Example/MyStore/app/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg
  182. 9,110  Example/MyStore/app/packages/jQuery.vsdoc.1.5.1/Content/Scripts/jquery-1.5.1-vsdoc.js
  183. BIN  Example/MyStore/app/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg
  184. 4  Example/MyStore/app/packages/repositories.config
  185. BIN  Example/MyStore/lib/Iesi.Collections.dll
  186. BIN  Example/MyStore/lib/Inflector.Net.dll
  187. BIN  Example/MyStore/lib/NHibernate.dll
  188. BIN  Example/MyStore/lib/SharpLite.Domain.dll
  189. BIN  Example/MyStore/lib/SharpLite.NHibernateProvider.dll
  190. BIN  Example/MyStore/lib/SharpLite.Web.dll
  191. BIN  Example/MyStore/lib/StructureMap.dll
  192. BIN  Example/MyStore/lib/System.Web.Mvc.dll
  193. BIN  Example/MyStore/lib/log4net.dll
  194. BIN  Example/MyStore/lib/nunit.framework.dll
  195. 29  License.txt
  196. BIN  MyStore.suo
  197. 85  README.txt
  198. 38  SharpLiteSrc/SharpLite.sln
  199. BIN  SharpLiteSrc/SharpLite.suo
  200. 140  SharpLiteSrc/app/SharpLite.Domain/ComparableObject.cs
  201. 17  SharpLiteSrc/app/SharpLite.Domain/DataInterfaces/IDbContext.cs
  202. 9  SharpLiteSrc/app/SharpLite.Domain/DataInterfaces/IEntityDuplicateChecker.cs
  203. 46  SharpLiteSrc/app/SharpLite.Domain/DataInterfaces/IRepository.cs
  204. 14  SharpLiteSrc/app/SharpLite.Domain/DomainSignatureAttribute.cs
  205. 131  SharpLiteSrc/app/SharpLite.Domain/Entity.cs
  206. 16  SharpLiteSrc/app/SharpLite.Domain/IEntityWithTypedId.cs
  207. 36  SharpLiteSrc/app/SharpLite.Domain/Properties/AssemblyInfo.cs
  208. 75  SharpLiteSrc/app/SharpLite.Domain/SharpLite.Domain.csproj
  209. BIN  SharpLiteSrc/app/SharpLite.Domain/SharpLite.Domain.suo
  210. BIN  SharpLiteSrc/app/SharpLite.Domain/SharpLite.pfx
  211. 31  SharpLiteSrc/app/SharpLite.Domain/Validators/HasUniqueDomainSignatureAttribute.cs
  212. 41  SharpLiteSrc/app/SharpLite.EntityFrameworkProvider/DbContext.cs
  213. 18  SharpLiteSrc/app/SharpLite.EntityFrameworkProvider/EntityDuplicateChecker.cs
  214. 36  SharpLiteSrc/app/SharpLite.EntityFrameworkProvider/Properties/AssemblyInfo.cs
  215. 58  SharpLiteSrc/app/SharpLite.EntityFrameworkProvider/Repository.cs
  216. 76  SharpLiteSrc/app/SharpLite.EntityFrameworkProvider/SharpLite.EntityFrameworkProvider.csproj
  217. BIN  SharpLiteSrc/app/SharpLite.EntityFrameworkProvider/SharpLite.pfx
  218. 37  SharpLiteSrc/app/SharpLite.NHibernateProvider/DbContext.cs
  219. 109  SharpLiteSrc/app/SharpLite.NHibernateProvider/EntityDuplicateChecker.cs
  220. 101  SharpLiteSrc/app/SharpLite.NHibernateProvider/LazySessionContext.cs
  221. 36  SharpLiteSrc/app/SharpLite.NHibernateProvider/Properties/AssemblyInfo.cs
  222. 60  SharpLiteSrc/app/SharpLite.NHibernateProvider/Repository.cs
  223. 81  SharpLiteSrc/app/SharpLite.NHibernateProvider/SharpLite.NHibernateProvider.csproj
  224. BIN  SharpLiteSrc/app/SharpLite.NHibernateProvider/SharpLite.pfx
  225. 71  SharpLiteSrc/app/SharpLite.NHibernateProvider/Web/SessionPerRequestModule.cs
  226. 57  SharpLiteSrc/app/SharpLite.Web/Mvc/ModelBinder/EntityCollectionValueBinder.cs
  227. 34  SharpLiteSrc/app/SharpLite.Web/Mvc/ModelBinder/EntityRetriever.cs
  228. 49  SharpLiteSrc/app/SharpLite.Web/Mvc/ModelBinder/EntityValueBinder.cs
  229. 151  SharpLiteSrc/app/SharpLite.Web/Mvc/ModelBinder/SharpModelBinder.cs
  230. 36  SharpLiteSrc/app/SharpLite.Web/Properties/AssemblyInfo.cs
  231. 84  SharpLiteSrc/app/SharpLite.Web/SharpLite.Web.csproj
  232. BIN  SharpLiteSrc/app/SharpLite.Web/SharpLite.pfx
  233. BIN  SharpLiteSrc/app/SharpLite.suo
  234. BIN  SharpLiteSrc/docs/SharpLite.eap
  235. BIN  SharpLiteSrc/docs/SharpLite_Architecture.png
  236. BIN  SharpLiteSrc/docs/SharpLite_Logo.png
  237. BIN  SharpLiteSrc/lib/EntityFramework.dll
BIN  Example/MyStore.suo
Binary file not shown
56  Example/MyStore/MyStore.sln
... ...
@@ -0,0 +1,56 @@
  1
+
  2
+Microsoft Visual Studio Solution File, Format Version 11.00
  3
+# Visual Studio 2010
  4
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStore.Web", "app\MyStore.Web\MyStore.Web.csproj", "{3B107D47-9BB3-4D6A-80E2-E430D6C06F45}"
  5
+EndProject
  6
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStore.Domain", "app\MyStore.Domain\MyStore.Domain.csproj", "{74801410-F690-490C-91EA-CD94E520A465}"
  7
+EndProject
  8
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStore.NHibernateProvider", "app\MyStore.NHibernateProvider\MyStore.NHibernateProvider.csproj", "{4E471CAC-A108-49AE-A4D6-155DC35712C9}"
  9
+EndProject
  10
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStore.Tasks", "app\MyStore.Tasks\MyStore.Tasks.csproj", "{BE147A77-3E59-40E6-822D-5AEDFD5D383C}"
  11
+EndProject
  12
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStore.Tests", "app\MyStore.Tests\MyStore.Tests.csproj", "{CEF24DDD-1D15-42BC-B035-4A33388C3F8C}"
  13
+EndProject
  14
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStore.Init", "app\MyStore.Init\MyStore.Init.csproj", "{7112AC6B-C406-481D-99D4-56BA796B7173}"
  15
+EndProject
  16
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{EAA774FA-8EA7-4CE4-A406-16D7CE0BC4C1}"
  17
+EndProject
  18
+Global
  19
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
  20
+		Debug|Any CPU = Debug|Any CPU
  21
+		Release|Any CPU = Release|Any CPU
  22
+	EndGlobalSection
  23
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
  24
+		{3B107D47-9BB3-4D6A-80E2-E430D6C06F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  25
+		{3B107D47-9BB3-4D6A-80E2-E430D6C06F45}.Debug|Any CPU.Build.0 = Debug|Any CPU
  26
+		{3B107D47-9BB3-4D6A-80E2-E430D6C06F45}.Release|Any CPU.ActiveCfg = Release|Any CPU
  27
+		{3B107D47-9BB3-4D6A-80E2-E430D6C06F45}.Release|Any CPU.Build.0 = Release|Any CPU
  28
+		{74801410-F690-490C-91EA-CD94E520A465}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  29
+		{74801410-F690-490C-91EA-CD94E520A465}.Debug|Any CPU.Build.0 = Debug|Any CPU
  30
+		{74801410-F690-490C-91EA-CD94E520A465}.Release|Any CPU.ActiveCfg = Release|Any CPU
  31
+		{74801410-F690-490C-91EA-CD94E520A465}.Release|Any CPU.Build.0 = Release|Any CPU
  32
+		{4E471CAC-A108-49AE-A4D6-155DC35712C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  33
+		{4E471CAC-A108-49AE-A4D6-155DC35712C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
  34
+		{4E471CAC-A108-49AE-A4D6-155DC35712C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
  35
+		{4E471CAC-A108-49AE-A4D6-155DC35712C9}.Release|Any CPU.Build.0 = Release|Any CPU
  36
+		{BE147A77-3E59-40E6-822D-5AEDFD5D383C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  37
+		{BE147A77-3E59-40E6-822D-5AEDFD5D383C}.Debug|Any CPU.Build.0 = Debug|Any CPU
  38
+		{BE147A77-3E59-40E6-822D-5AEDFD5D383C}.Release|Any CPU.ActiveCfg = Release|Any CPU
  39
+		{BE147A77-3E59-40E6-822D-5AEDFD5D383C}.Release|Any CPU.Build.0 = Release|Any CPU
  40
+		{CEF24DDD-1D15-42BC-B035-4A33388C3F8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  41
+		{CEF24DDD-1D15-42BC-B035-4A33388C3F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
  42
+		{CEF24DDD-1D15-42BC-B035-4A33388C3F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
  43
+		{CEF24DDD-1D15-42BC-B035-4A33388C3F8C}.Release|Any CPU.Build.0 = Release|Any CPU
  44
+		{7112AC6B-C406-481D-99D4-56BA796B7173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  45
+		{7112AC6B-C406-481D-99D4-56BA796B7173}.Debug|Any CPU.Build.0 = Debug|Any CPU
  46
+		{7112AC6B-C406-481D-99D4-56BA796B7173}.Release|Any CPU.ActiveCfg = Release|Any CPU
  47
+		{7112AC6B-C406-481D-99D4-56BA796B7173}.Release|Any CPU.Build.0 = Release|Any CPU
  48
+	EndGlobalSection
  49
+	GlobalSection(SolutionProperties) = preSolution
  50
+		HideSolutionNode = FALSE
  51
+	EndGlobalSection
  52
+	GlobalSection(NestedProjects) = preSolution
  53
+		{7112AC6B-C406-481D-99D4-56BA796B7173} = {EAA774FA-8EA7-4CE4-A406-16D7CE0BC4C1}
  54
+		{4E471CAC-A108-49AE-A4D6-155DC35712C9} = {EAA774FA-8EA7-4CE4-A406-16D7CE0BC4C1}
  55
+	EndGlobalSection
  56
+EndGlobal
BIN  Example/MyStore/MyStore.suo
Binary file not shown
111  Example/MyStore/app/MyStore.DB/schema/UnitTestGeneratedSchema.sql
... ...
@@ -0,0 +1,111 @@
  1
+
  2
+    if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKDDD7BED2D9812CFF]') AND parent_object_id = OBJECT_ID('Products_ProductCategories'))
  3
+alter table Products_ProductCategories  drop constraint FKDDD7BED2D9812CFF
  4
+
  5
+
  6
+    if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKDDD7BED28F30214F]') AND parent_object_id = OBJECT_ID('Products_ProductCategories'))
  7
+alter table Products_ProductCategories  drop constraint FKDDD7BED28F30214F
  8
+
  9
+
  10
+    if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK570785C1427FAD8B]') AND parent_object_id = OBJECT_ID('Orders'))
  11
+alter table Orders  drop constraint FK570785C1427FAD8B
  12
+
  13
+
  14
+    if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKD1A96374B3D390D7]') AND parent_object_id = OBJECT_ID('OrderLineItems'))
  15
+alter table OrderLineItems  drop constraint FKD1A96374B3D390D7
  16
+
  17
+
  18
+    if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKD1A963748F30214F]') AND parent_object_id = OBJECT_ID('OrderLineItems'))
  19
+alter table OrderLineItems  drop constraint FKD1A963748F30214F
  20
+
  21
+
  22
+    if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK248A035DD9812CFF]') AND parent_object_id = OBJECT_ID('ProductCategories'))
  23
+alter table ProductCategories  drop constraint FK248A035DD9812CFF
  24
+
  25
+
  26
+    if exists (select * from dbo.sysobjects where id = object_id(N'Products') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Products
  27
+
  28
+    if exists (select * from dbo.sysobjects where id = object_id(N'Products_ProductCategories') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Products_ProductCategories
  29
+
  30
+    if exists (select * from dbo.sysobjects where id = object_id(N'Customers') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Customers
  31
+
  32
+    if exists (select * from dbo.sysobjects where id = object_id(N'Orders') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Orders
  33
+
  34
+    if exists (select * from dbo.sysobjects where id = object_id(N'OrderLineItems') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table OrderLineItems
  35
+
  36
+    if exists (select * from dbo.sysobjects where id = object_id(N'ProductCategories') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table ProductCategories
  37
+
  38
+    create table Products (
  39
+        Id INT IDENTITY NOT NULL,
  40
+       Name NVARCHAR(255) null,
  41
+       Amount DECIMAL(19,5) null,
  42
+       primary key (Id)
  43
+    )
  44
+
  45
+    create table Products_ProductCategories (
  46
+        ProductFk INT not null,
  47
+       ProductCategoryFk INT not null
  48
+    )
  49
+
  50
+    create table Customers (
  51
+        Id INT IDENTITY NOT NULL,
  52
+       FirstName NVARCHAR(255) null,
  53
+       LastName NVARCHAR(255) null,
  54
+       StreetAddress NVARCHAR(255) null,
  55
+       ZipCode NVARCHAR(255) null,
  56
+       primary key (Id)
  57
+    )
  58
+
  59
+    create table Orders (
  60
+        Id INT IDENTITY NOT NULL,
  61
+       PlacedOn DATETIME null,
  62
+       OrderStatusTypeFk INT null,
  63
+       CustomerFk INT null,
  64
+       primary key (Id)
  65
+    )
  66
+
  67
+    create table OrderLineItems (
  68
+        Id INT IDENTITY NOT NULL,
  69
+       OrderFk INT null,
  70
+       Amount DECIMAL(19,5) null,
  71
+       ProductFk INT null,
  72
+       Quantity INT null,
  73
+       primary key (Id)
  74
+    )
  75
+
  76
+    create table ProductCategories (
  77
+        Id INT IDENTITY NOT NULL,
  78
+       Name NVARCHAR(255) null,
  79
+       ProductCategoryFk INT null,
  80
+       primary key (Id)
  81
+    )
  82
+
  83
+    alter table Products_ProductCategories 
  84
+        add constraint FKDDD7BED2D9812CFF 
  85
+        foreign key (ProductCategoryFk) 
  86
+        references ProductCategories
  87
+
  88
+    alter table Products_ProductCategories 
  89
+        add constraint FKDDD7BED28F30214F 
  90
+        foreign key (ProductFk) 
  91
+        references Products
  92
+
  93
+    alter table Orders 
  94
+        add constraint FK570785C1427FAD8B 
  95
+        foreign key (CustomerFk) 
  96
+        references Customers
  97
+
  98
+    alter table OrderLineItems 
  99
+        add constraint FKD1A96374B3D390D7 
  100
+        foreign key (OrderFk) 
  101
+        references Orders
  102
+
  103
+    alter table OrderLineItems 
  104
+        add constraint FKD1A963748F30214F 
  105
+        foreign key (ProductFk) 
  106
+        references Products
  107
+
  108
+    alter table ProductCategories 
  109
+        add constraint FK248A035DD9812CFF 
  110
+        foreign key (ProductCategoryFk) 
  111
+        references ProductCategories
30  Example/MyStore/app/MyStore.Domain/ActionConfirmation.cs
... ...
@@ -0,0 +1,30 @@
  1
+namespace MyStore.Domain
  2
+{
  3
+    /// <summary>
  4
+    /// Provides a generic typed mechanism for returning success/failure feedback along with a value
  5
+    /// </summary>
  6
+    public class ActionConfirmation<T>
  7
+    {
  8
+        private ActionConfirmation(string message) {
  9
+            Message = message;
  10
+        }
  11
+
  12
+        public static ActionConfirmation<T> CreateSuccessConfirmation(string message, T value) {
  13
+            return new ActionConfirmation<T>(message) {
  14
+                WasSuccessful = true,
  15
+                Value = value
  16
+            };
  17
+        }
  18
+
  19
+        public static ActionConfirmation<T> CreateFailureConfirmation(string message, T value) {
  20
+            return new ActionConfirmation<T>(message) {
  21
+                WasSuccessful = false,
  22
+                Value = value
  23
+            };
  24
+        }
  25
+
  26
+        public bool WasSuccessful { get; private set; }
  27
+        public string Message { get; set; }
  28
+        public T Value { get; set; }
  29
+    }
  30
+}
19  Example/MyStore/app/MyStore.Domain/Address.cs
... ...
@@ -0,0 +1,19 @@
  1
+using System.ComponentModel.DataAnnotations;
  2
+
  3
+namespace MyStore.Domain
  4
+{
  5
+    /// <summary>
  6
+    /// This is a component of Customer
  7
+    /// </summary>
  8
+    public class Address
  9
+    {
  10
+        [StringLength(255, ErrorMessage = "Street address must be 255 characters or fewer")]
  11
+        [Display(Name = "Street Address")]
  12
+        public virtual string StreetAddress { get; set; }
  13
+
  14
+        [Required(ErrorMessage = "Zip code must be provided")]
  15
+        [StringLength(5, ErrorMessage = "Zip code must be 5 characters or fewer")]
  16
+        [Display(Name = "Zip Code")]
  17
+        public virtual string ZipCode { get; set; }
  18
+    }
  19
+}
38  Example/MyStore/app/MyStore.Domain/Customer.cs
... ...
@@ -0,0 +1,38 @@
  1
+using System.Collections.Generic;
  2
+using System.ComponentModel.DataAnnotations;
  3
+using SharpLite.Domain;
  4
+using SharpLite.Domain.Validators;
  5
+
  6
+namespace MyStore.Domain
  7
+{
  8
+    [HasUniqueDomainSignature(ErrorMessage="A customer already exists with the same first and last name")]
  9
+    public class Customer : Entity
  10
+    {
  11
+        public Customer() {
  12
+            Orders = new List<Order>();
  13
+        }
  14
+
  15
+        [DomainSignature]
  16
+        [Required(ErrorMessage = "First name must be provided")]
  17
+        [StringLength(255, ErrorMessage = "First name must be 255 characters or fewer")]
  18
+        [Display(Name="First Name")]
  19
+        public virtual string FirstName { get; set; }
  20
+
  21
+        [DomainSignature]
  22
+        [Required(ErrorMessage = "Last name must be provided")]
  23
+        [StringLength(255, ErrorMessage = "Last name must be 255 characters or fewer")]
  24
+        [Display(Name = "Last Name")]
  25
+        public virtual string LastName { get; set; }
  26
+
  27
+        /// <summary>
  28
+        /// Address is a component, not a separate entity; i.e., the Customers table will have 
  29
+        /// columns for each property of Address
  30
+        /// </summary>
  31
+        public virtual Address Address { get; set; }
  32
+
  33
+        /// <summary>
  34
+        /// one-to-many from Customer to Order
  35
+        /// </summary>
  36
+        public virtual IList<Order> Orders { get; protected set; }
  37
+    }
  38
+}
19  Example/MyStore/app/MyStore.Domain/Money.cs
... ...
@@ -0,0 +1,19 @@
  1
+using System;
  2
+
  3
+namespace MyStore.Domain
  4
+{
  5
+    public class Money
  6
+    {
  7
+        protected Money() { }
  8
+
  9
+        public Money(decimal amount) {
  10
+            Amount = amount;
  11
+        }
  12
+
  13
+        public decimal Amount { get; set; }
  14
+
  15
+        public override string ToString() {
  16
+            return String.Format("{0:c}", Amount);
  17
+        }
  18
+    }
  19
+}
78  Example/MyStore/app/MyStore.Domain/MyStore.Domain.csproj
... ...
@@ -0,0 +1,78 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3
+  <PropertyGroup>
  4
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6
+    <ProductVersion>8.0.30703</ProductVersion>
  7
+    <SchemaVersion>2.0</SchemaVersion>
  8
+    <ProjectGuid>{74801410-F690-490C-91EA-CD94E520A465}</ProjectGuid>
  9
+    <OutputType>Library</OutputType>
  10
+    <AppDesignerFolder>Properties</AppDesignerFolder>
  11
+    <RootNamespace>MyStore.Domain</RootNamespace>
  12
+    <AssemblyName>MyStore.Domain</AssemblyName>
  13
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14
+    <FileAlignment>512</FileAlignment>
  15
+  </PropertyGroup>
  16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  17
+    <DebugSymbols>true</DebugSymbols>
  18
+    <DebugType>full</DebugType>
  19
+    <Optimize>false</Optimize>
  20
+    <OutputPath>bin\Debug\</OutputPath>
  21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
  22
+    <ErrorReport>prompt</ErrorReport>
  23
+    <WarningLevel>4</WarningLevel>
  24
+  </PropertyGroup>
  25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  26
+    <DebugType>pdbonly</DebugType>
  27
+    <Optimize>true</Optimize>
  28
+    <OutputPath>bin\Release\</OutputPath>
  29
+    <DefineConstants>TRACE</DefineConstants>
  30
+    <ErrorReport>prompt</ErrorReport>
  31
+    <WarningLevel>4</WarningLevel>
  32
+  </PropertyGroup>
  33
+  <ItemGroup>
  34
+    <Reference Include="SharpLite.Domain, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  35
+      <SpecificVersion>False</SpecificVersion>
  36
+      <HintPath>..\..\lib\SharpLite.Domain.dll</HintPath>
  37
+    </Reference>
  38
+    <Reference Include="System" />
  39
+    <Reference Include="System.ComponentModel.DataAnnotations" />
  40
+    <Reference Include="System.Core" />
  41
+    <Reference Include="System.Xml.Linq" />
  42
+    <Reference Include="System.Data.DataSetExtensions" />
  43
+    <Reference Include="Microsoft.CSharp" />
  44
+    <Reference Include="System.Data" />
  45
+    <Reference Include="System.Xml" />
  46
+  </ItemGroup>
  47
+  <ItemGroup>
  48
+    <Compile Include="ActionConfirmation.cs" />
  49
+    <Compile Include="Address.cs" />
  50
+    <Compile Include="Customer.cs" />
  51
+    <Compile Include="ProductMgmt\Queries\IQueryForProductOrderSummaries.cs" />
  52
+    <Compile Include="Money.cs" />
  53
+    <Compile Include="Order.cs" />
  54
+    <Compile Include="OrderLineItem.cs" />
  55
+    <Compile Include="OrderStatusType.cs" />
  56
+    <Compile Include="ProductMgmt\Product.cs" />
  57
+    <Compile Include="ProductMgmt\ProductCategory.cs" />
  58
+    <Compile Include="ProductMgmt\Queries\ProductOrderSummaryDto.cs" />
  59
+    <Compile Include="Properties\AssemblyInfo.cs" />
  60
+    <Compile Include="Queries\CustomerOrderSummaryDto.cs" />
  61
+    <Compile Include="Queries\FindActiveCustomers.cs" />
  62
+    <Compile Include="Queries\QueryForCustomerOrderSummaries.cs" />
  63
+    <Compile Include="Validators\DataAnnotationsValidator.cs" />
  64
+  </ItemGroup>
  65
+  <ItemGroup>
  66
+    <Content Include="ProductMgmt\Queries\README.txt" />
  67
+    <Content Include="Queries\README.txt" />
  68
+    <Content Include="Validators\README.txt" />
  69
+  </ItemGroup>
  70
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  71
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
  72
+       Other similar extension points exist, see Microsoft.Common.targets.
  73
+  <Target Name="BeforeBuild">
  74
+  </Target>
  75
+  <Target Name="AfterBuild">
  76
+  </Target>
  77
+  -->
  78
+</Project>
42  Example/MyStore/app/MyStore.Domain/Order.cs
... ...
@@ -0,0 +1,42 @@
  1
+using System;
  2
+using System.Collections.Generic;
  3
+using System.Linq;
  4
+using SharpLite.Domain;
  5
+
  6
+namespace MyStore.Domain
  7
+{
  8
+    public class Order : Entity
  9
+    {
  10
+        public Order() {
  11
+            OrderLineItems = new List<OrderLineItem>();
  12
+            OrderStatus = OrderStatusType.Placed;
  13
+        }
  14
+
  15
+        public virtual DateTime PlacedOn { get; set; }
  16
+
  17
+        /// <summary>
  18
+        /// Maps to an enum type and is not an entity relationship
  19
+        /// </summary>
  20
+        public virtual OrderStatusType OrderStatus { get; set; }
  21
+
  22
+        /// <summary>
  23
+        /// many-to-one from Order to Customer
  24
+        /// </summary>
  25
+        public virtual Customer Customer { get; set; }
  26
+
  27
+        /// <summary>
  28
+        /// one-to-many from Order to OrderLineItem
  29
+        /// </summary>
  30
+        public virtual IList<OrderLineItem> OrderLineItems { get; protected set; }
  31
+
  32
+        /// <summary>
  33
+        /// Example of adding domain business logic to entity
  34
+        /// </summary>
  35
+        public virtual Money GetTotal() {
  36
+            decimal totalAmount = 
  37
+                OrderLineItems.Sum<OrderLineItem>(m => m.GetTotal().Amount);
  38
+
  39
+            return new Money(totalAmount);
  40
+        }
  41
+    }
  42
+}
33  Example/MyStore/app/MyStore.Domain/OrderLineItem.cs
... ...
@@ -0,0 +1,33 @@
  1
+using MyStore.Domain.ProductMgmt;
  2
+using SharpLite.Domain;
  3
+
  4
+namespace MyStore.Domain
  5
+{
  6
+    public class OrderLineItem : Entity
  7
+    {
  8
+        /// <summary>
  9
+        /// many-to-one from OrderLineItem to Order
  10
+        /// </summary>
  11
+        public virtual Order Order { get; set; }
  12
+
  13
+        /// <summary>
  14
+        /// Money is a component, not a separate entity; i.e., the OrderLineItems table will have 
  15
+        /// column for the amount
  16
+        /// </summary>
  17
+        public virtual Money Price { get; set; }
  18
+
  19
+        /// <summary>
  20
+        /// many-to-one from OrderLineItem to Product
  21
+        /// </summary>
  22
+        public virtual Product Product { get; set; }
  23
+        
  24
+        public virtual int Quantity { get; set; }
  25
+
  26
+        /// <summary>
  27
+        /// Example of adding domain business logic to entity
  28
+        /// </summary>
  29
+        public virtual Money GetTotal() {
  30
+            return new Money(Price.Amount * Quantity);
  31
+        }
  32
+    }
  33
+}
18  Example/MyStore/app/MyStore.Domain/OrderStatusType.cs
... ...
@@ -0,0 +1,18 @@
  1
+namespace MyStore.Domain
  2
+{
  3
+    /// <summary>
  4
+    /// This enum may have an equivalent table in the database called OrderStatusTypes. It wouldn't
  5
+    /// map to the table directly, but the table could be put in place in order to provide 
  6
+    /// referential integrity and to allow the database to be more "discoverable"; i.e., you could 
  7
+    /// look at the OrderStatusTypes table to infer the meaning behind any FK relationships to it.
  8
+    /// 
  9
+    /// If an OrderStatusTypes table is created, you'd have to manually add (and maintain) an entry 
  10
+    /// for each enum value and manually add any FK relationships to it.
  11
+    /// </summary>
  12
+    public enum OrderStatusType
  13
+    {
  14
+        Placed = 1,
  15
+        BeingProcessed = 2,
  16
+        Shipped = 3
  17
+    }
  18
+}
33  Example/MyStore/app/MyStore.Domain/ProductMgmt/Product.cs
... ...
@@ -0,0 +1,33 @@
  1
+using System.Collections.Generic;
  2
+using System.ComponentModel.DataAnnotations;
  3
+using SharpLite.Domain;
  4
+using SharpLite.Domain.Validators;
  5
+
  6
+namespace MyStore.Domain.ProductMgmt
  7
+{
  8
+    [HasUniqueDomainSignature(ErrorMessage = "A product already exists with the same name")]
  9
+    public class Product : Entity
  10
+    {
  11
+        public Product() {
  12
+            Categories = new List<ProductCategory>();
  13
+        }
  14
+
  15
+        [DomainSignature]
  16
+        [Required(ErrorMessage = "Name must be provided")]
  17
+        [StringLength(255, ErrorMessage = "Name must be 255 characters or fewer")]
  18
+        public virtual string Name { get; set; }
  19
+
  20
+        /// <summary>
  21
+        /// Money is a component, not a separate entity; i.e., the Products table will have column 
  22
+        /// for the amount
  23
+        /// </summary>
  24
+        [DataType("Money")]
  25
+        public virtual Money Price { get; set; }
  26
+
  27
+        /// <summary>
  28
+        /// many-to-many between Product and ProductCategory
  29
+        /// </summary>
  30
+        [Display(Name="Product Categories")]
  31
+        public virtual IList<ProductCategory> Categories { get; protected set; }
  32
+    }
  33
+}
37  Example/MyStore/app/MyStore.Domain/ProductMgmt/ProductCategory.cs
... ...
@@ -0,0 +1,37 @@
  1
+using System.Collections.Generic;
  2
+using System.ComponentModel.DataAnnotations;
  3
+using SharpLite.Domain;
  4
+using SharpLite.Domain.Validators;
  5
+
  6
+namespace MyStore.Domain.ProductMgmt
  7
+{
  8
+    [HasUniqueDomainSignature(ErrorMessage="A product category already exists with the same name")]
  9
+    public class ProductCategory : Entity
  10
+    {
  11
+        public ProductCategory() {
  12
+            Children = new List<ProductCategory>();
  13
+            Products = new List<Product>();
  14
+        }
  15
+
  16
+        [DomainSignature]
  17
+        [Required(ErrorMessage="Name must be provided")]
  18
+        [StringLength(255, ErrorMessage="Name must be 255 characters or fewer")]
  19
+        public virtual string Name { get; set; }
  20
+
  21
+        /// <summary>
  22
+        /// many-to-one from child ProductCategory to parent ProductCategory
  23
+        /// </summary>
  24
+        [Display(Name="Parent Category")]
  25
+        public virtual ProductCategory Parent { get; set; }
  26
+
  27
+        /// <summary>
  28
+        /// many-to-many between ProductCategory and Product
  29
+        /// </summary>
  30
+        public virtual IList<Product> Products { get; protected set; }
  31
+
  32
+        /// <summary>
  33
+        /// one-to-many from parent ProductCategory to children ProductCategory
  34
+        /// </summary>
  35
+        public virtual IList<ProductCategory> Children { get; protected set; }
  36
+    }
  37
+}
18  Example/MyStore/app/MyStore.Domain/ProductMgmt/Queries/IQueryForProductOrderSummaries.cs
... ...
@@ -0,0 +1,18 @@
  1
+using System;
  2
+using System.Collections.Generic;
  3
+
  4
+namespace MyStore.Domain.ProductMgmt.Queries
  5
+{
  6
+    /// <summary>
  7
+    /// You'll almost NEVER need to explicitly define a query interface.  It's only 
  8
+    /// needed if you ever need to leverage the underlying data-access layer (e.g., NHibernate)
  9
+    /// directly when the sole use of .NET LINQ within query objects (e.g., 
  10
+    /// FindActiveCustomersExtension and QueryForCustomerOrderSummariesExtension) is too limiting.
  11
+    /// 
  12
+    /// Accordingly, it is far more preferred to use a non NHibernate-specific query object.
  13
+    /// </summary>
  14
+    public interface IQueryForProductOrderSummaries
  15
+    {
  16
+        IEnumerable<ProductOrderSummaryDto> GetByDateRange(DateTime startDate, DateTime endDate);
  17
+    }
  18
+}
9  Example/MyStore/app/MyStore.Domain/ProductMgmt/Queries/ProductOrderSummaryDto.cs
... ...
@@ -0,0 +1,9 @@
  1
+namespace MyStore.Domain.ProductMgmt.Queries
  2
+{
  3
+    public class ProductOrderSummaryDto
  4
+    {
  5
+        public string ProductName { get; set; }
  6
+        public int OrderCount { get; set; }
  7
+        public int TotalQuantitySold { get; set; }
  8
+    }
  9
+}
4  Example/MyStore/app/MyStore.Domain/ProductMgmt/Queries/README.txt
... ...
@@ -0,0 +1,4 @@
  1
+This folder holds the query objects specific to the Domain.ProductMgmt namespace.
  2
+
  3
+Alternatively, you could put all the query objects within a single, root "Queries" 
  4
+folder or even put them into a separate assembly for stronger separation.
36  Example/MyStore/app/MyStore.Domain/Properties/AssemblyInfo.cs
... ...
@@ -0,0 +1,36 @@
  1
+using System.Reflection;
  2
+using System.Runtime.CompilerServices;
  3
+using System.Runtime.InteropServices;
  4
+
  5
+// General Information about an assembly is controlled through the following 
  6
+// set of attributes. Change these attribute values to modify the information
  7
+// associated with an assembly.
  8
+[assembly: AssemblyTitle("MyStore.Domain")]
  9
+[assembly: AssemblyDescription("")]
  10
+[assembly: AssemblyConfiguration("")]
  11
+[assembly: AssemblyCompany("Codai")]
  12
+[assembly: AssemblyProduct("MyStore.Domain")]
  13
+[assembly: AssemblyCopyright("Copyright © Codai 2011")]
  14
+[assembly: AssemblyTrademark("")]
  15
+[assembly: AssemblyCulture("")]
  16
+
  17
+// Setting ComVisible to false makes the types in this assembly not visible 
  18
+// to COM components.  If you need to access a type in this assembly from 
  19
+// COM, set the ComVisible attribute to true on that type.
  20
+[assembly: ComVisible(false)]
  21
+
  22
+// The following GUID is for the ID of the typelib if this project is exposed to COM
  23
+[assembly: Guid("879a78ed-9b39-435b-be3b-054c0858c80b")]
  24
+
  25
+// Version information for an assembly consists of the following four values:
  26
+//
  27
+//      Major Version
  28
+//      Minor Version 
  29
+//      Build Number
  30
+//      Revision
  31
+//
  32
+// You can specify all the values or you can default the Build and Revision Numbers 
  33
+// by using the '*' as shown below:
  34
+// [assembly: AssemblyVersion("1.0.*")]
  35
+[assembly: AssemblyVersion("1.0.0.0")]
  36
+[assembly: AssemblyFileVersion("1.0.0.0")]
9  Example/MyStore/app/MyStore.Domain/Queries/CustomerOrderSummaryDto.cs
... ...
@@ -0,0 +1,9 @@
  1
+namespace MyStore.Domain.Queries
  2
+{
  3
+    public class CustomerOrderSummaryDto
  4
+    {
  5
+        public string FirstName { get; set; }
  6
+        public string LastName { get; set; }
  7
+        public int OrderCount { get; set; }
  8
+    }
  9
+}
23  Example/MyStore/app/MyStore.Domain/Queries/FindActiveCustomers.cs
... ...
@@ -0,0 +1,23 @@
  1
+using System.Linq;
  2
+
  3
+namespace MyStore.Domain.Queries
  4
+{
  5
+    /// <summary>
  6
+    /// Query object to return all customers who are considered active, based on a minimum number of orders
  7
+    /// 
  8
+    /// This is a "find" vs. a "query"; i.e., this filters the source based using supplied criteria
  9
+    /// </summary>
  10
+    public static class FindActiveCustomersExtension
  11
+    {
  12
+        public static IQueryable<Customer> FindActiveCustomers(this IQueryable<Customer> customers) {
  13
+            return customers.FindActiveCustomers(MINIMUM_ORDERS_TO_BE_CONSIDERED_ACTIVE);
  14
+        }
  15
+
  16
+        public static IQueryable<Customer> FindActiveCustomers(this IQueryable<Customer> customers, int minimumOrders) {
  17
+            return customers.Where(c =>
  18
+                c.Orders.Count >= minimumOrders);
  19
+        }
  20
+
  21
+        private const int MINIMUM_ORDERS_TO_BE_CONSIDERED_ACTIVE = 3;
  22
+    }
  23
+}
21  Example/MyStore/app/MyStore.Domain/Queries/QueryForCustomerOrderSummaries.cs
... ...
@@ -0,0 +1,21 @@
  1
+using System.Linq;
  2
+
  3
+namespace MyStore.Domain.Queries
  4
+{
  5
+    /// <summary>
  6
+    /// Example of taking a list of users and generating reporting data.
  7
+    /// 
  8
+    /// This is a "query" vs. a "find"; i.e., this returns a report summary from the source.
  9
+    /// </summary>
  10
+    public static class QueryForCustomerOrderSummariesExtension
  11
+    {
  12
+        public static IQueryable<CustomerOrderSummaryDto> QueryForCustomerOrderSummaries(this IQueryable<Customer> customers) {
  13
+            return from customer in customers
  14
+                   select new CustomerOrderSummaryDto() {
  15
+                       FirstName = customer.FirstName,
  16
+                       LastName = customer.LastName,
  17
+                       OrderCount = customer.Orders.Count
  18
+                   };
  19
+        }
  20
+    }
  21
+}
5  Example/MyStore/app/MyStore.Domain/Queries/README.txt
... ...
@@ -0,0 +1,5 @@
  1
+This folder holds the query objects specific to the root Domain namespace.  
  2
+Subnames each of their own Queries folder.
  3
+
  4
+Alternatively, you could put all the query objects within a single, root "Queries" 
  5
+folder or even put them into a separate assembly for stronger separation.
23  Example/MyStore/app/MyStore.Domain/Validators/DataAnnotationsValidator.cs
... ...
@@ -0,0 +1,23 @@
  1
+using System.Collections.Generic;
  2
+using System.ComponentModel.DataAnnotations;
  3
+
  4
+namespace MyStore.Domain.Validators
  5
+{
  6
+    public class DataAnnotationsValidator
  7
+    {
  8
+        public static bool TryValidate(object @object) {
  9
+            ICollection<ValidationResult> ignoredResults;
  10
+            return TryValidate(@object, out ignoredResults);
  11
+        }
  12
+
  13
+        public static bool TryValidate(object @object, out ICollection<ValidationResult> results) {
  14
+            var context = new ValidationContext(@object, serviceProvider: null, items: null);
  15
+            results = new List<ValidationResult>();
  16
+
  17
+            return Validator.TryValidateObject(
  18
+                @object, context, results,
  19
+                validateAllProperties: true
  20
+            );
  21
+        }
  22
+    }
  23
+}
1  Example/MyStore/app/MyStore.Domain/Validators/README.txt
... ...
@@ -0,0 +1 @@
  1
+All of your custom, reusable validators would go here.
33  Example/MyStore/app/MyStore.Init/DependencyResolverInitializer.cs
... ...
@@ -0,0 +1,33 @@
  1
+using System.Web.Mvc;
  2
+using MyStore.Domain.ProductMgmt.Queries;
  3
+using MyStore.NHibernateProvider;
  4
+using MyStore.NHibernateProvider.Queries;
  5
+using NHibernate;
  6
+using SharpLite.Domain.DataInterfaces;
  7
+using SharpLite.NHibernateProvider;
  8
+using StructureMap;
  9
+
  10
+namespace MyStore.Init
  11
+{
  12
+    public class DependencyResolverInitializer
  13
+    {
  14
+        public static void Initialize() {
  15
+            Container container = new Container(x => {
  16
+                x.For<ISessionFactory>()
  17
+                    .Singleton()
  18
+                    .Use(() => NHibernateInitializer.Initialize().BuildSessionFactory());
  19
+                x.For<IEntityDuplicateChecker>().Use<EntityDuplicateChecker>();
  20
+                x.For(typeof(IRepository<>)).Use(typeof(Repository<>));
  21
+                x.For(typeof(IRepositoryWithTypedId<,>)).Use(typeof(RepositoryWithTypedId<,>));
  22
+
  23
+                // This is a very exceptional case and you'd almost never be doing this; you'd
  24
+                // istead be using concreate query objects (e.g., MyStore.Domain.Queries.FindActiveCustomers)
  25
+                x.For<IQueryForProductOrderSummaries>().Use<QueryForProductOrderSummaries>();
  26
+            });
  27
+
  28
+            DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));
  29
+        }
  30
+
  31
+        public static object IQueryForProductOrderSummaries { get; set; }
  32
+    }
  33
+}
85  Example/MyStore/app/MyStore.Init/MyStore.Init.csproj
... ...
@@ -0,0 +1,85 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3
+  <PropertyGroup>
  4
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6
+    <ProductVersion>8.0.30703</ProductVersion>
  7
+    <SchemaVersion>2.0</SchemaVersion>
  8
+    <ProjectGuid>{7112AC6B-C406-481D-99D4-56BA796B7173}</ProjectGuid>
  9
+    <OutputType>Library</OutputType>
  10
+    <AppDesignerFolder>Properties</AppDesignerFolder>
  11
+    <RootNamespace>MyStore.Init</RootNamespace>
  12
+    <AssemblyName>MyStore.Init</AssemblyName>
  13
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14
+    <FileAlignment>512</FileAlignment>
  15
+  </PropertyGroup>
  16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  17
+    <DebugSymbols>true</DebugSymbols>
  18
+    <DebugType>full</DebugType>
  19
+    <Optimize>false</Optimize>
  20
+    <OutputPath>bin\Debug\</OutputPath>
  21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
  22
+    <ErrorReport>prompt</ErrorReport>
  23
+    <WarningLevel>4</WarningLevel>
  24
+  </PropertyGroup>
  25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  26
+    <DebugType>pdbonly</DebugType>
  27
+    <Optimize>true</Optimize>
  28
+    <OutputPath>bin\Release\</OutputPath>
  29
+    <DefineConstants>TRACE</DefineConstants>
  30
+    <ErrorReport>prompt</ErrorReport>
  31
+    <WarningLevel>4</WarningLevel>
  32
+  </PropertyGroup>
  33
+  <ItemGroup>
  34
+    <Reference Include="NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
  35
+      <SpecificVersion>False</SpecificVersion>
  36
+      <HintPath>..\..\lib\NHibernate.dll</HintPath>
  37
+    </Reference>
  38
+    <Reference Include="SharpLite.Domain, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  39
+      <SpecificVersion>False</SpecificVersion>
  40
+      <HintPath>..\..\lib\SharpLite.Domain.dll</HintPath>
  41
+    </Reference>
  42
+    <Reference Include="SharpLite.NHibernateProvider, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  43
+      <SpecificVersion>False</SpecificVersion>
  44
+      <HintPath>..\..\lib\SharpLite.NHibernateProvider.dll</HintPath>
  45
+    </Reference>
  46
+    <Reference Include="StructureMap, Version=2.6.1.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
  47
+      <SpecificVersion>False</SpecificVersion>
  48
+      <HintPath>..\..\lib\StructureMap.dll</HintPath>
  49
+    </Reference>
  50
+    <Reference Include="System" />
  51
+    <Reference Include="System.Core" />
  52
+    <Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  53
+      <SpecificVersion>False</SpecificVersion>
  54
+      <HintPath>..\..\..\lib\System.Web.Mvc.dll</HintPath>
  55
+    </Reference>
  56
+    <Reference Include="System.Xml.Linq" />
  57
+    <Reference Include="System.Data.DataSetExtensions" />
  58
+    <Reference Include="Microsoft.CSharp" />
  59
+    <Reference Include="System.Data" />
  60
+    <Reference Include="System.Xml" />
  61
+  </ItemGroup>
  62
+  <ItemGroup>
  63
+    <Compile Include="DependencyResolverInitializer.cs" />
  64
+    <Compile Include="StructureMapDependencyResolver.cs" />
  65
+    <Compile Include="Properties\AssemblyInfo.cs" />
  66
+  </ItemGroup>
  67
+  <ItemGroup>
  68
+    <ProjectReference Include="..\MyStore.Domain\MyStore.Domain.csproj">
  69
+      <Project>{74801410-F690-490C-91EA-CD94E520A465}</Project>
  70
+      <Name>MyStore.Domain</Name>
  71
+    </ProjectReference>
  72
+    <ProjectReference Include="..\MyStore.NHibernateProvider\MyStore.NHibernateProvider.csproj">
  73
+      <Project>{4E471CAC-A108-49AE-A4D6-155DC35712C9}</Project>
  74
+      <Name>MyStore.NHibernateProvider</Name>
  75
+    </ProjectReference>
  76
+  </ItemGroup>
  77
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  78
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
  79
+       Other similar extension points exist, see Microsoft.Common.targets.
  80
+  <Target Name="BeforeBuild">
  81
+  </Target>
  82
+  <Target Name="AfterBuild">
  83
+  </Target>
  84
+  -->
  85
+</Project>
36  Example/MyStore/app/MyStore.Init/Properties/AssemblyInfo.cs
... ...
@@ -0,0 +1,36 @@
  1
+using System.Reflection;
  2
+using System.Runtime.CompilerServices;
  3
+using System.Runtime.InteropServices;
  4
+
  5
+// General Information about an assembly is controlled through the following 
  6
+// set of attributes. Change these attribute values to modify the information
  7
+// associated with an assembly.
  8
+[assembly: AssemblyTitle("MyStore.Init")]
  9
+[assembly: AssemblyDescription("")]
  10
+[assembly: AssemblyConfiguration("")]
  11
+[assembly: AssemblyCompany("Codai")]
  12
+[assembly: AssemblyProduct("MyStore.Init")]
  13
+[assembly: AssemblyCopyright("Copyright © Codai 2011")]
  14
+[assembly: AssemblyTrademark("")]
  15
+[assembly: AssemblyCulture("")]
  16
+
  17
+// Setting ComVisible to false makes the types in this assembly not visible 
  18
+// to COM components.  If you need to access a type in this assembly from 
  19
+// COM, set the ComVisible attribute to true on that type.
  20
+[assembly: ComVisible(false)]
  21
+
  22
+// The following GUID is for the ID of the typelib if this project is exposed to COM
  23
+[assembly: Guid("8f166720-e3c4-4cc8-8078-1b5f54004830")]
  24
+
  25
+// Version information for an assembly consists of the following four values:
  26
+//
  27
+//      Major Version
  28
+//      Minor Version 
  29
+//      Build Number
  30
+//      Revision
  31
+//
  32
+// You can specify all the values or you can default the Build and Revision Numbers 
  33
+// by using the '*' as shown below:
  34
+// [assembly: AssemblyVersion("1.0.*")]
  35
+[assembly: AssemblyVersion("1.0.0.0")]
  36
+[assembly: AssemblyFileVersion("1.0.0.0")]
33  Example/MyStore/app/MyStore.Init/StructureMapDependencyResolver.cs
... ...
@@ -0,0 +1,33 @@
  1
+using System;
  2
+using System.Collections.Generic;
  3
+using System.Linq;
  4
+using System.Web.Mvc;
  5
+using StructureMap;
  6
+
  7
+namespace MyStore.Init
  8
+{
  9
+    /// <summary>
  10
+    /// Taken from http://stevesmithblog.com/blog/how-do-i-use-structuremap-with-asp-net-mvc-3/
  11
+    /// </summary>
  12
+    public class StructureMapDependencyResolver : IDependencyResolver
  13
+    {
  14
+        public StructureMapDependencyResolver(IContainer container) {
  15
+            _container = container;
  16
+        }
  17
+
  18
+        public object GetService(Type serviceType) {
  19
+            if (serviceType.IsAbstract || serviceType.IsInterface) {
  20
+                return _container.TryGetInstance(serviceType);
  21
+            }
  22
+            else {
  23
+                return _container.GetInstance(serviceType);
  24
+            }
  25
+        }
  26
+
  27
+        public IEnumerable<object> GetServices(Type serviceType) {
  28
+            return _container.GetAllInstances(serviceType).Cast<object>();
  29
+        }
  30
+
  31
+        private readonly IContainer _container;
  32
+    }
  33
+}
74  Example/MyStore/app/MyStore.NHibernateProvider/Conventions.cs
... ...
@@ -0,0 +1,74 @@
  1
+using System;
  2
+using System.Collections.Generic;
  3
+using System.Linq;
  4
+using MyStore.Domain;
  5
+using MyStore.NHibernateProvider.Overrides;
  6
+using NHibernate.Cfg;
  7
+using NHibernate.Cfg.MappingSchema;
  8
+using NHibernate.Mapping.ByCode;
  9
+using SharpLite.Domain;
  10
+
  11
+namespace MyStore.NHibernateProvider
  12
+{
  13
+    /// <summary>
  14
+    /// Applies global common conventions to the mapped entities. 
  15
+    /// For clarity configurations set here can be overriden in 
  16
+    /// an entity's specific mapping file.  For example; The Id 
  17
+    /// convention here is set to Id but if the Id column 
  18
+    /// was mapped in the entity's mapping file then the entity's 
  19
+    /// mapping file configuration will take precedence.
  20
+    /// </summary>
  21
+    internal static class Conventions
  22
+    {
  23
+        public static void WithConventions(this ConventionModelMapper mapper, Configuration configuration) {
  24
+            Type baseEntityType = typeof(Entity);
  25
+
  26
+            mapper.IsEntity((type, declared) => IsEntity(type));
  27
+            mapper.IsRootEntity((type, declared) => baseEntityType.Equals(type.BaseType));
  28
+
  29
+            mapper.BeforeMapClass += (modelInspector, type, classCustomizer) => {
  30
+                classCustomizer.Id(c => c.Column("Id"));
  31
+                classCustomizer.Id(c => c.Generator(Generators.Identity));
  32
+                classCustomizer.Table(Inflector.Net.Inflector.Pluralize(type.Name.ToString()));
  33
+            };
  34
+
  35
+            mapper.BeforeMapManyToOne += (modelInspector, propertyPath, map) => {
  36
+                map.Column(propertyPath.LocalMember.GetPropertyOrFieldType().Name + "Fk");
  37
+                map.Cascade(Cascade.Persist);
  38
+            };