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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:38:09+00:00 2026-06-05T06:38:09+00:00

Started playing with Visual Studio 2012 RC and Entity Framework 5… absolutely loving it

  • 0

Started playing with Visual Studio 2012 RC and Entity Framework 5… absolutely loving it but wondering if there’s a cleaner way to do this.

I would like to cut out the middle-man of parsing the XML every time, and setting it via .ToString()

public class MyEFEntity
{
    [NotMapped()]
    public XElement Tags { 
        get { return XElement.Parse(tags); } 
        set { tags = value.ToString(); } }

    [Column("Tags", TypeName = "xml"), Required]
    public string tags { get; set; }
}
  • 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-05T06:38:10+00:00Added an answer on June 5, 2026 at 6:38 am

    In principle there is no better way. You need two properties – one for XElement and one for backing persisted string. If you want to reduce amount of parsing and conversion you need to implement some infrastructure for that. General approach would be:

    • Handle ObjectContext.ObjectMaterialized event – if the materialized object is MyEFEntity parse string and save it to XElement property. If you are using DbContext you can still get ObjectContext through its explicitly implemented IObjectContextAdapter.
    • Override SaveChanges – in the method find all modified or inserted instances of MyEFEntity through DbContext.ChangeTracker.GetEntries and save their XML to string property
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started playing with domain-specific tools development, and I'm playing with Visual Studio
I've just started playing with F#, and was wondering whether there is any recommended
I just started playing around with the 960 CSS framework and found that it
I've finally started playing around with Resharper and am loving it! The only problem
I started playing with Postsharp but cannot get past the first step. Someone else
I have just started playing with the ASP.Net MVC framework, and today I created
Just started playing with knockout.Js which is a fantastic framework Steve's really done well
I've recently started using C# after years of using VB.NET When using Visual Studio,
I started playing with JodaTime and I failed to find a handy way to
I started playing with Haskell and I use Vim. I have autoindent on in

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.