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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:02:19+00:00 2026-05-23T04:02:19+00:00

I have extended an Entity Framework 4 entity class with a calculated property in

  • 0

I have extended an Entity Framework 4 entity class with a calculated property in a partial class. This member is not available on the client to which the entities are exposed via WCF RIA Services.

The solution to this problem when using C# appears to be changing the extension of the partial class file from .cs to .shared.cs. I tried this with my VB.Net solution (.vb to .shared.vb) and got a long list of errors. I believe what happened is that the partial class lost its association with the entity on the client – it inherited from object rather than EntityObject.

My best guess is that this is related to the way that VB.Net handles namespaces. Each project has a ‘Root Namespace’ which is prepended to anything that is defined within a code file. C# has a ‘Default Namespace’ which is the namespace into which new types are placed by default – via a namespace statement within the file.

The partial class is probably having the client namespace prepended to it which puts it into a different namespace than the entity with which it is associated on the server.

Is there any means of extending an entity in such a way that those extensions are available on the client via WCF RIA Services and VB.Net?

  • 1 1 Answer
  • 2 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-23T04:02:20+00:00Added an answer on May 23, 2026 at 4:02 am

    There is a workaround for this issue that depends on some logic within the T4 templates that generate the entity classes.

        If(Not String.IsNullOrEmpty(namespaceName)) Then
    #>
    
    Namespace <#=namespaceName#>
    
    <#
    

    The entities are generated within the Root Namespace defined at the project level if one is available, and within the Namespace spedified within the EDMX file otherwise (the CodeGenerationTools.VsNamespaceSuggestion method seems to handle this).

    Where a Root Namespace is available, the hand-coded partial classes need to be in that namespace to match the generated ones – they have no namespace declaration at the file level. When these these files are ‘shared’ to the client (via the shared.vb extension), they end up in the client’s Root Namespace whereas the generated entities end up in a namespace that consists of the client’s Root Namespace plus the servers Root Namespace.

    Removing the Root Namespace from the server project and then explicitly declaring the EDMX’s namespace within the handcoded, partial classes results in both these shared files and the generated entitites ending up in the same namespace on the client (the client’s Root Namespace plus the EDMX’s namespace).

    Note: The ‘ADO.Net EntityObject Generator’ template (added using the ‘Add Code Generated Item…’ context menu item in the EDMX designer) seems to behave differently than the designer’s native one. It was not generating a namespace declaration in my tests even if I cleared the Root Namespace at the project level. I am not sure of the reason for this.

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

Sidebar

Related Questions

I have extended PHP's mysqli class, which works fine. But how can I make
I have some classes extended this way: class Baseresidence extends CActiveRecord { public static
I have extended my entities to implement specific interfaces for its type. I am
I have an entity in my EDMX that I've extended with a few fields
I'm having troubles extending the Application class to declare global variables. I have extended
I have a custom adapter extended from the SimpleCursorAdapter. Using this I'm binding a
I have a SharePoint site extended for forms authentication. The Active Directory site is
I have a FBA website and then I extended it (to use Windows Authentication)
I have a C++ Windows application that can be extended by writing C++ plugins,
I have 2 classes, main and extended. I need to use main vars 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.