Re: Silverlight RIA Services
Have you tried hitting the service directly in a browser? You can do a basic check to ensure that the domain service is actually being hosted. If your fully qualified class name was Myapp.RiaProject.Services.MyDomainService then you would browse to it by just replacing the dots with - and adding .svc localhost:1234://Myapp-RiaProject-Services-MyDomainService.svc -David Burela Hazaa On 15 August 2010 21:29, KO CHANG kochang@gmail.com wrote: Hi Shingi, It all look right to me, however, I am curious about the static declaration on title within the metadata class. Is there a reason why it is static? Ko On Thu, Aug 12, 2010 at 9:19 PM, Shingi Mutandwa shingi.mutan...@gmail.com wrote: 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 IQueryablePerson 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 EntityRefTitle(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 ___ 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
RE: Silverlight RIA Services
If you don't have the namespaces the same for the two parts of the partial class it can fail also. Have a look in the generated file (Show all files and look for the .g.cs file) and see if the Title class exists in there. T. From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Shingi Mutandwa Sent: Thursday, 12 August 2010 9:19 PM To: ozSilverlight Subject: Re: Silverlight RIA Services 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 IQueryablePerson 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 EntityRefTitle(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
Re: Silverlight RIA Services
Hi Shingi, It all look right to me, however, I am curious about the static declaration on title within the metadata class. Is there a reason why it is static? Ko On Thu, Aug 12, 2010 at 9:19 PM, Shingi Mutandwa shingi.mutan...@gmail.comwrote: 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 IQueryablePerson 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 EntityRefTitle(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 ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: Silverlight RIA Services
Hi Shingi, It sounds like the object does not exist within the generated code within the Silverlight component. This means that the object is not shared properly from the web app. There are a number of reasons for this - perhaps you don't have an [EnableClientAccess] attribute on your class? Regards, Tony On Thu, Aug 12th, 2010 at 5:24 PM, Shingi Mutandwa shingi.mutan...@gmail.com wrote: Could somebody help me with the System.InvalidOperationException with the message below inside the generated client code of my Silverlight RIA services:- This EntityContainer does not contain an EntitySet of type 'Deintegro.DAL.Data.Title'. If the type is external to this EntityContainer, please make sure youve called AddReference to establish the external link. The exception gets thrown when it tries to return the value of an association property. Regards, Shingi ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Silverlight RIA Services
Have you done a clean solution lately? Sometimes the generated code gets out of sync with the original, and the only way to get it to regenerate is to clean first. T. From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Shingi Mutandwa Sent: Thursday, 12 August 2010 5:41 PM To: ozSilverlight Subject: Re: Silverlight RIA Services Hi Tony I have the service class decorated with [EnableClientAccess()] Regards, Shingi On Thu, Aug 12, 2010 at 5:34 PM, ton...@tpg.com.au wrote: Hi Shingi, It sounds like the object does not exist within the generated code within the Silverlight component. This means that the object is not shared properly from the web app. There are a number of reasons for this - perhaps you don't have an [EnableClientAccess] attribute on your class? Regards, Tony On Thu, Aug 12th, 2010 at 5:24 PM, Shingi Mutandwa shingi.mutan...@gmail.com wrote: Could somebody help me with the System.InvalidOperationException with the message below inside the generated client code of my Silverlight RIA services:- 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. The exception gets thrown when it tries to return the value of an association property. Regards, Shingi ___ 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
Re: Silverlight RIA Services
Also try deleting the Generated_Code folder from under your Silverlight project's folder. That forces the client side regeneration (which I've personally found more reliable than cleaning / rebuilding the solution). Chris On 12 August 2010 19:27, Tony Wright ton...@tpg.com.au wrote: Have you done a clean solution lately? Sometimes the generated code gets out of sync with the original, and the only way to get it to regenerate is to clean first. T. *From:* ozsilverlight-boun...@ozsilverlight.com [mailto: ozsilverlight-boun...@ozsilverlight.com] *On Behalf Of *Shingi Mutandwa *Sent:* Thursday, 12 August 2010 5:41 PM *To:* ozSilverlight *Subject:* Re: Silverlight RIA Services Hi Tony I have the service class decorated with [EnableClientAccess()] Regards, Shingi On Thu, Aug 12, 2010 at 5:34 PM, ton...@tpg.com.au wrote: Hi Shingi, It sounds like the object does not exist within the generated code within the Silverlight component. This means that the object is not shared properly from the web app. There are a number of reasons for this - perhaps you don't have an [EnableClientAccess] attribute on your class? Regards, Tony On Thu, Aug 12th, 2010 at 5:24 PM, Shingi Mutandwa shingi.mutan...@gmail.com wrote: Could somebody help me with the System.InvalidOperationException with the message below inside the generated client code of my Silverlight RIA services:- 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. The exception gets thrown when it tries to return the value of an association property. Regards, Shingi ___ 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 ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: Silverlight RIA Services
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 IQueryablePerson 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 EntityRefTitle(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.comwrote: 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