Re: IDynamicActionProvider and Windsor/IoC

2009-01-15 Thread morcs

IRepositoryFactory: Yes
CrudActionProvider?  Whoops!

...and I was so determined not to make a fool of myself in my first
post to this group!

Sorry about that, and thanks for the help!

On Jan 15, 5:11 am, Mike Nichols nichols.mik...@gmail.com wrote:
 Hi Morcs
 I am sure you have already checked but are you sure your
 IRepositoryFactory and IDynamicActionProviders are registered on the
 container?

 On Jan 14, 4:40 am, morcs ja...@bigjump.co.uk wrote:

  Hi there,

  I'm using the Castle trunk, and I understand that thanks to Mike
  Nichols and his WindsorDynamicActionProviderFactory:

 http://groups.google.com/group/castle-project-devel/browse_thread/thr...

  I should be able to get Windsor to instantiate my
  DynamicActionProvider with my repository factory.

  I have the following code:

  [DynamicActionProvider(typeof(CrudActionProvider))]
  public class MyController : Controller
  {

  }

  public class CrudActionProvider : IDynamicActionProvider
  {
      private IRepositoryFactory repositoryFactory;

      public CrudActionProvider(IRepositoryFactory repositoryFactory)
      {
          this.repositoryFactory = repositoryFactory;
      }

      public void IncludeActions(IEngineContext engineContext,
  IController controller, IControllerContext controllerContext)
      {
          ((Controller)controller).DynamicActions[List] = new
  ListAction(repositoryFactory);
      }

  }

  Unfortunately when I hit the action I get:

  No parameterless constructor defined for this object.

  I can see the Windsor class in the stack trace though:

  [MissingMethodException: No parameterless constructor defined for this
  object.]
     System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
  publicOnly, Boolean noCheck, Boolean canBeCached,
  RuntimeMethodHandle ctor, Boolean bNeedSecurityCheck) +0
     System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
  fillCache) +86
     System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
  skipVisibilityChecks, Boolean fillCache) +230
     System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
     System.Activator.CreateInstance(Type type) +6

  Castle.MonoRail.Framework.Services.DefaultDynamicActionProviderFactory.Create
  (Type dynamicActionProviderType) +316

  Castle.MonoRail.WindsorExtension.WindsorDynamicActionProviderFactory.Create
  (Type dynamicActionProviderType) +149
     Castle.MonoRail.Framework.Controller.ProcessDynamicActionProviders
  () +184
     Castle.MonoRail.Framework.Controller.PrepareToExecuteAction
  (IEngineContext engineContext, IControllerContext context) +140
     Castle.MonoRail.Framework.Controller.Process(IEngineContext
  engineContext, IControllerContext context) +53
     Castle.MonoRail.Framework.BaseHttpHandler.Process(HttpContext
  context) +175

  Many thanks for any help you can give,

  morcs
--~--~-~--~~~---~--~~
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: IDynamicActionProvider and Windsor/IoC

2009-01-15 Thread Mike Nichols

No prob. I just do this in my config:
container.Register( AllTypes.FromAssembly
(webAssm).BasedOnIDynamicActionProvider());

