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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:22:51+00:00 2026-05-23T07:22:51+00:00

I’m writing an application that has POCO Entity Framework data access on the server.

  • 0

I’m writing an application that has POCO Entity Framework data access on the server. When RIA services creates the model in Silverlight, it generates a (let’s call it) “RIA Services” model. That is, it’s not just a copy of my POCOs. These classes in the model, to begin with, are sealed, and for instance expose Lists as EntityCollections.

Since they are sealed, I cannot extend them to (say) provide extra functionality (that doesn’t belong in the server), or implement an interface.

I can, however, extend the functionality of these classes by implementing the defined partial methods, and adding extra properties to the other partial class.

Is doing so generally discouraged. Is it some kind of code smell? Is there a good reason why I shouldn’t do this?

  • 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-23T07:22:51+00:00Added an answer on May 23, 2026 at 7:22 am

    We use partial implementations frequently but I don’t find it to be code smell. In fact, I think it is a lot better than wrapping them with more code. At that point, you might as well skip RIA and write your own WCF change tracker… but I digress.

    If you want a rich domain model, then partial implementations are one great way to accomplish that. The default code generator creates partial methods for the most meaningful points in a WCF RIA entity’s life cycle. By implementing these partials, you move away from the Anemic Domain Model.

    As you stated above, you can implement an interface and create your own methods and properties. IOW you are not limited to implementing the partial stubs. If all else fails, modify the default code generator to your liking. I did to remove sealed from every entity to make testing easier.

    UPDATE: Here is my code to remove sealed

    [DomainServiceClientCodeGenerator(typeof (CustomClientCodeGenerator), "C#")]
    public class CustomClientCodeGenerator : CSharpClientCodeGenerator
    {
        private EntityGenerator _entityGenerator;
    
        protected override EntityGenerator EntityGenerator
        {
            get { return _entityGenerator ?? (_entityGenerator = new CustomEntityGenerator()); }
        }
    
        private class CustomEntityGenerator : CSharpEntityGenerator
        {
            public override string TransformText()
            {
                return base.TransformText().Replace("sealed ", string.Empty);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.