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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:48:11+00:00 2026-05-12T15:48:11+00:00

So i have been playing around with the .NET RIA Services with Silverlight, and

  • 0

So i have been playing around with the .NET RIA Services with Silverlight, and i created a new DomainService based on a couple entities from a LINQ2SQL DataContext.

When i tried to compile, i got this error:

Error 2 The entity ‘Data.Service’ does not have a key defined. Entities exposed by DomainService operations must have must have at least one property marked with the KeyAttribute. Portal

So i added a metadata class for the Service object like so:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Data
{
    [MetadataType(typeof(Service.ServiceMetadata))]
    public partial class Service
    {
        internal sealed class ServiceMetadata
        {
            [Key]
            public int PublicAPI;
        }
    }
}

Now i get this error:

Error 4 The associated metadata type for type ‘Data.Service’ contains the following unknown properties or fields: PublicAPI. Please make sure that the names of these members match the names of the properties on the main type. Portal

PublicAPI is definitely defined in the main object as generated by L2S, the namespaces are the same. Any ideas as to what i might be doing wrong?

I realize that the .NET RIA services is still CTP, but this seems like a fundamental part of the framework that should be working.

  • 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-12T15:48:11+00:00Added an answer on May 12, 2026 at 3:48 pm

    I solved this problem. The DataContext that was referring to was in another assembly, and the partial classes i was defining were in the Web Project so there was some kind of disconnect between the versions of the classes that the system was trying to use.

    Moving the datacontext into the web project solved it.

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

Sidebar

Related Questions

I have been playing around with silverlight for a couple of days now and
I have been playing around with the postgresql.conf file for a couple days now.
I have been playing around with GTK since a couple of days now,while going
I have been playing around with ElasticSearch for a new project of mine. I
I've been playing around with asp.net MVC3 a bit and have been struggling to
I have been playing around with webkit.net in a c# win forms project, and
I have been playing around with the EF to see what it can handle.
I have been playing around with the MS Source Server stuff in the MS
I have been playing around a bit with a fairly simple, home-made search engine,
I have been playing around with the MVP pattern using winforms for the last

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.