Kornelije Petak
Kornelije Petak

Reputation: 9572

RIA does not generate all proxy entities

Framework: Silverlight 4 + Entity Framework 4 (SL business application: SL project and .WEB project in a solution)

I have two classes in my Data Layer (not mapped to DB, created manually - I need them for specific view)

[EnableClientAccess]
public class CityInfoFull
{
    [Key]
    public int Id { get; set; }

    public String Country{ get; set; }
    public String Region { get; set; }
    public String City { get; set; }
    public int Population { get; set; }
    public DateTime Founded { get; set; }
}

The RIA generates the appropriate proxy class in the Geography.Web.g.cs

In the same namespace, I have another class:

[EnableClientAccess]
public class Person
{
    [Key]
    public int Id { get; set; }

    public String FullName { get; set; }
    public DateTime DateOfBirth { get; set; }
}

However, RIA does not want to generate the proxy for this class. I need the proxy in Silverlight application and it is not generated.

What could be the reason for that? I don't know where to look anymore.

I've tried:

None of this worked. What else can I do?

Upvotes: 4

Views: 1584

Answers (1)

Jehof
Jehof

Reputation: 35544

You need to define a query method in your domain service for each entity you want to use in the silverlight project. In your case you must define a query operation for CityInfoFull and Person.

public class MyDomainSerivce : DomainService {

   public IQueryable<CityInfoFull> GetCities() {
     // your logic
   }

   public IQueryable<Person> GetPersons() {
     // your logic
   }
}

If you want to allow that entites of the specified types can be inserted, updated and removed in the silverlight application you need to define corresponding Insert-, Update- and Remove-Operations in your DomainService for the entities.

Take a look at the WCF RIA Services documentation to get more details.

Upvotes: 5

Related Questions