Re: AR with Multiple DB´S
I know, but the original system (in asp 3) and i try to migration to .net with monorail, ar ... and this particular (and bizzar) behavor is a customer requires. :( so any idea? josh robb wrote: On Thu, Dec 4, 2008 at 6:06 AM, Gabriel Mancini de Campos [EMAIL PROTECTED] wrote: hi i have thinking... is not a better choice create a public class MultiBaseInterceptior : IInterceptor ??? and in moment of persistence, change the DB? someone here, know's which method from IInterceptor will be the better to implement the change??? This sounds like a pretty insane idea to me. Basically - you've done all your logic/validation using one DB and then you want to write the actual changes to another. I guess if you want all your reads to happen from one DB and all your writes to happen to another - then it's possible this isn't bad idea. Generally - you're going to get FK constraint errors, duplicate keys and all sorts of problems if you go this path (and it's not exactly what you want). j. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Castle Project Users group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---
Re: Layout hook
@Mike: yeah, exactly that I had in mind, actually one might wonder what purpose windsor integration for components serves if not for injecting services... Anyway, this could not be resolved with SubClassing, because this works on action- and not class level. @Ken: on the other hand, a i could use a filter on my controller baseclass, that would run a AfterAction() method on the controller, only if I had layout. There I could put my stuff. I guess this might work and give me the behavior I want... (A better way?) @Gauthier I am sorry, I did not understand that at all... So probably it is _very_ smart :) On Tue, Dec 9, 2008 at 10:05 AM, Gauthier Segay [EMAIL PROTECTED] wrote: Hello Jan, what I've used (tell me if it sucks) is via dictionary adapter and a base controller: protected TInterface getDictionaryAdapterTInterface(IDictionary dictionary) { var adapter = DictionaryAdapterFactory.GetAdapterTInterface (dictionary); // check if it's base viewmodel and if dictionary is PropertyBag if(typeof(IBaseViewModel).IsAssignableFrom(typeof(TInterface)) dictionary == PropertyBag) { // do something clever here (adapter as IBaseViewModel).MenuItems = getMenuItems(); (adapter as IBaseViewModel).ClientSideDateFormat = dd/mm/yy; } return adapter; } here if I recognize that property bag is being populated and it implement a specific interface, I set the properties for use (often in the layout) In your ajax action you won't need to use this method so it doesn't populate anything. I think this can be decoupled a bit but it gives an idea to achieve what you want On Dec 8, 11:56 pm, Jan Limpens [EMAIL PROTECTED] wrote: Hm, dunno, does not look filterish to me. But you are right, maybe... Is there a good reason why it is not recommended to pass a service to a view component? This would be by far the easyest solution. I remember, a long time ago, I read, that purely the controller should have access to the service/data layer, but I wonder if this is not just a dogma... On Mon, Dec 8, 2008 at 8:51 PM, Colin Ramsay [EMAIL PROTECTED] wrote: A filter? On Mon, Dec 8, 2008 at 10:44 PM, Jan Limpens [EMAIL PROTECTED] wrote: Hello, for MR on a project, I have a BaseController and on it's Initialize method, I used to pull some data I used on every page. That was nice for a while, but recently I started to return a lot of Json and of course base.Initialize fires and does a lot of stuff that has nothing to do with the json requests. Now, I could separate json and layout methods via different controllers, but this would lead to a lot of code repetition. I would like to avoid to have a AddressController and another AddressJSONController because they shared too much and I could not even use inheritance. Now I *could* grab this data only when there is Layout. Is there some kind of hook, I can use to put the data into the propertybag based on this assumption? This would have to happen after the Action completed, but before data is passed to the view engine. Is there something? -- Jan -- Jan -- Jan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Castle Project Users group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---
Re: Want to do a fancy sum in an active Record query
I would like to do this: select DATEPART(wk, trn.TransactionDate) AS Week, dtl.SectionID, dtl.CategoryID, sum(dtl.Hours) AS Hours, sum( case when dtl.Hours 40 then dtl.Hours - 40 else 0 end ) AS Overtime, year(trn.TransactionDate) AS Year fromdbo.law_tr_TransactionDetail dtl inner join dbo.law_tr_Transaction trn ON trn.TransactionID = dtl.TransactionID inner join dbo.law_Badges bdg ON bdg.BadgeID = trn.BadgeID inner join dbo.law_Districts dst ON dst.DistrictID = bdg.DistrictID where bdg.BadgeClassID = 1 and trn.TransactionDate between '1/1/2008' AND '12/31/2008' group by dtl.CategoryID, DATEPART(wk, trn.TransactionDate), bdg.BadgeClassID, dtl.SectionID, year(trn.TransactionDate) ORDER BY DATEPART(wk, trn.TransactionDate), dtl.SectionID, dtl.CategoryID Is something like this possible with ActiveRecord code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Castle Project Users group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---
Re: Want to do a fancy sum in an active Record query
If you use sum(max(0,dtl.Hours-40)) as Overtime you don't need a case-statement. -Markus 2008/12/9 M Kenyon II [EMAIL PROTECTED] I would like to do this: select DATEPART(wk, trn.TransactionDate) AS Week, dtl.SectionID, dtl.CategoryID, sum(dtl.Hours) AS Hours, sum( case when dtl.Hours 40 then dtl.Hours - 40 else 0 end ) AS Overtime, year(trn.TransactionDate) AS Year fromdbo.law_tr_TransactionDetail dtl inner join dbo.law_tr_Transaction trn ON trn.TransactionID = dtl.TransactionID inner join dbo.law_Badges bdg ON bdg.BadgeID = trn.BadgeID inner join dbo.law_Districts dst ON dst.DistrictID = bdg.DistrictID where bdg.BadgeClassID = 1 and trn.TransactionDate between '1/1/2008' AND '12/31/2008' group by dtl.CategoryID, DATEPART(wk, trn.TransactionDate), bdg.BadgeClassID, dtl.SectionID, year(trn.TransactionDate) ORDER BY DATEPART(wk, trn.TransactionDate), dtl.SectionID, dtl.CategoryID Is something like this possible with ActiveRecord code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Castle Project Users group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---