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

  • SEARCH
  • Home
  • 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 8686455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:51:16+00:00 2026-06-12T22:51:16+00:00

Im using the EF Power Tools to Reverse Engineer an existing Database. This is

  • 0

Im using the EF Power Tools to Reverse Engineer an existing Database. This is fine. Under the EDMX Database-1st Route I would create partial classes for any overrides like Data Annotations, for e.g. here, LedgerPeriod being the original EntityObject:

[MetadataType(typeof(LedgerPeriodMetaData))]
public partial class LedgerPeriod
{
    public class LedgerPeriodMetaData
    {

        [Required(ErrorMessage = "Period Start Date Required")]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        [DataType(DataType.Date)]
        public object PeriodDateFrom { get; set; }

        [Required(ErrorMessage = "Period End Date Required")]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        [DataType(DataType.Date)]
        public object PeriodDateTo { get; set; }

    }
}

This is fine. Now do I use the same approach for Code First Reverse Engineer or are there any custom settings whereby if you have to run the power tools multiple times, because say I added a new Table to the Database, it wouldn’t overwrite any changes to the existing Models created previously.

This would ultimately mean I can make changes to the actual model classes themselves, instead of creating partial classes.

Reference to the EF Powertools can be found here:

http://blogs.msdn.com/b/adonet/archive/2012/04/09/ef-power-tools-beta-2-available.aspx

  • 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-06-12T22:51:17+00:00Added an answer on June 12, 2026 at 10:51 pm

    Code First does not officially support the reverse engineering scenario, that’s why it’s called Code First. The power tools are nice, but as you say, they will overwrite things. EF Code First is designed so that you make your changes to the models themselves, not partials and metadata (though you can still use those if you want).

    What you could do is use the Customize Reverse Engineer Templates feature of EF Power Tools, then modify the T4 templates to add partial declarations to the generated classes, or you could add code to test for specific entities and modify those as you want.

    However, in reality, you shouldn’t need to do this. It’s considered bad design to pass your entities to your Views, and that would be the only reason to add those attributes to the models. On top of that, you’re forcing your views to have the same requirements as your data model, which is also a bad choice.

    You should instead be using dedicated view models with your views, and place your data attributes on your view models.

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

Sidebar

Related Questions

Following on from this question here: Entity Framework Reverse Engineer using Power Tools -
I was using Entity Framework Power Tools Beta 2 to reverse engineering Code First.
I'm using Entity Framework 5 with Visual Studio with Entity Framework Power Tools Beta
In this scenario, I have an existing database with three models: Address , which
I'm using Flixel Power Tools for my new project, to be specific I'm using
I used the TFS 2010 Power Tools to create a custom field for a
I'm generating a power model using Multilayer Perceptron on Weka which is a statistic
I'm considering using a neural network to power my enemies in a space shooter
The below program calculates 2 raised to the power n without using any loop,runtime
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question

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.