locked
SilverLight5+RIA service在客户端不能自动生成Generated_Code RRS feed

  • 问题

  •     最近在做一个silverlight5+RIAService的框架,遇到了一个这样的问题,新建普通项目,并完成DomainService的搭载在建立silverlightLibrary和服务端SilverlightApplication.Web的RIA link后生成项目,没有Generated_Code文件的出现,后来发现将客户端的silverlightLibrary的版本修改为4.0后可以出现,我现在的环境是vs2010,.netFormwork4.0、silverlight5.0为了不让项目每次都去降到silverlight4.0大家帮忙看一下该怎么修改?
    2013年5月4日 7:43

答案

  • Hi,

    If you build your solution and you don't get the generated code described , here are some things to check:

    • In your business layer component (where your business classes are defined):
      • The class(es) you want to access from Silverlight must be a public.
      • The properties that you want to access from Silverlight must be public.
      • The Key attribute must be defined on one of the business class public properties.
    • In your Silverlight project:
      • Ensure you have a WCF RIA Services link.
        • Open the Silverlight project properties. The WCF RIA Services link is defined at the bottom of the properties dialog
    • In your ASP.NET project (that was created automatically when you created your Silverlight project)
      • You must have a reference defined to your business layer component.
    • In your Domain Service class:
      • The Domain Service class must be defined within the ASP.NET project (or in a class referenced by the ASP.NET project).
      • It must have the EnableClientAccess attribute on the class.
      • It must inherit from the DomainService class (or one of its specialized classes such as LinqToEntiesDomainService if you are using Entity Framework)
      • If you define a Query method to retrieve data from your business class, the Query method:
        • Must be a method and not a property.
        • Must return one of the following:
          • A single entity (instance of the business object class)
          • An IEnumerable<T> where T is the entity
          • An IQueryable<T> where T is the entity
        • Can have any parameters.
        • Can have any name.
        • Can (but does not have to) have a Query attribute to define the method as a query.
      • If you define an Update method to update data from your business class, the Update method:
        • Must be a method.
        • Must have no return value.
        • Must pass the entity as a parameter.
        • Must either:
          • Start with "Update", "Change" or "Modify
          • Or have an Update attribute

    For more information, please try to refer to: http://msmvps.com/blogs/deborahk/archive/2010/07/20/sl-ria-poco-no-generated-code.aspx


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    2013年5月8日 1:48

全部回复

  • Hi,

    If you build your solution and you don't get the generated code described , here are some things to check:

    • In your business layer component (where your business classes are defined):
      • The class(es) you want to access from Silverlight must be a public.
      • The properties that you want to access from Silverlight must be public.
      • The Key attribute must be defined on one of the business class public properties.
    • In your Silverlight project:
      • Ensure you have a WCF RIA Services link.
        • Open the Silverlight project properties. The WCF RIA Services link is defined at the bottom of the properties dialog
    • In your ASP.NET project (that was created automatically when you created your Silverlight project)
      • You must have a reference defined to your business layer component.
    • In your Domain Service class:
      • The Domain Service class must be defined within the ASP.NET project (or in a class referenced by the ASP.NET project).
      • It must have the EnableClientAccess attribute on the class.
      • It must inherit from the DomainService class (or one of its specialized classes such as LinqToEntiesDomainService if you are using Entity Framework)
      • If you define a Query method to retrieve data from your business class, the Query method:
        • Must be a method and not a property.
        • Must return one of the following:
          • A single entity (instance of the business object class)
          • An IEnumerable<T> where T is the entity
          • An IQueryable<T> where T is the entity
        • Can have any parameters.
        • Can have any name.
        • Can (but does not have to) have a Query attribute to define the method as a query.
      • If you define an Update method to update data from your business class, the Update method:
        • Must be a method.
        • Must have no return value.
        • Must pass the entity as a parameter.
        • Must either:
          • Start with "Update", "Change" or "Modify
          • Or have an Update attribute

    For more information, please try to refer to: http://msmvps.com/blogs/deborahk/archive/2010/07/20/sl-ria-poco-no-generated-code.aspx


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    2013年5月8日 1:48
  • Hi,Amy

    Thank you for your answer!

    I am fully in accordance with the deployment, but no Generated_Code file, this is probably a normal case!

    2013年5月21日 3:58