N
N
Nikita2012-05-05 11:22:20
ASP.NET
Nikita, 2012-05-05 11:22:20

Separating attributes from model in asp.net mvc3 into separate class?

Hello, hacker. After describing the field with five attributes, I wanted to move them into a separate configuration class, and leave the model itself clean. How is it done in the entity framework.
I found something similar here, but the project does not look very fresh and there are a lot of complaints about it, judging by the comments.
blog.hazzik.ru/post/19465323230/mvcextensions-intro
Tell me the solution to my problem. Surround with region do not offer)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SabMakc, 2012-05-05
@SabMakc

You can use the MetadataType tag.
It looks like this:

    [MetadataType(typeof(MyClassAttr))]
    public partial class MyClass
    {
        public string Name { get; set; }
    }

    public class MyClassAttr
    {
        [Display(Name = "Имя")]
        public string Name { get; set; }
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question