s#arp-architecture

Generate XML mappings from fluent Nhibernate

江枫思渺然 提交于 2019-11-26 11:14:39
问题 How do I generate xml mappings files as part of my tests in MappingIntegrationTests I need to manually check if the fluent mappings correlate to the mappings in the leagcy project. 回答1: You can do something like: config.Mappings(m => { m.FluentMappings.ExportTo("...file path here..."); m.HbmMappings.ExportTo("...file path here..."); m.AutoMappings.ExportTo("...file path here..."); { ); I don't like it myself. If I find some better way (if such exists at all) I'll update the answer. See http:/

Linq Orderby random ThreadSafe for use in ASP.NET

两盒软妹~` 提交于 2019-11-26 09:37:57
问题 i\'m using Asp.net MVC with Sharp Architecture. I have this code: return _repositoryKeyWord.FindAll(x => x.Category.Id == idCAtegory) .Take(50).ToList(); How can i order by random? Note: i don\'t want to order the 50 extracted items, i want order before and then extract 50 items. thks 回答1: One way to achieve efficiently is to add a column to your data Shuffle that is populated with a random int (as each record is created). The query to access the table then becomes ... Random random = new

DDD - the rule that Entities can't access Repositories directly

人盡茶涼 提交于 2019-11-26 09:05:22
问题 In Domain Driven Design, there seems to be lots of agreement that Entities should not access Repositories directly. Did this come from Eric Evans Domain Driven Design book, or did it come from elsewhere? Where are there some good explanations for the reasoning behind it? edit: To clarify: I\'m not talking about the classic OO practice of separating data access off into a separate layer from the business logic - I\'m talking about the specific arrangement whereby in DDD, Entities are not