Question

In my Model I have things like that :

    [...]

    public string PasswordConfirm { get; set; }

    public string Captcha { get; set; }

    [...]

I would like that these two attributes are required but not serializable

I tried tu use [required] and [nonSerialized] annontations but without success. I already saw this post

But I don't know how to do what I want. It will be helpful for NonObtrusive-Validation, i want these field complete but i don't want to serialized them.

No correct solution

OTHER TIPS

I found a solution to my answer.

I can use the annotation [notMapped] which is compatible with [required], [compare] ...

I also use this :context.Configuration.ValidateOnSaveEnabled = false; where I filled my base because i got a problem with validation here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top