Nvelocity vs. scaffolding

2009-01-26 Thread Flominator

Hi again,

since I'm quite new to VS08, C# and Castle I started programming by
linking to the dll files at C:\Programm Files\Castle Project. Today
I wanted to do it better by creating a lib folder within the project
directory.

I seemed to have found all files necessary, all unit tests were green.
Then I renamed the NUnit and Castle folder at C:\Programm Files ... in
order to make sure it worked. Then I realised, that there was no link
to nvelocity.cll. I copied it into my lib folder and there it was:

---
Unable to cast object of type 'System.Collections.ArrayList' to type
'System.Collections.Generic.List`1[System.String]'.

Stack Trace:


[InvalidCastException: Unable to cast object of type
'System.Collections.ArrayList' to type
'System.Collections.Generic.List`1[System.String]'.]
   Commons.Collections.ExtendedProperties.GetStringList(String key)
+115
   NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader.Init
(ExtendedProperties configuration) +61
   NVelocity.Runtime.Resource.ResourceManagerImpl.Initialize
(IRuntimeServices rs) +465
   NVelocity.Runtime.RuntimeInstance.initializeResourceManager() +468
   NVelocity.Runtime.RuntimeInstance.Init() +118
   NVelocity.Runtime.RuntimeInstance.Init(ExtendedProperties p) +78
   NVelocity.App.VelocityEngine.Init(ExtendedProperties p) +55
 
Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.NVelocityTemplateEngine.BeginInit
() +1070
 
Castle.MonoRail.ActiveRecordScaffold.ScaffoldingSupport.InitializeTemplateEngine
() +99
   Castle.MonoRail.ActiveRecordScaffold.ScaffoldingSupport.Process
(Controller controller) +85
 
Castle.MonoRail.Framework.ControllerLifecycleExecutor.ProcessScaffoldIfPresent
() +140
 
Castle.MonoRail.Framework.ControllerLifecycleExecutor.InitializeController
(String areaName, String controllerName, String actionName) +125
 
Castle.MonoRail.Framework.EngineContextModule.CreateControllerAndRunStartRequestFilters
(Object sender, EventArgs e) +628
 
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean completedSynchronously) +75
---

Everything worked well this morning. What did I do wrong? Did I miss
any files in my lib directory? These files are currently inside:

Castle.ActiveRecord.dll
Castle.Components.Binder.dll
Castle.Components.Binder.dll.VisualState.xml
Castle.Components.Common.EmailSender.dll
Castle.Components.Common.TemplateEngine.dll
Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.dll
Castle.Components.Validator.dll
Castle.Core.dll
Castle.MonoRail.ActiveRecordScaffold.dll
Castle.MonoRail.ActiveRecordSupport.dll
Castle.MonoRail.Framework.dll
Castle.MonoRail.Framework.Views.NVelocity.dll
FirebirdSql.Data.FirebirdClient.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
NHibernate.Mapping.Attributes.dll
NVelocity.dll

I''ve found out, that it only affects controllers using scaffolding.
The others just work fine ...


Best regards,

Flo

--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: Nvelocity vs. scaffolding

2009-01-26 Thread Flominator

Forgot to mention: using RC3

Sorry,

Flo
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: AR: FindAllByProperty with LIKE

2009-01-26 Thread Flominator

It worked. Thanks, Mark!
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: AR: FindAllByProperty with LIKE

2009-01-26 Thread Mark Jensen

no problem :)

On Jan 26, 10:31 am, Flominator flomina...@gmx.net wrote:
 It worked. Thanks, Mark!
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: How to do DDD + AR (repositories)

2009-01-26 Thread Colin Ramsay
Well you wouldn't necessarily have to make a repo for every entity because
you'd have a generic RepoT you could use. However you might create (as an
example) a UserRepo : BaseRepoUser with a FindByUsername method as a
little syntactic sugar.

I think many people would use a container such as windsor to avoid having to
manually instantiate their repositories.

