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 9206319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:09:02+00:00 2026-06-18T00:09:02+00:00

How can i write my model files in a better way that i can

  • 0

How can i write my model files in a better way that i can preserve the recent changes in modal files if i update the .dbmx file from database.
For example i have added validation attributes

[Required(ErrorMessage="Username is mandatory")]

public string Username
    {
        get { return _username; }
        set
        {
            if (_username != value)
            {
                _username = value;
                OnPropertyChanged("Username");
            }
        }
    }

in one of my modal files and if once i do “Update Modal from Database”
, it got overwritten and lost every thing i changed recently on that file.Please get me a solution or any better design?

  • 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-18T00:09:03+00:00Added an answer on June 18, 2026 at 12:09 am

    You can do this by implementing view models for your presentation layer and applying validation logic there, as I have described here:

    https://stackoverflow.com/a/14531849/1043198

    This way, you will never make manual changes to your entity mapping classes. These automatically generated classes shouldn’t be modified by you – they are simply used for passing data to and from the database. If you are adding validation or other functionality in here, you’re doing it in the wrong place. This should be done through other classes, such as view models or service layers.

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

Sidebar

Related Questions

how can I write, as a comment within a file, the mode that this
Can anyone please tell me how I can write a bash shell script that
Can someone please explain how you can write a url pattern and view that
I need to write model data ( CharField s only) to an XML file
Is there a way in Visual Studio (2008 if it matters) that I can,
I am trying to write a program using python-fuse, but I can't get file
I've found several examples and documentation that show how to read and write files
I am attempting to write an sql command into an sql file so that
You can write //google.com instead of http://google.com and https://google.com where // is relative to
I can write an assertion message one of two ways. Stating success: assertEquals( objects

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.