Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:16:56+00:00 2026-05-29T23:16:56+00:00

I often find myself duplicating properties from my EF model classes in my view

  • 0

I often find myself duplicating properties from my EF model classes in my view model classes, then decorating them with metadata annotations etc. to attach UI relevant information to them. I prefer using AutoMapper to map my data entities to view models, to inheriting my view models from the entity models or containing the entity model as a property inside the view model. I am just hoping somebody has a tool out there that can read a list of properties from one class and generate another class with the same properties.

I realise this is a very simple task, and will not balk at writing something myself, but I don’t want to reinvent the wheel.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:16:59+00:00Added an answer on May 29, 2026 at 11:16 pm

    prof (had left as a comment, but thought it more visible as a ‘suggestion’)

    As you say, there must be a tool out there. I myself have (more times than i care to mention) opted to use T4 templating to accomplish this task. I basically just use it via a powershell script with a few command line parameters that tell it which model to use etc, etc along the lines of:

    scaffold ViewModel MyModel -Type Edit
    

    which would produce a viewmodel with a name along the lines of MyModelEditViewModel(){}

    will be interested to see other approaches tho.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often find myself storing data in a mysql database, and then wanting to
I often find myself needing to write functions to load/save from/to ASCII (or similar)
I often find myself changing the delimiter of CSV files from , to þ¶þ
I often find myself writing very simple classes instead of C-style structs. They typically
I often find myself writing var message = Hello {0}; and then going back
When creating WPF user controls I often find myself creating small converter classes when
I often find myself using Integers to represent values in different spaces. For example...
I often find myself confused with how the terms 'arguments' and 'parameters' are used.
I often find myself writing a property that is evaluated lazily. Something like: if
I often find myself doing quick checks like this: if (!eregi('.php', $fileName)) { $filename

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.