On Mon, Jan 26, 2009 at 11:02 AM, Mark Jensen don...@gmail.com wrote:


 Hi

 From what i can read on the internet people do really like this
 combination due to the placement of the persitance logic.

 how ever, i know that Castles AR has something callsed
 ActiveRecordMediator which seems to be the solution to the problem
 above. (i also know ayendes rhino commons which also have an
 implementation of the repository pattern).

 The questions are.

 1. Will i lose something if i stop inheritting from ActiveRecordBase
 and use ActiveRecordMediatior instead? (to me it seems like i will get
 a lot more functionality/control)

 2. Can someone me how to implement the Repository pattern with
 ActiveRecordMediator. I have found this example here

 http://www.lostechies.com/blogs/johnteague/archive/2008/05/27/using-database-repository-pattern-with-activerecord-with-activerecordmediator.aspx

 but to me it seems like I would have to make a Repository (and inherit
 from BaseRepository) for every Aggregate and then I need to
 instantiate the Repository it when i want to use it.

 Is there a better way of doing this?


 :)

 best regards,
 Mark
 


--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: How to do DDD + AR (repositories)

2009-01-26 Thread Markus Zywitza

You lose nothing with dropping ActiveRecordBase but convenience.

But keep in mind:

1) AR classes without ARBase make good DTOs, but still bad domain classes.
2) Generic repositories are an antipattern. A repository should
encapsulate the knowledge of an aggregate's persistence details. That
contradicts with ready-to-use-plugs for LINQ or criteria queries.

If you need to do DDD, use AR as DTO and map it to the domain layer.
If you are doing this because DDD has a momentary hype, just don't do
it at all. The Domain Model is not the only enterprise pattern that
yields maintainable software.

-Markus

2009/1/26 Mark Jensen don...@gmail.com:

 Hi

 From what i can read on the internet people do really like this
 combination due to the placement of the persitance logic.

 how ever, i know that Castles AR has something callsed
 ActiveRecordMediator which seems to be the solution to the problem
 above. (i also know ayendes rhino commons which also have an
 implementation of the repository pattern).

 The questions are.

 1. Will i lose something if i stop inheritting from ActiveRecordBase
 and use ActiveRecordMediatior instead? (to me it seems like i will get
 a lot more functionality/control)

 2. Can someone me how to implement the Repository pattern with
 ActiveRecordMediator. I have found this example here
 http://www.lostechies.com/blogs/johnteague/archive/2008/05/27/using-database-repository-pattern-with-activerecord-with-activerecordmediator.aspx

 but to me it seems like I would have to make a Repository (and inherit
 from BaseRepository) for every Aggregate and then I need to
 instantiate the Repository it when i want to use it.

 Is there a better way of doing this?


 :)

 best regards,
 Mark
 


--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: How to do DDD + AR (repositories)

2009-01-26 Thread Victor Kornov
This cries for at least to mention those other patterns.

On Mon, Jan 26, 2009 at 3:22 PM, Markus Zywitza markus.zywi...@gmail.comwrote:


 The Domain Model is not the only enterprise pattern that
 yields maintainable software.



--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: How to do DDD + AR (repositories)

2009-01-26 Thread Mark Jensen

:)

so you would also do something like the example from the link shows,
but just remove the FindAll ?

On Jan 26, 12:20 pm, Ken Egozi egoz...@gmail.com wrote:
 my take:
 externally the domain API will expose specialised repositories for aggregate
 roots. (not all of them should have Save, and a generic FindAll is not
 informative imo)
 internally, in the repository implementations, they'd use ARMediator (or NH
 queries) to retrieve manipulate data



 On Mon, Jan 26, 2009 at 1:08 PM, Colin Ramsay colinram...@gmail.com wrote:
  Well you wouldn't necessarily have to make a repo for every entity because
  you'd have a generic RepoT you could use. However you might create (as an
  example) a UserRepo : BaseRepoUser with a FindByUsername method as a
  little syntactic sugar.

  I think many people would use a container such as windsor to avoid having
  to manually instantiate their repositories.

  On Mon, Jan 26, 2009 at 11:02 AM, Mark Jensen don...@gmail.com wrote:

  Hi

  From what i can read on the internet people do really like this
  combination due to the placement of the persitance logic.

  how ever, i know that Castles AR has something callsed
  ActiveRecordMediator which seems to be the solution to the problem
  above. (i also know ayendes rhino commons which also have an
  implementation of the repository pattern).

  The questions are.

  1. Will i lose something if i stop inheritting from ActiveRecordBase
  and use ActiveRecordMediatior instead? (to me it seems like i will get
  a lot more functionality/control)

  2. Can someone me how to implement the Repository pattern with
  ActiveRecordMediator. I have found this example here

 http://www.lostechies.com/blogs/johnteague/archive/2008/05/27/using-d...

  but to me it seems like I would have to make a Repository (and inherit
  from BaseRepository) for every Aggregate and then I need to
  instantiate the Repository it when i want to use it.

  Is there a better way of doing this?

  :)

  best regards,
  Mark

 --
 Ken 
 Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.gotfriends.co.il
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: How to do DDD + AR (repositories)

