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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:58:25+00:00 2026-05-15T17:58:25+00:00

I am putting together a WCF Data Service for PatientEntities using Entity Framework. My

  • 0

I am putting together a WCF Data Service for PatientEntities using Entity Framework.

My solution needs to address these requirements:

  • Property DateOfBirth of entity Patient is stored in SQL Server as string. It would be ideal if the entity class did not also use the “string” type but rather a DateTime type. (I would expect this to be possible since we’re abstracting away from the storage layer). Where could a conversion mechanism be put in place that would convert to and from DateTime/string so that the entity and SQL Server are in sync?. I cannot change the storage layer’s structure, so I have to work around it.
  • WCF Data Services (Read-only, so no need for saving changes) need to be used since clients will be able to use LINQ expressions to consume the service. They can generate results based on any given query scenario they need and not be constrained by a single method such as GetPatient(int ID).

I’ve tried to use DTOs, but run into problem of mapping the ObjectContext to a DTO, I don’t think that is theoretically possible…or too complicated if it is.

I’ve tried to use Self Tracking Entities but they require the metadata from the .edmx file if I’m correct, and this isn’t allowing a different property data type.

I also want to add customizations to my Entity getter methods so that a property “MRN” of type “string” needs to have .Replace(“MR~”, string.Empty) performed before it is returned. I can add this to the getter methods but the problem with that is Entity Framework will overwrite that next time it refreshes the entity classes. Is there a permanent place I can put these?

Should I use POCO instead? How would that work with WCF Data Services? Where would the service grab the metadata?

  • 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-15T17:58:25+00:00Added an answer on May 15, 2026 at 5:58 pm

    This is definitely possible. What you need to use is QueryView which lets you control how a given column maps to a property on your entity. for instance here is something u could do on patients entity.

    <EntitySetMapping Name="Patients">
    <QueryView>
    select value conceptualnamespace.Patient(p.PatientId,
    cast(p.DateOfBirth as Edm.DateTime), 
    replace(p.Name,'MR~','')
    from entitycontainer.Patients as p
    </QueryView>
    </EntitySetMapping>
    

    i cover more on this concept in my book. the recipe is called.
    15-2. Mapping an Entity to Customized Parts of One or More Tables

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

Sidebar

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.