nhibernate-validator

How to get interpolated message in NHibernate.Validator

 ̄綄美尐妖づ 提交于 2020-01-02 12:14:15
问题 I'm trying to integrate NHibernate.Validator with ASP.NET MVC client side validations, and the only problem I found is that I simply can't convert the non-interpolated message to a human-readable one. I thought this would be an easy task, but turned out to be the hardest part of the client-side validation. The main problem is that because it's not server-side, I actually only need the validation attributes that are being used, and I don't actually have an instance or anything else at hand.

Is there a way to access the target bean from within a Bean Validation field-level ConstraintValidator?

纵饮孤独 提交于 2019-12-23 03:38:10
问题 Apart from using class-level validations, is there a way to access the parent bean of a field-level validation annotation from within its validator class? For example: public class CustomValidator implements ConstraintValidator<CustomValidation, String> { @Override public void initialize(final CustomValidation constraintAnnotation) { } @Override public boolean isValid(final String fieldValue, final ConstraintValidatorContext context) { // is there a way to access the parent object here? } }

NHibernate Validator not integrating with Fluent NHibernate

左心房为你撑大大i 提交于 2019-12-19 04:03:30
问题 I'm having some trouble getting NHV to work with Fluent NHibernate. A unit test that I have that has an entity that SHOULD be failing validation ends up throwing an ADO exception. I have NHV configured the following way: private static void Init() { _SessionFactory = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(connectionString) .ShowSql()) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<SessionFactory>() .ExportTo(pathToExportMappingsTo))

Nhibernate Validator

不打扰是莪最后的温柔 提交于 2019-12-13 05:39:33
问题 In my unit tests I am getting an error when I am debugging. The weird thing is I do not get this whenever I just run the test (it's only when debugging a test). I get an exception whenever I try to validate one of my entities with NHibernate Validator. The following line throws the exception below. InvalidValue[] invalidValues = validatorEngine.Validate(group); Exception: The ProxyFactoryFactory was not configured. Initialize 'proxyfactory.factory_class' property of the session-factory

Configuring Fluent NHibernate and NHibernate Validator

安稳与你 提交于 2019-12-10 12:13:51
问题 I am struggling to get Fluent NHibernate and the NHibernate Validator working together and there seems to be a lack of documentation on the internet about the best way to do this. I have found a few websites which detail how to configure the validator and NHibernate but not Fluent NHibernate. I realise that Fluent NHibernate is just NHibernate with nice mappings but I can't quite get my head around the configuration. This is the code that I use to setup my SessionFactory : public static void

MVC 3, NHIbernate Validators & Message Interpolator

…衆ロ難τιáo~ 提交于 2019-12-08 12:52:50
问题 I have followed this article and have a passing test showing custom validation error messages being returned from a resource file when a call to Validator.IsValid(someEntity) fails. I am trying to translate this to the new unobtrusive client-side validation in MVC3 describe by this article. This also more or less works - well the client-side validation does so I can assume my wiring of NHValidators is good, as you can see the following is output: <input data-val="true" data-val-required="

How to get interpolated message in NHibernate.Validator

折月煮酒 提交于 2019-12-06 09:43:46
I'm trying to integrate NHibernate.Validator with ASP.NET MVC client side validations, and the only problem I found is that I simply can't convert the non-interpolated message to a human-readable one. I thought this would be an easy task, but turned out to be the hardest part of the client-side validation. The main problem is that because it's not server-side, I actually only need the validation attributes that are being used, and I don't actually have an instance or anything else at hand. Here are some excerpts from what I've been already trying: // Get the the default Message Interpolator