On Jan 15, 3:46 am, morcs ja...@bigjump.co.uk wrote:
 IRepositoryFactory: Yes
 CrudActionProvider?  Whoops!

 ...and I was so determined not to make a fool of myself in my first
 post to this group!

 Sorry about that, and thanks for the help!

 On Jan 15, 5:11 am, Mike Nichols nichols.mik...@gmail.com wrote:

  Hi Morcs
  I am sure you have already checked but are you sure your
  IRepositoryFactory and IDynamicActionProviders are registered on the
  container?

  On Jan 14, 4:40 am, morcs ja...@bigjump.co.uk wrote:

   Hi there,

   I'm using the Castle trunk, and I understand that thanks to Mike
   Nichols and his WindsorDynamicActionProviderFactory:

  http://groups.google.com/group/castle-project-devel/browse_thread/thr...

   I should be able to get Windsor to instantiate my
   DynamicActionProvider with my repository factory.

   I have the following code:

   [DynamicActionProvider(typeof(CrudActionProvider))]
   public class MyController : Controller
   {

   }

   public class CrudActionProvider : IDynamicActionProvider
   {
       private IRepositoryFactory repositoryFactory;

       public CrudActionProvider(IRepositoryFactory repositoryFactory)
       {
           this.repositoryFactory = repositoryFactory;
       }

       public void IncludeActions(IEngineContext engineContext,
   IController controller, IControllerContext controllerContext)
       {
           ((Controller)controller).DynamicActions[List] = new
   ListAction(repositoryFactory);
       }

   }

   Unfortunately when I hit the action I get:

   No parameterless constructor defined for this object.

   I can see the Windsor class in the stack trace though:

   [MissingMethodException: No parameterless constructor defined for this
   object.]
      System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
   publicOnly, Boolean noCheck, Boolean canBeCached,
   RuntimeMethodHandle ctor, Boolean bNeedSecurityCheck) +0
      System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
   fillCache) +86
      System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
   skipVisibilityChecks, Boolean fillCache) +230
      System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
      System.Activator.CreateInstance(Type type) +6

   Castle.MonoRail.Framework.Services.DefaultDynamicActionProviderFactory.Create
   (Type dynamicActionProviderType) +316

   Castle.MonoRail.WindsorExtension.WindsorDynamicActionProviderFactory.Create
   (Type dynamicActionProviderType) +149
      Castle.MonoRail.Framework.Controller.ProcessDynamicActionProviders
   () +184
      Castle.MonoRail.Framework.Controller.PrepareToExecuteAction
   (IEngineContext engineContext, IControllerContext context) +140
      Castle.MonoRail.Framework.Controller.Process(IEngineContext
   engineContext, IControllerContext context) +53
      Castle.MonoRail.Framework.BaseHttpHandler.Process(HttpContext
   context) +175

   Many thanks for any help you can give,

   morcs
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Register Synchronization in ATM

2009-01-15 Thread Tavo

Hi, i need to publish an event after commiting a transaction.

I'm doing Something like this

[Transaction]
public void HandleObject(ObjectDTO dto)
{
  MyObject myObject = GetMyObjectFromDto(dto);
  transactionManager.RegisterSynchronization(new MySynchronization
(myObject))
  ActOnMyObject(myObject)
}

Inside the MySynchronization i send the event through the bus After
Commit

I don't like so much having am explicit dependency on the
transactionManager and having to write this inside my code, but i
don't see another way to register my synchronization...

How may i improve this?

Gustavo.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Castle-Windsor Fluent Interface: How to register all implementations of all interfaces?

2009-01-15 Thread George Mauer

I have two assemblies EDC2.DAL and EDC2 where EDC2.DaoInterfaces
defines a bunch of interfaces for data access objects to objects in
the EDC2.Domain namespace. These are all implemented by classes in
EDC2.DAL.

So to give an example:

Assembly EDC2
  Namespace EDC2.DaoInterfaces
ICustomerDao
IProductDao
Assembly EDC2.DAL
  Namespace EDC2.DAL
CustomerDao : ICustomerDao
ProductDao : IProductDao
I would like to use Windsor's fluent interface to register all
interfaces in EDC2.DaoInterfaces as being implemented by their
corresponding implementors in EDC2.DAL.

Can anyone tell me how to do this?

Crossposted on Stackoverflow if you want some rep:
http://stackoverflow.com/questions/448788/castle-windsor-fluent-interface-how-to-register-all-implementations-of-all-inter
--~--~-~--~~~---~--~~
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: Castle-Windsor Fluent Interface: How to register all implementations of all interfaces?

2009-01-15 Thread Ayende Rahien
AllTypes.FromAssembly(foo)  .Where( delegate )

