castle

Localized Attribute parameters in C#

In C#, attribute parameters require to be a constant expression, typeof or array creation expression. Various libraries, like for example Castle validator, allow specifying passing what seems like localized error messages to attribute constructor: //this works [ValidateNonEmpty("Can not be empty")] //this does not compile [ValidateNon...

Castle WCF DefaultServiceHostFactory in IIS: Accessing the ServiceHost

I am attempting to move from a self hosting architecture to hosting under IIS 6, primarily to take advantage of built in dynamic compression. I am using the Castle DefaultServiceHostFactory to provide the service to IIS in the .svc file. However, I need to programmatically specify certain end points and behaviours and I do not know how...

architectural question asp.net mvc, nhibernate, castle

I have implemented a service which uses a DAOFactory and a NHibernate Helper for the sessions and transactions. The following code is very much simplified: public interface IService { IList<Disease> getDiseases(); } public class Service : IService { private INHibernateHelper NHibernateHelper; private IDAOFactory DAOFactory;...

Castle MonoRail ARDataBind trying to bind to non-existent row

I have a shopping cart application running on MonoRail and using Castle ActiveRecord/NHibernate, and there is a ShoppingCart table and a ShoppingCartItems table, which are mapped to entities. Here's the scenario: a user adds things to the shopping cart, say 5 items, and goes to view the cart. The cart shows all 5 items. the user du...

NHibernate 2.1.2 in medium trust.

I'm trying to configure nhibernate 2.1.2 to run in medium trust, without any luck. I have tried follwing the suggestions to run in medium trust and pre-generating the proxies. I then tried to remove all references to lazy loading setting the default-lazy="false" on all classes and bags. However this threw an exception asking me to confi...

Castle Dynamic Proxy is it possible to intercept value types?

Hi, I have a problem and can not find answer and any tip if it is possible to intercept value types in C# by Castle dynamic proxy? I want to intercept IDictionary with INotifyChanged interface. I need this to update view when presenter is changing model. Boxing decimal in object only for making interface is not good idea... maybe somebod...

Min Length Custom AbstractValidationAttribute and Implementing Castle.Components.Validator.IValidator

I see with the Castle validators I can use a length validation attribute. [ValidateLength(6, 30, "some error message")] public string SomeProperty { get; set; } I am trying to find a MinLength only attribute is there a way to do this with the out of the box attributes? So far my idea is implementing AbstractValidationAttribut...

In which assembly I find namespace 'NHibernate.Proxy.Poco.Castle'?

In which assembly I find namespace 'NHibernate.Proxy.Poco.Castle'? I can find in NHibernate.dll the Proxy.Poco, but not Proxy.Poco.Castle... (using Nhibernate 2.1.2.4000). ...

How do I set up Array/List dependencies in code with Castle Windsor?

Hi, I have the following classes: class Repository : IRepository class ReadOnlyRepository : Repository abstract class Command abstract CommandImpl : Command { public CommandImpl(Repository repository){} } class Service { public Service (Command[] commands){} } I register them in code as follows: var container = new Contai...

Castle DynamicProxy : How to Proxy Equals when proxying an interface ?

I need to use Castle DynamicProxy to proxy an interface by providing an instance of it to ProxyGenerator.CreateInterfaceProxyWithTarget. I also need to make sure that calls to Equals, GetHashCode and ToString hits the methods on the concrete instance, that I am passing, and I can't get that to work. In other words, I'd like this small ...

Nhibernate.Bytecode.Castle Trust Level on IIS

Trying to deploy the wcf service, depended on nhibernate. And getting the following exception On Reflection activator. [SecurityException: That assembly does not allow partially trusted callers.] System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodH...

Good book on Castle Project?

Does anyone know of a good book on the Castle Project? I'm interested in learning more about any of the Castle projects (ActiveRecord, MonoRail, Windsor, anything!) and searches for Castle on Amazon are a little frustrating with the need to weed out all the fiction and nonsense. ...

Issue intercepting property in Silverlight application

I am using Ninject as DI container in a Silverlight application. Now I am extending the application to support interception and started integrating DynamicProxy2 extension for Ninject. I am trying to intercept call to properties on a ViewModel and ending up getting following exception: “Attempt to access the method failed: System.Reflec...

How to execute custom query and return generic list?

I can only seem to find how to return arrays from my function. Here is my model: [ActiveRecord("incident")] public class Incident : ActiveRecordBase<Incident> { public Incident() { } [PrimaryKey("id")] public int Id { get; set; } [Property("name")] public int Name { get; set; } } I'm currently using SimpleQuery h...

How to define recursive Property in Castel ActiveRecord?

Hi, Suppose you have a class named MyClass. MyClass should have a property named Parent, Parent must be of type MyClass itslef. It is necessary because MyClass wants to hold a tree structure. How can it be done? ...

Overridding GetHashCode and Equals in Castle Dynamic Proxy 2.1 IModelInterceptorsSelector

I've read that in order to get caching and push performance when using an Interceptor Selector when using Castle Dynamic Proxy that I need to override GetType(), GetHashCode() and Equals() Where can I find an example of or what would be the best, from a performing perspective, implementation? ...

asp.net mvc test project cannot find windsor file

Hi there Im using windsor as a DI container, my code is below public static class ContainerBuilder { public static IWindsorContainer Build() { var container = new WindsorContainer("Configuration\\Windsor.config"); // automatically register controllers container.Register(AllTyp...

Castle Windsor & NHibernate facility: Value cannot be null. Parameter name: classType

Hi I am attempting to use Castle windsor Nhibernate Facility with fluent Nhibernate and Im getting the error above, as far as Im aware , I have followed the instructions on setting this up. Has anyone else seen this issue and maybe offer some advice? Thanks Value cannot be null. Parameter name: classType Description: An unhandled except...

Castle windsor Nhibernate Facility cCastle.Facilities.NHibernateIntegration.ISessionManager which was not registered.

Hi Iam having some trouble getting castle Nhibernate facility up and running properly. This error I guess makes sense because the Nhbernate repository constructor takes in an ISessionManager as a constructor argument, my question is does castle not inject this dependency? or is there something wrong with my configuration UserServiceTest...

Why ActiveRecordHooksBase.OnUpdate does not work in cascaded mode?

Suppose we have two entities Blog and Post that Blog has many Posts. Post is saved indirectly through Blog. When I override OnUpdate in Post, it causes to save Posts that have null Blog. In the other hand overriding OnUpdate in Post causes not saving it properly. Someone else have had same problem. The code is: protected override void ...