DataTypes and WCF DataService

5 posts, 0 answers
  1. Brian
    Brian avatar
    4 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    I created two projects one for my service (asp.net website) and the second as a library with OpenAccess.  When I try to expose the database using DataServices the service throws an error because some of my fields are Char datatype.  I can change thee .generated.cs files to int16 however this is a hack and will have to be changed each time I regenerate.  Please let me know if there is an alternative to this.

    Error:
    The exception message is 'The property 'CityType' on type 'Ekwipper.Grocery.Data.City' is not a valid property. Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.'. See server logs for more details. The exception stack trace is:

    Generated Property
    private System.Nullable<System.Char> cityType;
            [Column("cityType", OpenAccessType = OpenAccessType.Character, IsNullable = true, Length = 1, SqlType = "char")]
            [Storage("cityType")]
            public virtual System.Nullable<System.Char> CityType 
            
                get
                {
                    return this.cityType;
                }
                set
                {
                    this.cityType = value;
                }
            }

    Thanks in Advance!
  2. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 12 Nov 2010 Link to this post

    Hi Brian,

    The problem is that System.Char is not among the supported by WCF Data Services primitive types. The full list of supported primitive types is here - http://msdn.microsoft.com/en-us/library/bb399213.aspx. You can read more about the problem is this thread.
    A possible solution would be to use string instead of char (by changing the property type in the visual designer).

    Sincerely yours,
    Jordan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Brian
    Brian avatar
    4 posts
    Member since:
    Sep 2010

    Posted 12 Nov 2010 Link to this post

    I figured that this was the problem however why doesn't OpenAccess map to string?  NetTiers another ORM has some base routines that swap out db types for c# types and can be adjusted.

    I went to the rlinq model and changed the datatype however it did not change the City.generated.cs code.  I probably just don't understand how to regenerate the entities.  Any help?

  5. Brian
    Brian avatar
    4 posts
    Member since:
    Sep 2010

    Posted 12 Nov 2010 Link to this post

    I figured it out for some reason when I saved the rlinq file it would not update.  Still think that your tool should change the datatype or at least warn us for any datatype that is not compatible with the DataService so we can manually make the change. 
  6. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 17 Nov 2010 Link to this post

    Hello Brian,

    Thank you for your feedback.
    We already have such a task on our TODO list for the DSW.
    The next version will check if you have selected to use WCF Data Services and also have properties of type char (or other incompatible type) in your model and warn you about that.

    Do not hesitate to write again if you have more questions or suggestions.

    Regards,
    Jordan
    the Telerik team
    See What's New in Telerik OpenAccess ORM in Q3 2010!
    Monday, November 15, 11 am Eastern Time: Register here>>
    Monday, November 15, 10 pm Eastern Time: Register here>>
Back to Top
DevCraft banner