s#arp-architecture

Fluent Nhibernate Schema Generation

情到浓时终转凉″ 提交于 2019-12-01 06:27:22
I have been playing about with FluentNhibernate as part of the S#arp Architecture. Below is an example mapping. public class EventBaseMap : ClassMap<EventBase> { public EventBaseMap() { WithTable("Event_Header"); //NotLazyLoaded(); Id(x => x.Id).WithUnsavedValue(-1).GeneratedBy.Native(); Map(x => x.Name).WithLengthOf(50).Not.Nullable(); Map(x => x.Description).WithLengthOf(255); Map(x => x.Rating); Map(x => x.Price); Map(x => x.PhoneNumber).WithLengthOf(20).Not.Nullable(); Map(x => x.EmailAddress); Map(x => x.Website); Map(x => x.State).Not.Nullable().CustomSqlTypeIs("INT"); Component(x => x

Fluent Nhibernate Schema Generation

霸气de小男生 提交于 2019-12-01 05:01:27
问题 I have been playing about with FluentNhibernate as part of the S#arp Architecture. Below is an example mapping. public class EventBaseMap : ClassMap<EventBase> { public EventBaseMap() { WithTable("Event_Header"); //NotLazyLoaded(); Id(x => x.Id).WithUnsavedValue(-1).GeneratedBy.Native(); Map(x => x.Name).WithLengthOf(50).Not.Nullable(); Map(x => x.Description).WithLengthOf(255); Map(x => x.Rating); Map(x => x.Price); Map(x => x.PhoneNumber).WithLengthOf(20).Not.Nullable(); Map(x => x

T4 for Sharp Architecture/Northwind Problem

让人想犯罪 __ 提交于 2019-11-30 18:41:24
I have just downloaded sharparchitecture/Northwind and i'm trying to get crud scaffolding to work. I have changed nothing except adding missing reference to this class library. I try to run ScaffoldingGeneratorCommand.tt and I hit following 3 errors. Error 1 Compiling transformation: Invalid token 'this' in class, struct, or interface member declaration file:BaseTemplate.tt Error 2 Compiling transformation: Class, struct, or interface method must have a return type file:BaseTemplate.tt Error 3 Compiling transformation: Type expected file:BaseTemplate.tt Compiler says they occur in the first

WCF/S#arpArch: underlying ISession is closed after the first call within a request

送分小仙女□ 提交于 2019-11-30 16:08:27
I know the use of WCF in SA is deprecated because it will move to SA Contrib. But until it has, I guess I have to use the support in SA. That said, I have a problem with the underlying NHibernate session being closed after calling a WCF service. My repository's DbContext.Session is closed after the first call so I cannot call my service more than once during a single HTTP request. I've set up WCF in my project based on the Northwind sample application. The sample only calls a WCF service once per request so this problem doesn't show up there. The problem is easily reproduced though, by

WCF/S#arpArch: underlying ISession is closed after the first call within a request

青春壹個敷衍的年華 提交于 2019-11-29 23:21:23
问题 I know the use of WCF in SA is deprecated because it will move to SA Contrib. But until it has, I guess I have to use the support in SA. That said, I have a problem with the underlying NHibernate session being closed after calling a WCF service. My repository's DbContext.Session is closed after the first call so I cannot call my service more than once during a single HTTP request. I've set up WCF in my project based on the Northwind sample application. The sample only calls a WCF service once

Convert from Oracle's RAW(16) to .NET's GUID

坚强是说给别人听的谎言 提交于 2019-11-27 11:28:06
I'm having difficulties manually debugging an .NET application where the Guid values differ from .NET to Oracle. Where C# reads: 17D89D326C2142D69B989F5201288DBF Oracle reads: 329DD817216CD6429B989F5201288DBF How would I be able to manually debug, i.e., from C#'s GUID be able to paste that value in an oracle query and get the correct results (and viceversa)? If you look at the values involved (in pairs) of hex digits you can see that the last 7 bytes are the same in both cases, but the first 9 are switched around a bit. Going from your example, but rewriting each pair in the .NET as 00, 11, 22

Generate XML mappings from fluent Nhibernate

那年仲夏 提交于 2019-11-27 04:31:29
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. 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://blog.jagregory.com/2009/02/03/fluent-nhibernate-configuring-your-application/ Or if broken, see this

Linq Orderby random ThreadSafe for use in ASP.NET

夙愿已清 提交于 2019-11-27 01:10:43
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 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 Random(); int seed = random.Next(); result = result.OrderBy(s => (~(s.Shuffle & seed)) & (s.Shuffle | seed)); //

Convert from Oracle's RAW(16) to .NET's GUID

帅比萌擦擦* 提交于 2019-11-26 22:38:18
问题 I'm having difficulties manually debugging an .NET application where the Guid values differ from .NET to Oracle. Where C# reads: 17D89D326C2142D69B989F5201288DBF Oracle reads: 329DD817216CD6429B989F5201288DBF How would I be able to manually debug, i.e., from C#'s GUID be able to paste that value in an oracle query and get the correct results (and viceversa)? 回答1: If you look at the values involved (in pairs) of hex digits you can see that the last 7 bytes are the same in both cases, but the

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

自作多情 提交于 2019-11-26 21:09:35
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 supposed to talk to the data access layer at all (i.e. they are not supposed to hold references to Repository