2009-01-26 Thread Mark Jensen

Hi Markus

Could you explain the contradictions a bit more for me?

thanks :)



On Jan 26, 1:22 pm, Markus Zywitza markus.zywi...@gmail.com wrote:
 You lose nothing with dropping ActiveRecordBase but convenience.

 But keep in mind:

 1) AR classes without ARBase make good DTOs, but still bad domain classes.
 2) Generic repositories are an antipattern. A repository should
 encapsulate the knowledge of an aggregate's persistence details. That
 contradicts with ready-to-use-plugs for LINQ or criteria queries.

 If you need to do DDD, use AR as DTO and map it to the domain layer.
 If you are doing this because DDD has a momentary hype, just don't do
 it at all. The Domain Model is not the only enterprise pattern that
 yields maintainable software.

 -Markus

 2009/1/26 Mark Jensen don...@gmail.com:



  Hi

  From what i can read on the internet people do really like this
  combination due to the placement of the persitance logic.

  how ever, i know that Castles AR has something callsed
  ActiveRecordMediator which seems to be the solution to the problem
  above. (i also know ayendes rhino commons which also have an
  implementation of the repository pattern).

  The questions are.

  1. Will i lose something if i stop inheritting from ActiveRecordBase
  and use ActiveRecordMediatior instead? (to me it seems like i will get
  a lot more functionality/control)

  2. Can someone me how to implement the Repository pattern with
  ActiveRecordMediator. I have found this example here
 http://www.lostechies.com/blogs/johnteague/archive/2008/05/27/using-d...

  but to me it seems like I would have to make a Repository (and inherit
  from BaseRepository) for every Aggregate and then I need to
  instantiate the Repository it when i want to use it.

  Is there a better way of doing this?

  :)

  best regards,
  Mark
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: How to do DDD + AR (repositories)

2009-01-26 Thread Markus Zywitza

Code from the article you linked:

public virtual T FindOne(params ICriterion[] criteria)
{
return ActiveRecordMediatorT.FindOne(criteria);
}

This moves the responsibility for creating a particular query from the
repository to the higher layers, who need to know about an aggregate's
inner workings. Once you start to optimize for n+1 etc., this
knowledge of the persistence is rather deepened than encapsulated.
A better approach is to create a bunch of
FindByWhateverMyAppNeeds(string iNeedThat). That's ugly, but
encapsulates persistence within the repository.

-Markus

2009/1/26 Mark Jensen don...@gmail.com:

 Hi Markus

 Could you explain the contradictions a bit more for me?

 thanks :)



 On Jan 26, 1:22 pm, Markus Zywitza markus.zywi...@gmail.com wrote:
 You lose nothing with dropping ActiveRecordBase but convenience.

 But keep in mind:

 1) AR classes without ARBase make good DTOs, but still bad domain classes.
 2) Generic repositories are an antipattern. A repository should
 encapsulate the knowledge of an aggregate's persistence details. That
 contradicts with ready-to-use-plugs for LINQ or criteria queries.

 If you need to do DDD, use AR as DTO and map it to the domain layer.
 If you are doing this because DDD has a momentary hype, just don't do
 it at all. The Domain Model is not the only enterprise pattern that
 yields maintainable software.

 -Markus

 2009/1/26 Mark Jensen don...@gmail.com:



  Hi

  From what i can read on the internet people do really like this
  combination due to the placement of the persitance logic.

  how ever, i know that Castles AR has something callsed
  ActiveRecordMediator which seems to be the solution to the problem
  above. (i also know ayendes rhino commons which also have an
  implementation of the repository pattern).

  The questions are.

  1. Will i lose something if i stop inheritting from ActiveRecordBase
  and use ActiveRecordMediatior instead? (to me it seems like i will get
  a lot more functionality/control)

  2. Can someone me how to implement the Repository pattern with
  ActiveRecordMediator. I have found this example here
 http://www.lostechies.com/blogs/johnteague/archive/2008/05/27/using-d...

  but to me it seems like I would have to make a Repository (and inherit
  from BaseRepository) for every Aggregate and then I need to
  instantiate the Repository it when i want to use it.

  Is there a better way of doing this?

  :)

  best regards,
  Mark
 


