NVarchar(max) get limited to string[255] in WCF Ria Domain Service

11 posts, 0 answers
  1. Jörg
    Jörg  avatar
    8 posts
    Member since:
    Mar 2009

    Posted 26 Oct 2011 Link to this post

    I use the OpenAccess tool for my web application. The Designer corretly imports the data from sql server and creates a "CLOB" type for my memo fields. Everything works perfect.

    Now I have added a Silverlight widget that uses WCF Ria Services to access the data and basically it works.
    However I have noticed that the generated code in the Silverlight project shows a limitation of 255 characters for all the memo fields which is a problem.
    The problem is that updates do not work for entities, even when the relavant columns have not been changed, I immediately get a verification error back.

    Is this a know issue in the code generator?

    Any help is appreciated
    Joerg
  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 31 Oct 2011 Link to this post

    Hello Jörg ,

     We haven't had such issue reported up until now. Can you please share with me the exact version of OpenAccess you are using. The reason I am asking you this is because in versions prior to Q2 we had a problem where our internal concurrency mechanism was interfering with the one used by RIA and that caused all updates to fail.
    In order to test this can you please turn off our concurrency mechanism for the class with which you are testing and see if that fixes your problem?

    All the best,
    Petar
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

  3. DevCraft banner
  4. Jörg
    Jörg  avatar
    8 posts
    Member since:
    Mar 2009

    Posted 31 Oct 2011 Link to this post

    Hi Petar

    I am using the newest version (Telerik.Open.Access 2011.2.713.3).
    Here the detailed info through the various layers (including a screen shot for every item in the list).

    - On the SQL Server database I have a user defined data type called MemoText defined as nvarchar(max)
    - On various tables I use this datatype, for example the column "ActualStatus"
    - In the ORM designer the column is modeled as a string
    - In the XML definition of the rlinq file the column ActualStatus is shown with length 0 and ado-type CLOB which is correct.
    - On the server side I created a DomainService, but there is nothing special to see
    - In the Silverlight project the generated code for the columns which are modeled with nvarchar(max) (or to be more precise the ones with the user defined data type have a max length of 255 chars.

    Hope with this information you will be able to reproduce the error.

    Regards
    Jörg
  5. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 03 Nov 2011 Link to this post

    Hello Jörg ,

     I have tried the same and I can confirm that the string is not trimmed. I haven't done any additional settings nor have I written any code to handle the string. Is it possible that you have a limitation somewhere in your model that causes the trimming? 
    If you are willing I will create a sample project for you so that you can test on your side and see if it fails.

    Best wishes,
    Petar
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

  6. Jörg
    Jörg  avatar
    8 posts
    Member since:
    Mar 2009

    Posted 08 Nov 2011 Link to this post

    Hi Petar

    I created a small solution that proves my previous statements. Nvarchar(max) get trimmed to string(255) in the generated code file of the Silverlight application. Here the related code snippet of the generated file:

              /// <summary>
           /// Gets or sets the 'Description' value.
           /// </summary>
           [ConcurrencyCheck()]
           [DataMember()]
           [RoundtripOriginal()]
           [StringLength(255)]
           public string Description
           {
               get
               {
                   return this._description;
               }
               set
               {
                   if ((this._description != value))
                   {
                       this.OnDescriptionChanging(value);
                       this.RaiseDataMemberChanging("Description");
                       this.ValidateProperty("Description", value);
                       this._description = value;
                       this.RaiseDataMemberChanged("Description");
                       this.OnDescriptionChanged();
                   }
               }
           }

    I tried to attach the project as a Zip but it is not possible anymore.
    Can I send you the project as a ZIP file by mail?
    Can you please look into this?

    Regards
    Jörg

  7. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 14 Nov 2011 Link to this post

    Hi Jörg ,

    First of all, let me apologize for the late answer.
    Using absolutely the same setup I ended up with this code being generated:

    /// <summary>
            /// Gets or sets the 'Description' value.
            /// </summary>
            [ConcurrencyCheck()]
            [DataMember()]
            [RoundtripOriginal()]
            public string Description
            {
                get
                {
                    return this._description;
                }
                set
                {
                    if ((this._description != value))
                    {
                        this.OnDescriptionChanging(value);
                        this.RaiseDataMemberChanging("Description");
                        this.ValidateProperty("Description", value);
                        this._description = value;
                        this.RaiseDataMemberChanged("Description");
                        this.OnDescriptionChanged();
                    }
                }
            }
    Can you please confirm that you have not decorated your model properties with some additional attributes? Also can you please share with me if you are using xml mapping or attribute one?

    Regards,
    Petar
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

  8. Jörg
    Jörg  avatar
    8 posts
    Member since:
    Mar 2009

    Posted 17 Nov 2011 Link to this post

    Hi Petar

    Yes I can confirm that I did not add any manual attributes or the like. But maybe our setup is not 100% the same?
    I have prepared a demo project that you can download from http://www.evelix.ch/Software/RiaMemoDemoSample.zip 
    This demo also contains a sql script to create the database.

    Can you see any differences to your project? Does it work at your side without the string limitations?

    Regards
    Jörg 
  9. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 22 Nov 2011 Link to this post

    Hi Jörg ,

     I am sorry for the late replay but we have been busy with the release. I will download your project and your database today and write back as soon as I am able to locate the problem. Thank you for the detailed information you have provided.

    Regards,
    Petar
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

  10. Michael
    Michael avatar
    19 posts
    Member since:
    Oct 2011

    Posted 06 Nov 2012 Link to this post

    Update?
  11. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 09 Nov 2012 Link to this post

    Hello Michael,

     This was confirmed to be a bug on our side that has been fixed.

    Greetings,
    Petar
    the Telerik team
    Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
  12. Michael
    Michael avatar
    19 posts
    Member since:
    Oct 2011

    Posted 09 Nov 2012 Link to this post

    Ok
Back to Top
DevCraft banner