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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:07:27+00:00 2026-05-23T08:07:27+00:00

My question: I would like to add a simple typed property (e.g. string, int,

  • 0

My question: I would like to add a simple typed property (e.g. string, int, double) to my Entity Framework entity (in my ASP.NET project) that is not associated with any field in the database table that corresponds to the entity. I would like to be able to set the value of this property in my ASP.NET project and have the contents of the property auto-magically sent over to the Silverlight client gets the entities via RIA Services.

How do I do this?

Note: If this makes it easier, for my particular instance, I don’t need to save the entities back to the database. Also, it would be great if this worked for views as well as tables.

My setup: I am using Silverlight 4, Entity Framework 4, and RIA Services. It is set up in the normal fashion: Silverlight client application and an ASP.NET server application; I am generating my EF model from the database. RIA services is generating the entities and database access methods on the Silverlight client.

My example:

Database: Customer table

  • CustomerID
  • CustomerName

EF generated entity (ASP.NET server-side): Customer class

  • Public Property CustomerID as Integer
  • Public Property CustomerName as String

I’d like to add a property to the Customer entity that is not associated with the database:

  • Public Property UnicornColor as string

In the my domain service (ASP.NET server side), I’ll fill in the new property myself:

Public Function GetCustomers() As IQueryable(Of Customer)
    Dim customers as IQueryable(of Customer) = Me.ObjectContext.Customers
    For each c as Customer in customers
       c.UnicornColor = "Green"
    Next
    return customers
End Function

On the client side, I’d like this new property and its values to be there when I run my query:

Public Sub LoadCustomers()
    myContext.Load(myContext.GetCustomersQuery, AddressOf CustomersLoaded, Nothing)
End Sub

Public Sub CustomersLoaded(ByVal loadOp as LoadOperation(Of Customer))
    Dim customers as IEnumerable(Of Customer) = loadOp.Entities
    For Each c as Customer in customers
        dim color as string = c.UnicornColor
    Next
End Sub
  • 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-23T08:07:28+00:00Added an answer on May 23, 2026 at 8:07 am

    Use T4s to generate partial classes for entities (e.g. the POCOs T4s in the Visual Studio extension gallery) then add a file e.g. MyEntity.Part2.cs with the same partial class as the generated file, but that contains the new properties.

    For more info Google partial classes C#.

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

Sidebar

Related Questions

This is hopefully a simple question: I have an OpenGL texture and would like
Made a simple server using TcpListen and would like to add SSL to the
A simple (one might think!) question to all CSS gurus: I would like to
this is a simple html question but I would like to know the correct
Question 1 We would like to generate a site map for our CMS site
This question would probably apply equally as well to other languages with C-like multi-line
This seems like a silly question but I would really like your comments and
Just like Carl's question over here I would like to ask you (because I
I would like to ask a rather, general, high-level introductory kind of question regarding
I saw this question asked about C# I would like an answer for PHP.

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.