--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: WCF Facility and console self-hosted web services

2009-01-26 Thread Robert M.

It is not any missing dependency nor logging facility... If I use the
following code and open ServiceHost explicitly it just works:

var factory = new DefaultServiceHostFactory
(IoC.Container.Kernel);
host = factory.CreateServiceHost(sms_wcf, new[] {new Uri
(http://localhost:9001/my/service.svc;)});
host.Open();

The problem with this approach is that I do not know how to pass
config settings ( bindings, behaviours) from app.config.

R.




On Jan 26, 12:27 am, Craig Neuwirt cneuw...@gmail.com wrote:
 It's probable that you one or more dependencies have not been satisfied so
 the ServiceHost is not available.  Since you are using logging, you need to
 register the logger facility



 On Sun, Jan 25, 2009 at 5:25 AM, Robert M. robertcmir...@gmail.com wrote:

  Does anyone can help with an example on how can I configure and start
  a webservice using WCF facility in a console application?

  I used the following configuration, but although it compiles and runs,
  the endpoint is not available (I believe the host is not started).

             IoC.Container
                 .AddFacilityWcfFacility()
                 .Register(

                 Component.ForIMyService().ImplementedByMyService()
                     .Named(my_wcf)
                     .ActAs(
                         new DefaultServiceModel().LogMessages()
                             .AddEndpoints(
                                 WcfEndpoint.BoundTo(new
  BasicHttpBinding(Basic)).At(http://localhost:9001/my/service.svc;)
                     )
                 ));

  The problem I am trying to resolve is to use a WCF webservice setup
  with WCF facility but with config settings taken from App.config. All
  examples found in facility's unit tests use a web hosted service which
  works just fine. My app is a console application only.
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: WCF Facility and console self-hosted web services

2009-01-26 Thread Craig Neuwirt
That will always create the service host regardless of missing
dependencies.  However, when you invoke it, it would then fail.

What is the definition os sms_wcf component?

On Mon, Jan 26, 2009 at 1:33 PM, Robert M. robertcmir...@gmail.com wrote:


 Is not the dependency nor logging facility... If I use the following
 code it just works:

var factory = new DefaultServiceHostFactory
 (IoC.Container.Kernel);
host = factory.CreateServiceHost(sms_wcf, new[] {new Uri
 (Config.WebserviceListenUri)});



 On Jan 26, 12:27 am, Craig Neuwirt cneuw...@gmail.com wrote:
  It's probable that you one or more dependencies have not been satisfied
 so
  the ServiceHost is not available.  Since you are using logging, you need
 to
  register the logger facility
 
 
 
  On Sun, Jan 25, 2009 at 5:25 AM, Robert M. robertcmir...@gmail.com
 wrote:
 
   Does anyone can help with an example on how can I configure and start
   a webservice using WCF facility in a console application?
 
   I used the following configuration, but although it compiles and runs,
   the endpoint is not available (I believe the host is not started).
 
  IoC.Container
  .AddFacilityWcfFacility()
  .Register(
 
  Component.ForIMyService().ImplementedByMyService()
  .Named(my_wcf)
  .ActAs(
  new DefaultServiceModel().LogMessages()
  .AddEndpoints(
  WcfEndpoint.BoundTo(new
   BasicHttpBinding(Basic)).At(http://localhost:9001/my/service.svc;)
  )
  ));
 
   The problem I am trying to resolve is to use a WCF webservice setup
   with WCF facility but with config settings taken from App.config. All
   examples found in facility's unit tests use a web hosted service which
   works just fine. My app is a console application only.
 


--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: WCF Integration Facility Roadmap

2009-01-26 Thread Colin Jack

Couple of issues I've observed.

The first was that I had my service class had constructor dependencies
that I'd not registered, this was obviously silly of me but when
debugging all I kept getting was 502s when trying to contact my REST
resources (programatically or using Fiddler) and it took me a while to
work out the reason. I'm thus thinking that an exception server side
might have been cool, to help point people to the source of the
problem.

Secondly since I'm building REST resources I'm not interested in the
service interface that I would be with normal WCF. What I mean is that
I'd be happy to apply the [ServiceContract] and [OperationContract]
directly to my service class and not have it implement an interface
that was tagged up with these attributes. If I do create the interface
then the client will never use it anyway (because if I go down that
path I'm back to RPC). So I'm wondering if you believe adding better
support for this use case is possible?
--~--~-~--~~~---~--~~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---