Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReverseEngineering - partial classes #9504

Closed
dazinator opened this issue Aug 21, 2017 · 2 comments
Closed

ReverseEngineering - partial classes #9504

dazinator opened this issue Aug 21, 2017 · 2 comments

Comments

@dazinator
Copy link

We have an existing database from which we reverse engineer a model (i.e using the scaffold command to point at the existing tables)

We occasional repeat this command to update our model from changes made directly to the database.
We also have some customisations that we need to preserve for particular entities.
In order to preserve them, we place them in a partial class:

FooEntity.cs
FooEntity.partial.cs

However, suppose we move the property definition for particular column, into the partial class:

        private int _FooTypeId;

        public int FooTypeId
        {
            get { return _FooTypeId; }
            set
            {
                _FooTypeId= value;
                OnPropertyChanged(nameof(FooTypeId));
            }
        }

When we next run the command to reverse engineer the database, the reverse engineering process isn't clever enough to see that the property already exists in the partial class, and so it adds it again on the main class:

   public int FooTypeId { get; set; }

This happens with many properties, and so each time we run the command, we have to go though and remove all these duplicate property definitions.

Any solution for this?

@bricelam
Copy link
Contributor

At a high level, you're looking for #4038.

@ajcvickers
Copy link
Member

Closing as a duplicate of #4038

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants