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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:57:43+00:00 2026-05-27T01:57:43+00:00

I was wondering how to change input values when using the Entity Framework. Till

  • 0

I was wondering how to change input values when using the Entity Framework. Till now I’m using selfmade custom classes which I transform to entity classes. I think I’m doubling the work i have to do. In the custom class I transform the incomming value at the setter. Postal codes in the netherlands are 4 digits plus 2 characters. Some people seperate them with a space, others join them together. At this moment a Regex wil seperate the digits from the characters if necessary. When using the Entity Framework. Is there a possibility to change the incomming value before writing the value to te database? And if so how do I do so?

I was searching for validation but all examples I saw where only throwing errors without effectively transforming the value.

Example of Dutch Postal Code: “5126HG” or “5126 HG” should both result in the same result in the database. I already know how to change, but not where and how to apply.

  • 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-27T01:57:44+00:00Added an answer on May 27, 2026 at 1:57 am

    I think that using custom classes is a good idea, it’s similat to implement the DTO pattern and it’s a good method to separate business layer from data access layer. But if you want to add some validation / modification methods to the entity classes you can do it.

    If you are using EF 4.1 you have POCO classes for entities createted by the generator as partial classes. You can add your custom partial classes adding validation methods, but you need to explicitly call these methods before executing a db operation.

    Another way is using a custom SaveChange handler. Here you can find an example of SaveChange customization.
    http://msdn.microsoft.com/en-us/library/cc716714.aspx

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

Sidebar

Related Questions

I was wondering if there is a way, using PHP, to change this date
i am using spring security and i am wondering how to change the default
I'm wondering how to change the blue highlight/selection color of a UITableViewCell , any
I was wondering if it was possible to change the my Shoes app's icon?
I was wondering - is it possible to change files that are stored on
I'm wondering if it's possible to change the order of things in a select
I'm wondering if I should change the software architecture of one of my projects.
I am wondering if there is a way to change the database at runtime
I was wondering if there is a way to programmatically change a stopgradient color
I was wondering how does Nike website make the change you can see when

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.