The EDMX and the RIA services are in different projects and therefore the
“Generate metadata” checkbox is disabled when generating the domain service
in Visual Studio. However we created a partial class in the same project
containing the EDMX and applied the [include] attr like so:-



[MetadataType(typeof(PersonMetadata))]
public partial class Person
{
    internal static class PersonMetadata
    {
        [Include]
        public static Title Title { get; set; }
    }
}



And this is the method inside the domain service:-



public IQueryable<Person> GetPeople()

{

   return this.ObjectContext.People.Include("Title");

}





And here is the generated data contract on the client:-



public sealed partial class Person : Entity

{



/// <summary>
/// Gets or sets the associated <see cref="Title"/> entity.
/// </summary>

[Association("Title_Person", "TitleId", "Id", IsForeignKey=true)]

[XmlIgnore()]
public Title Title

{

    get

    {

        if ((this._title == null))

        {

            this._title = new EntityRef<Title>(this, "Title", this.FilterTitle);

        }

        return this._title.Entity; // ***** throws exception here



    }

    set

    {

        …

    }

}



….

}



Exception Details:-

{System.InvalidOperationException: This EntityContainer does not contain an
EntitySet of type 'Deintegro.DAL.Data.Title'. If the type is external to
this EntityContainer, please make sure you’ve called AddReference to
establish the external link.
   at
System.ServiceModel.DomainServices.Client.EntityContainer.GetEntitySet(Type
entityType)
   at System.ServiceModel.DomainServices.Client.EntityRef`1.get_Entity()
   at Deintegro.DAL.Data.Person.get_Title()}    System.Exception
{System.InvalidOperationException}



On Thu, Aug 12, 2010 at 8:57 PM, Shingi Mutandwa
<shingi.mutan...@gmail.com>wrote:

> Deleted the generated_code folder but I am still having the same issue. The
> domain service class was generated by Visual studio and I did not add
> anything to it.
>
>
> On Thu, Aug 12, 2010 at 8:09 PM, KO CHANG <kochang....@gmail.com> wrote:
>
>> Hi Shinji,
>>
>>   It is likely that you didn't declare any ria service operation regarding
>> the entity.
>>
>> For example, have you got any [Insert], [Update], [Delete], [Query]
>> methods within the domain service?
>>
>> Ko
>>
>>
>> _______________________________________________
>> ozsilverlight mailing list
>> ozsilverlight@ozsilverlight.com
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>
>>
>
_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to