On Thu, Jan 15, 2009 at 6:07 PM, George Mauer gma...@gmail.com wrote:


 I have two assemblies EDC2.DAL and EDC2 where EDC2.DaoInterfaces
 defines a bunch of interfaces for data access objects to objects in
 the EDC2.Domain namespace. These are all implemented by classes in
 EDC2.DAL.

 So to give an example:

 Assembly EDC2
  Namespace EDC2.DaoInterfaces
ICustomerDao
IProductDao
 Assembly EDC2.DAL
  Namespace EDC2.DAL
CustomerDao : ICustomerDao
ProductDao : IProductDao
 I would like to use Windsor's fluent interface to register all
 interfaces in EDC2.DaoInterfaces as being implemented by their
 corresponding implementors in EDC2.DAL.

 Can anyone tell me how to do this?

 Crossposted on Stackoverflow if you want some rep:

 http://stackoverflow.com/questions/448788/castle-windsor-fluent-interface-how-to-register-all-implementations-of-all-inter
 


--~--~-~--~~~---~--~~
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: Castle-Windsor Fluent Interface: How to register all implementations of all interfaces?

2009-01-15 Thread George Mauer

Thanks for the quick response but I'm not sure that I get it.

How does that register the components as implementing their interface?
I would like to be able to do something like
container.ResolveICustomerDao().

On Jan 15, 5:12 pm, Ayende Rahien aye...@ayende.com wrote:
 AllTypes.FromAssembly(foo)  .Where( delegate )

 On Thu, Jan 15, 2009 at 6:07 PM, George Mauer gma...@gmail.com wrote:

  I have two assemblies EDC2.DAL and EDC2 where EDC2.DaoInterfaces
  defines a bunch of interfaces for data access objects to objects in
  the EDC2.Domain namespace. These are all implemented by classes in
  EDC2.DAL.

  So to give an example:

  Assembly EDC2
   Namespace EDC2.DaoInterfaces
     ICustomerDao
     IProductDao
  Assembly EDC2.DAL
   Namespace EDC2.DAL
     CustomerDao : ICustomerDao
     ProductDao : IProductDao
  I would like to use Windsor's fluent interface to register all
  interfaces in EDC2.DaoInterfaces as being implemented by their
  corresponding implementors in EDC2.DAL.

  Can anyone tell me how to do this?

  Crossposted on Stackoverflow if you want some rep:

 http://stackoverflow.com/questions/448788/castle-windsor-fluent-inter...
--~--~-~--~~~---~--~~
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: Castle-Windsor Fluent Interface: How to register all implementations of all interfaces?

2009-01-15 Thread George Mauer

Thanks for the answer, I finally found my answer here:
http://blogger.forgottenskies.com/?p=266

On Jan 15, 5:19 pm, George Mauer gma...@gmail.com wrote:
 Thanks for the quick response but I'm not sure that I get it.

 How does that register the components as implementing their interface?
 I would like to be able to do something like
 container.ResolveICustomerDao().

 On Jan 15, 5:12 pm, Ayende Rahien aye...@ayende.com wrote:

  AllTypes.FromAssembly(foo)  .Where( delegate )

  On Thu, Jan 15, 2009 at 6:07 PM, George Mauer gma...@gmail.com wrote:

   I have two assemblies EDC2.DAL and EDC2 where EDC2.DaoInterfaces
   defines a bunch of interfaces for data access objects to objects in
   the EDC2.Domain namespace. These are all implemented by classes in
   EDC2.DAL.

   So to give an example:

   Assembly EDC2
    Namespace EDC2.DaoInterfaces
      ICustomerDao
      IProductDao
   Assembly EDC2.DAL
    Namespace EDC2.DAL
      CustomerDao : ICustomerDao
      ProductDao : IProductDao
   I would like to use Windsor's fluent interface to register all
   interfaces in EDC2.DaoInterfaces as being implemented by their
   corresponding implementors in EDC2.DAL.

   Can anyone tell me how to do this?

   Crossposted on Stackoverflow if you want some rep:

  http://stackoverflow.com/questions/448788/castle-windsor-fluent-inter...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---